mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
merge with master
This commit is contained in:
@@ -43,3 +43,4 @@ scripts/word2md.js
|
||||
scripts/ior.js
|
||||
scripts/*.js.map
|
||||
coverage/
|
||||
internal/
|
||||
|
||||
+799
-396
File diff suppressed because it is too large
Load Diff
Vendored
+15
-1
@@ -283,6 +283,11 @@ declare module "typescript" {
|
||||
ThisNodeOrAnySubNodesHasError = 32,
|
||||
HasAggregatedChildData = 64,
|
||||
}
|
||||
const enum RelationComparisonResult {
|
||||
Succeeded = 1,
|
||||
Failed = 2,
|
||||
FailedAndReported = 3,
|
||||
}
|
||||
interface Node extends TextRange {
|
||||
kind: SyntaxKind;
|
||||
flags: NodeFlags;
|
||||
@@ -994,11 +999,15 @@ declare module "typescript" {
|
||||
Union = 16384,
|
||||
Anonymous = 32768,
|
||||
FromSignature = 65536,
|
||||
Unwidened = 131072,
|
||||
ObjectLiteral = 131072,
|
||||
ContainsUndefinedOrNull = 262144,
|
||||
ContainsObjectLiteral = 524288,
|
||||
Intrinsic = 127,
|
||||
Primitive = 510,
|
||||
StringLike = 258,
|
||||
NumberLike = 132,
|
||||
ObjectType = 48128,
|
||||
RequiresWidening = 786432,
|
||||
}
|
||||
interface Type {
|
||||
flags: TypeFlags;
|
||||
@@ -1123,6 +1132,7 @@ declare module "typescript" {
|
||||
diagnostics?: boolean;
|
||||
emitBOM?: boolean;
|
||||
help?: boolean;
|
||||
listFiles?: boolean;
|
||||
locale?: string;
|
||||
mapRoot?: string;
|
||||
module?: ModuleKind;
|
||||
@@ -1136,6 +1146,7 @@ declare module "typescript" {
|
||||
out?: string;
|
||||
outDir?: string;
|
||||
preserveConstEnums?: boolean;
|
||||
project?: string;
|
||||
removeComments?: boolean;
|
||||
sourceMap?: boolean;
|
||||
sourceRoot?: string;
|
||||
@@ -1168,6 +1179,7 @@ declare module "typescript" {
|
||||
interface CommandLineOption {
|
||||
name: string;
|
||||
type: string | Map<number>;
|
||||
isFilePath?: boolean;
|
||||
shortName?: string;
|
||||
description?: DiagnosticMessage;
|
||||
paramType?: DiagnosticMessage;
|
||||
@@ -1428,6 +1440,7 @@ declare module "typescript" {
|
||||
isOpen: boolean;
|
||||
version: string;
|
||||
scriptSnapshot: IScriptSnapshot;
|
||||
nameTable: Map<string>;
|
||||
getNamedDeclarations(): Declaration[];
|
||||
}
|
||||
/**
|
||||
@@ -1470,6 +1483,7 @@ declare module "typescript" {
|
||||
}
|
||||
interface LanguageServiceHost extends Logger {
|
||||
getCompilationSettings(): CompilerOptions;
|
||||
getNewLine?(): string;
|
||||
getScriptFileNames(): string[];
|
||||
getScriptVersion(fileName: string): string;
|
||||
getScriptIsOpen(fileName: string): boolean;
|
||||
|
||||
Vendored
+15
-1
@@ -283,6 +283,11 @@ declare module ts {
|
||||
ThisNodeOrAnySubNodesHasError = 32,
|
||||
HasAggregatedChildData = 64,
|
||||
}
|
||||
const enum RelationComparisonResult {
|
||||
Succeeded = 1,
|
||||
Failed = 2,
|
||||
FailedAndReported = 3,
|
||||
}
|
||||
interface Node extends TextRange {
|
||||
kind: SyntaxKind;
|
||||
flags: NodeFlags;
|
||||
@@ -994,11 +999,15 @@ declare module ts {
|
||||
Union = 16384,
|
||||
Anonymous = 32768,
|
||||
FromSignature = 65536,
|
||||
Unwidened = 131072,
|
||||
ObjectLiteral = 131072,
|
||||
ContainsUndefinedOrNull = 262144,
|
||||
ContainsObjectLiteral = 524288,
|
||||
Intrinsic = 127,
|
||||
Primitive = 510,
|
||||
StringLike = 258,
|
||||
NumberLike = 132,
|
||||
ObjectType = 48128,
|
||||
RequiresWidening = 786432,
|
||||
}
|
||||
interface Type {
|
||||
flags: TypeFlags;
|
||||
@@ -1123,6 +1132,7 @@ declare module ts {
|
||||
diagnostics?: boolean;
|
||||
emitBOM?: boolean;
|
||||
help?: boolean;
|
||||
listFiles?: boolean;
|
||||
locale?: string;
|
||||
mapRoot?: string;
|
||||
module?: ModuleKind;
|
||||
@@ -1136,6 +1146,7 @@ declare module ts {
|
||||
out?: string;
|
||||
outDir?: string;
|
||||
preserveConstEnums?: boolean;
|
||||
project?: string;
|
||||
removeComments?: boolean;
|
||||
sourceMap?: boolean;
|
||||
sourceRoot?: string;
|
||||
@@ -1168,6 +1179,7 @@ declare module ts {
|
||||
interface CommandLineOption {
|
||||
name: string;
|
||||
type: string | Map<number>;
|
||||
isFilePath?: boolean;
|
||||
shortName?: string;
|
||||
description?: DiagnosticMessage;
|
||||
paramType?: DiagnosticMessage;
|
||||
@@ -1428,6 +1440,7 @@ declare module ts {
|
||||
isOpen: boolean;
|
||||
version: string;
|
||||
scriptSnapshot: IScriptSnapshot;
|
||||
nameTable: Map<string>;
|
||||
getNamedDeclarations(): Declaration[];
|
||||
}
|
||||
/**
|
||||
@@ -1470,6 +1483,7 @@ declare module ts {
|
||||
}
|
||||
interface LanguageServiceHost extends Logger {
|
||||
getCompilationSettings(): CompilerOptions;
|
||||
getNewLine?(): string;
|
||||
getScriptFileNames(): string[];
|
||||
getScriptVersion(fileName: string): string;
|
||||
getScriptIsOpen(fileName: string): boolean;
|
||||
|
||||
+783
-374
File diff suppressed because it is too large
Load Diff
Vendored
+5
-1
@@ -44,6 +44,7 @@ declare module ts {
|
||||
function getProperty<T>(map: Map<T>, key: string): T;
|
||||
function isEmpty<T>(map: Map<T>): boolean;
|
||||
function clone<T>(object: T): T;
|
||||
function extend<T>(first: Map<T>, second: Map<T>): Map<T>;
|
||||
function forEachValue<T, U>(map: Map<T>, callback: (value: T) => U): U;
|
||||
function forEachKey<T, U>(map: Map<T>, callback: (key: string) => U): U;
|
||||
function lookUp<T>(map: Map<T>, key: string): T;
|
||||
@@ -125,6 +126,7 @@ declare module ts {
|
||||
createDirectory(directoryName: string): void;
|
||||
getExecutingFilePath(): string;
|
||||
getCurrentDirectory(): string;
|
||||
readDirectory(path: string, extension?: string): string[];
|
||||
getMemoryUsage?(): number;
|
||||
exit(exitCode?: number): void;
|
||||
}
|
||||
@@ -186,7 +188,7 @@ declare module ts {
|
||||
function isObjectLiteralMethod(node: Node): boolean;
|
||||
function getContainingFunction(node: Node): FunctionLikeDeclaration;
|
||||
function getThisContainer(node: Node, includeArrowFunctions: boolean): Node;
|
||||
function getSuperContainer(node: Node): Node;
|
||||
function getSuperContainer(node: Node, includeFunctions: boolean): Node;
|
||||
function getInvokedExpression(node: CallLikeExpression): Expression;
|
||||
function isExpression(node: Node): boolean;
|
||||
function isInstantiatedModule(node: ModuleDeclaration, preserveConstEnums: boolean): boolean;
|
||||
@@ -244,6 +246,8 @@ declare module ts {
|
||||
declare module ts {
|
||||
var optionDeclarations: CommandLineOption[];
|
||||
function parseCommandLine(commandLine: string[]): ParsedCommandLine;
|
||||
function readConfigFile(filename: string): any;
|
||||
function parseConfigFile(json: any, basePath?: string): ParsedCommandLine;
|
||||
}
|
||||
declare module ts {
|
||||
interface ListItemInfo {
|
||||
|
||||
Vendored
+5
-1
@@ -44,6 +44,7 @@ declare module "typescript" {
|
||||
function getProperty<T>(map: Map<T>, key: string): T;
|
||||
function isEmpty<T>(map: Map<T>): boolean;
|
||||
function clone<T>(object: T): T;
|
||||
function extend<T>(first: Map<T>, second: Map<T>): Map<T>;
|
||||
function forEachValue<T, U>(map: Map<T>, callback: (value: T) => U): U;
|
||||
function forEachKey<T, U>(map: Map<T>, callback: (key: string) => U): U;
|
||||
function lookUp<T>(map: Map<T>, key: string): T;
|
||||
@@ -125,6 +126,7 @@ declare module "typescript" {
|
||||
createDirectory(directoryName: string): void;
|
||||
getExecutingFilePath(): string;
|
||||
getCurrentDirectory(): string;
|
||||
readDirectory(path: string, extension?: string): string[];
|
||||
getMemoryUsage?(): number;
|
||||
exit(exitCode?: number): void;
|
||||
}
|
||||
@@ -186,7 +188,7 @@ declare module "typescript" {
|
||||
function isObjectLiteralMethod(node: Node): boolean;
|
||||
function getContainingFunction(node: Node): FunctionLikeDeclaration;
|
||||
function getThisContainer(node: Node, includeArrowFunctions: boolean): Node;
|
||||
function getSuperContainer(node: Node): Node;
|
||||
function getSuperContainer(node: Node, includeFunctions: boolean): Node;
|
||||
function getInvokedExpression(node: CallLikeExpression): Expression;
|
||||
function isExpression(node: Node): boolean;
|
||||
function isInstantiatedModule(node: ModuleDeclaration, preserveConstEnums: boolean): boolean;
|
||||
@@ -244,6 +246,8 @@ declare module "typescript" {
|
||||
declare module "typescript" {
|
||||
var optionDeclarations: CommandLineOption[];
|
||||
function parseCommandLine(commandLine: string[]): ParsedCommandLine;
|
||||
function readConfigFile(filename: string): any;
|
||||
function parseConfigFile(json: any, basePath?: string): ParsedCommandLine;
|
||||
}
|
||||
declare module "typescript" {
|
||||
interface ListItemInfo {
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+589
-208
File diff suppressed because it is too large
Load Diff
+44
-44
@@ -1,46 +1,46 @@
|
||||
{
|
||||
"name": "typescript",
|
||||
"author": "Microsoft Corp.",
|
||||
"homepage": "http://typescriptlang.org/",
|
||||
"version": "1.4.0",
|
||||
"licenses": [
|
||||
{
|
||||
"type": "Apache License 2.0",
|
||||
"url": "https://github.com/Microsoft/TypeScript/blob/master/LICENSE.txt"
|
||||
}
|
||||
],
|
||||
"description": "TypeScript is a language for application scale JavaScript development",
|
||||
"keywords": [
|
||||
"TypeScript",
|
||||
"Microsoft",
|
||||
"compiler",
|
||||
"language",
|
||||
"javascript"
|
||||
],
|
||||
"bugs": {
|
||||
"url" : "https://github.com/Microsoft/TypeScript/issues"
|
||||
},
|
||||
"repository" : {
|
||||
"type" : "git",
|
||||
"url" : "https://github.com/Microsoft/TypeScript.git"
|
||||
},
|
||||
"preferGlobal" : true,
|
||||
"main" : "./bin/typescriptServices.js",
|
||||
"bin" : {
|
||||
"tsc" : "./bin/tsc"
|
||||
},
|
||||
"engines" : {
|
||||
"node" : ">=0.8.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"jake" : "latest",
|
||||
"mocha" : "latest",
|
||||
"chai" : "latest",
|
||||
"browserify" : "latest",
|
||||
"istanbul": "latest",
|
||||
"codeclimate-test-reporter": "latest"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "jake generate-code-coverage"
|
||||
}
|
||||
"name": "typescript",
|
||||
"author": "Microsoft Corp.",
|
||||
"homepage": "http://typescriptlang.org/",
|
||||
"version": "1.5.0",
|
||||
"licenses": [
|
||||
{
|
||||
"type": "Apache License 2.0",
|
||||
"url": "https://github.com/Microsoft/TypeScript/blob/master/LICENSE.txt"
|
||||
}
|
||||
],
|
||||
"description": "TypeScript is a language for application scale JavaScript development",
|
||||
"keywords": [
|
||||
"TypeScript",
|
||||
"Microsoft",
|
||||
"compiler",
|
||||
"language",
|
||||
"javascript"
|
||||
],
|
||||
"bugs": {
|
||||
"url": "https://github.com/Microsoft/TypeScript/issues"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Microsoft/TypeScript.git"
|
||||
},
|
||||
"preferGlobal": true,
|
||||
"main": "./bin/typescriptServices.js",
|
||||
"bin": {
|
||||
"tsc": "./bin/tsc"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"jake": "latest",
|
||||
"mocha": "latest",
|
||||
"chai": "latest",
|
||||
"browserify": "latest",
|
||||
"istanbul": "latest",
|
||||
"codeclimate-test-reporter": "latest"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "jake generate-code-coverage"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/// <reference path="..\src\harness\external\node.d.ts" />
|
||||
|
||||
import cp = require('child_process');
|
||||
import fs = require('fs');
|
||||
|
||||
// Slice off 'node bisect-test.js' from the commandline args
|
||||
var args = process.argv.slice(2);
|
||||
|
||||
function tsc(tscArgs: string, onExit: (exitCode: number) => void) {
|
||||
var tsc = cp.exec('node built/local/tsc.js ' + tscArgs,() => void 0);
|
||||
tsc.on('close', tscExitCode => {
|
||||
onExit(tscExitCode);
|
||||
});
|
||||
}
|
||||
|
||||
var jake = cp.exec('jake clean local', () => void 0);
|
||||
jake.on('close', jakeExitCode => {
|
||||
if (jakeExitCode === 0) {
|
||||
// See what we're being asked to do
|
||||
if (args[1] === 'compiles' || args[1] === '!compiles') {
|
||||
tsc(args[0], tscExitCode => {
|
||||
if ((tscExitCode === 0) === (args[1] === 'compiles')) {
|
||||
console.log('Good');
|
||||
process.exit(0); // Good
|
||||
} else {
|
||||
console.log('Bad');
|
||||
process.exit(1); // Bad
|
||||
}
|
||||
});
|
||||
} else if (args[1] === 'emits' || args[1] === '!emits') {
|
||||
tsc(args[0], tscExitCode => {
|
||||
fs.readFile(args[2], 'utf-8', (err, data) => {
|
||||
var doesContains = data.indexOf(args[3]) >= 0;
|
||||
if (doesContains === (args[1] === 'emits')) {
|
||||
console.log('Good');
|
||||
process.exit(0); // Good
|
||||
} else {
|
||||
console.log('Bad');
|
||||
process.exit(1); // Bad
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
console.log('Unknown command line arguments.');
|
||||
console.log('Usage (compile errors): git bisect run scripts\bisect.js "foo.ts --module amd" compiles');
|
||||
console.log('Usage (emit check): git bisect run scripts\bisect.js bar.ts emits bar.js "_this = this"');
|
||||
// Aborts the 'git bisect run' process
|
||||
process.exit(-1);
|
||||
}
|
||||
} else {
|
||||
// Compiler build failed; skip this commit
|
||||
console.log('Skip');
|
||||
process.exit(125); // bisect skip
|
||||
}
|
||||
});
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
echo off
|
||||
IF NOT EXIST scripts\bisect.cmd GOTO :wrongdir
|
||||
IF "%1" == "" GOTO :usage
|
||||
IF "%1" == "GO" GOTO :run
|
||||
GOTO :copy
|
||||
|
||||
:usage
|
||||
echo Usage: bisect GoodCommit BadCommit test.ts compiles
|
||||
echo Usage: bisect GoodCommit BadCommit test.ts emits test.js "var x = 3"
|
||||
GOTO :eof
|
||||
|
||||
:copy
|
||||
copy scripts\bisect.cmd scripts\bisect-fresh.cmd
|
||||
scripts\bisect-fresh GO %*
|
||||
GOTO :eof
|
||||
|
||||
:run
|
||||
call jake local
|
||||
node built/local/tsc.js scripts/bisect-test.ts --module commonjs
|
||||
git bisect start %2 %3
|
||||
git bisect run node scripts/bisect-test.js %4 %5 %6 %7
|
||||
del scripts\bisect-test.js
|
||||
del scripts\bisect-fresh.cmd
|
||||
GOTO :eof
|
||||
|
||||
:wrongdir
|
||||
@echo Run this file from the repo folder, not the scripts folder
|
||||
GOTO :eof
|
||||
|
||||
:eof
|
||||
+23
-17
@@ -50,12 +50,13 @@ module ts {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns false if any of the following are true:
|
||||
* 1. declaration has no name
|
||||
* 2. declaration has a literal name (not computed)
|
||||
* 3. declaration has a computed property name that is a known symbol
|
||||
* A declaration has a dynamic name if both of the following are true:
|
||||
* 1. The declaration has a computed property name
|
||||
* 2. The computed name is *not* expressed as Symbol.<name>, where name
|
||||
* is a property of the Symbol constructor that denotes a built in
|
||||
* Symbol.
|
||||
*/
|
||||
export function hasComputedNameButNotSymbol(declaration: Declaration): boolean {
|
||||
export function hasDynamicName(declaration: Declaration): boolean {
|
||||
return declaration.name && declaration.name.kind === SyntaxKind.ComputedPropertyName;
|
||||
}
|
||||
|
||||
@@ -96,7 +97,7 @@ module ts {
|
||||
if (node.kind === SyntaxKind.ModuleDeclaration && node.name.kind === SyntaxKind.StringLiteral) {
|
||||
return '"' + (<LiteralExpression>node.name).text + '"';
|
||||
}
|
||||
Debug.assert(!hasComputedNameButNotSymbol(node));
|
||||
Debug.assert(!hasDynamicName(node));
|
||||
return (<Identifier | LiteralExpression>node.name).text;
|
||||
}
|
||||
switch (node.kind) {
|
||||
@@ -118,11 +119,7 @@ module ts {
|
||||
}
|
||||
|
||||
function declareSymbol(symbols: SymbolTable, parent: Symbol, node: Declaration, includes: SymbolFlags, excludes: SymbolFlags): Symbol {
|
||||
// Nodes with computed property names will not get symbols, because the type checker
|
||||
// does not make properties for them.
|
||||
if (hasComputedNameButNotSymbol(node)) {
|
||||
return undefined;
|
||||
}
|
||||
Debug.assert(!hasDynamicName(node));
|
||||
|
||||
var name = getDeclarationName(node);
|
||||
if (name !== undefined) {
|
||||
@@ -395,14 +392,14 @@ module ts {
|
||||
break;
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.Property | ((<PropertyDeclaration>node).questionToken ? SymbolFlags.Optional : 0), SymbolFlags.PropertyExcludes, /*isBlockScopeContainer*/ false);
|
||||
bindPropertyOrMethodOrAccessor(<Declaration>node, SymbolFlags.Property | ((<PropertyDeclaration>node).questionToken ? SymbolFlags.Optional : 0), SymbolFlags.PropertyExcludes, /*isBlockScopeContainer*/ false);
|
||||
break;
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
case SyntaxKind.ShorthandPropertyAssignment:
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.Property, SymbolFlags.PropertyExcludes, /*isBlockScopeContainer*/ false);
|
||||
bindPropertyOrMethodOrAccessor(<Declaration>node, SymbolFlags.Property, SymbolFlags.PropertyExcludes, /*isBlockScopeContainer*/ false);
|
||||
break;
|
||||
case SyntaxKind.EnumMember:
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.EnumMember, SymbolFlags.EnumMemberExcludes, /*isBlockScopeContainer*/ false);
|
||||
bindPropertyOrMethodOrAccessor(<Declaration>node, SymbolFlags.EnumMember, SymbolFlags.EnumMemberExcludes, /*isBlockScopeContainer*/ false);
|
||||
break;
|
||||
case SyntaxKind.CallSignature:
|
||||
case SyntaxKind.ConstructSignature:
|
||||
@@ -415,7 +412,7 @@ module ts {
|
||||
// as other properties in the object literal. So we use SymbolFlags.PropertyExcludes
|
||||
// so that it will conflict with any other object literal members with the same
|
||||
// name.
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.Method | ((<MethodDeclaration>node).questionToken ? SymbolFlags.Optional : 0),
|
||||
bindPropertyOrMethodOrAccessor(<Declaration>node, SymbolFlags.Method | ((<MethodDeclaration>node).questionToken ? SymbolFlags.Optional : 0),
|
||||
isObjectLiteralMethod(node) ? SymbolFlags.PropertyExcludes : SymbolFlags.MethodExcludes, /*isBlockScopeContainer*/ true);
|
||||
break;
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
@@ -425,10 +422,10 @@ module ts {
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.Constructor, /*symbolExcludes:*/ 0, /*isBlockScopeContainer:*/ true);
|
||||
break;
|
||||
case SyntaxKind.GetAccessor:
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.GetAccessor, SymbolFlags.GetAccessorExcludes, /*isBlockScopeContainer*/ true);
|
||||
bindPropertyOrMethodOrAccessor(<Declaration>node, SymbolFlags.GetAccessor, SymbolFlags.GetAccessorExcludes, /*isBlockScopeContainer*/ true);
|
||||
break;
|
||||
case SyntaxKind.SetAccessor:
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.SetAccessor, SymbolFlags.SetAccessorExcludes, /*isBlockScopeContainer*/ true);
|
||||
bindPropertyOrMethodOrAccessor(<Declaration>node, SymbolFlags.SetAccessor, SymbolFlags.SetAccessorExcludes, /*isBlockScopeContainer*/ true);
|
||||
break;
|
||||
|
||||
case SyntaxKind.FunctionType:
|
||||
@@ -510,5 +507,14 @@ module ts {
|
||||
declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, SymbolFlags.Property, SymbolFlags.PropertyExcludes);
|
||||
}
|
||||
}
|
||||
|
||||
function bindPropertyOrMethodOrAccessor(node: Declaration, symbolKind: SymbolFlags, symbolExcludes: SymbolFlags, isBlockScopeContainer: boolean) {
|
||||
if (hasDynamicName(node)) {
|
||||
bindAnonymousDeclaration(node, symbolKind, "__computed", isBlockScopeContainer);
|
||||
}
|
||||
else {
|
||||
bindDeclaration(node, symbolKind, symbolExcludes, isBlockScopeContainer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+425
-237
File diff suppressed because it is too large
Load Diff
@@ -280,7 +280,6 @@ module ts {
|
||||
messageText: text,
|
||||
category: message.category,
|
||||
code: message.code,
|
||||
isEarly: message.isEarly
|
||||
};
|
||||
}
|
||||
|
||||
@@ -299,8 +298,7 @@ module ts {
|
||||
|
||||
messageText: text,
|
||||
category: message.category,
|
||||
code: message.code,
|
||||
isEarly: message.isEarly
|
||||
code: message.code
|
||||
};
|
||||
}
|
||||
|
||||
@@ -646,6 +644,10 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
export function getDefaultLibFilename(options: CompilerOptions): string {
|
||||
return options.target === ScriptTarget.ES6 ? "lib.es6.d.ts" : "lib.d.ts";
|
||||
}
|
||||
|
||||
export interface ObjectAllocator {
|
||||
getNodeConstructor(kind: SyntaxKind): new () => Node;
|
||||
getSymbolConstructor(): new (flags: SymbolFlags, name: string) => Symbol;
|
||||
|
||||
@@ -4,87 +4,87 @@ module ts {
|
||||
export var Diagnostics = {
|
||||
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.", isEarly: true },
|
||||
_0_expected: { code: 1005, category: DiagnosticCategory.Error, key: "'{0}' expected." },
|
||||
A_file_cannot_have_a_reference_to_itself: { code: 1006, category: DiagnosticCategory.Error, key: "A file cannot have a reference to itself." },
|
||||
Trailing_comma_not_allowed: { code: 1009, category: DiagnosticCategory.Error, key: "Trailing comma not allowed.", isEarly: true },
|
||||
Trailing_comma_not_allowed: { code: 1009, category: DiagnosticCategory.Error, key: "Trailing comma not allowed." },
|
||||
Asterisk_Slash_expected: { code: 1010, category: DiagnosticCategory.Error, key: "'*/' expected." },
|
||||
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.", isEarly: true },
|
||||
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.", isEarly: true },
|
||||
Parameter_cannot_have_question_mark_and_initializer: { code: 1015, category: DiagnosticCategory.Error, key: "Parameter cannot have question mark and initializer.", isEarly: true },
|
||||
A_required_parameter_cannot_follow_an_optional_parameter: { code: 1016, category: DiagnosticCategory.Error, key: "A required parameter cannot follow an optional parameter.", isEarly: true },
|
||||
An_index_signature_cannot_have_a_rest_parameter: { code: 1017, category: DiagnosticCategory.Error, key: "An index signature cannot have a rest parameter.", isEarly: true },
|
||||
An_index_signature_parameter_cannot_have_an_accessibility_modifier: { code: 1018, category: DiagnosticCategory.Error, key: "An index signature parameter cannot have an accessibility modifier.", isEarly: true },
|
||||
An_index_signature_parameter_cannot_have_a_question_mark: { code: 1019, category: DiagnosticCategory.Error, key: "An index signature parameter cannot have a question mark.", isEarly: true },
|
||||
An_index_signature_parameter_cannot_have_an_initializer: { code: 1020, category: DiagnosticCategory.Error, key: "An index signature parameter cannot have an initializer.", isEarly: true },
|
||||
An_index_signature_must_have_a_type_annotation: { code: 1021, category: DiagnosticCategory.Error, key: "An index signature must have a type annotation.", isEarly: true },
|
||||
An_index_signature_parameter_must_have_a_type_annotation: { code: 1022, category: DiagnosticCategory.Error, key: "An index signature parameter must have a type annotation.", isEarly: true },
|
||||
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'.", isEarly: true },
|
||||
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." },
|
||||
Parameter_cannot_have_question_mark_and_initializer: { code: 1015, category: DiagnosticCategory.Error, key: "Parameter cannot have question mark and initializer." },
|
||||
A_required_parameter_cannot_follow_an_optional_parameter: { code: 1016, category: DiagnosticCategory.Error, key: "A required parameter cannot follow an optional parameter." },
|
||||
An_index_signature_cannot_have_a_rest_parameter: { code: 1017, category: DiagnosticCategory.Error, key: "An index signature cannot have a rest parameter." },
|
||||
An_index_signature_parameter_cannot_have_an_accessibility_modifier: { code: 1018, category: DiagnosticCategory.Error, key: "An index signature parameter cannot have an accessibility modifier." },
|
||||
An_index_signature_parameter_cannot_have_a_question_mark: { code: 1019, category: DiagnosticCategory.Error, key: "An index signature parameter cannot have a question mark." },
|
||||
An_index_signature_parameter_cannot_have_an_initializer: { code: 1020, category: DiagnosticCategory.Error, key: "An index signature parameter cannot have an initializer." },
|
||||
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'." },
|
||||
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.", isEarly: true },
|
||||
_0_modifier_must_precede_1_modifier: { code: 1029, category: DiagnosticCategory.Error, key: "'{0}' modifier must precede '{1}' modifier.", isEarly: true },
|
||||
_0_modifier_already_seen: { code: 1030, category: DiagnosticCategory.Error, key: "'{0}' modifier already seen.", isEarly: true },
|
||||
_0_modifier_cannot_appear_on_a_class_element: { code: 1031, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a class element.", isEarly: true },
|
||||
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." },
|
||||
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.", isEarly: true },
|
||||
Statements_are_not_allowed_in_ambient_contexts: { code: 1036, category: DiagnosticCategory.Error, key: "Statements are not allowed in ambient contexts.", isEarly: true },
|
||||
A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { code: 1038, category: DiagnosticCategory.Error, key: "A 'declare' modifier cannot be used in an already ambient context.", isEarly: true },
|
||||
Initializers_are_not_allowed_in_ambient_contexts: { code: 1039, category: DiagnosticCategory.Error, key: "Initializers are not allowed in ambient contexts.", isEarly: true },
|
||||
_0_modifier_cannot_appear_on_a_module_element: { code: 1044, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a module element.", isEarly: true },
|
||||
A_declare_modifier_cannot_be_used_with_an_interface_declaration: { code: 1045, category: DiagnosticCategory.Error, key: "A 'declare' modifier cannot be used with an interface declaration.", isEarly: true },
|
||||
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_declare_modifier_cannot_be_used_in_an_already_ambient_context: { code: 1038, category: DiagnosticCategory.Error, key: "A 'declare' modifier cannot be used in an already ambient context." },
|
||||
Initializers_are_not_allowed_in_ambient_contexts: { code: 1039, category: DiagnosticCategory.Error, key: "Initializers are not allowed in ambient contexts." },
|
||||
_0_modifier_cannot_appear_on_a_module_element: { code: 1044, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a module element." },
|
||||
A_declare_modifier_cannot_be_used_with_an_interface_declaration: { code: 1045, category: DiagnosticCategory.Error, key: "A 'declare' modifier cannot be used with an interface declaration." },
|
||||
A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { code: 1046, category: DiagnosticCategory.Error, key: "A 'declare' modifier is required for a top level declaration in a .d.ts file." },
|
||||
A_rest_parameter_cannot_be_optional: { code: 1047, category: DiagnosticCategory.Error, key: "A rest parameter cannot be optional.", isEarly: true },
|
||||
A_rest_parameter_cannot_have_an_initializer: { code: 1048, category: DiagnosticCategory.Error, key: "A rest parameter cannot have an initializer.", isEarly: true },
|
||||
A_set_accessor_must_have_exactly_one_parameter: { code: 1049, category: DiagnosticCategory.Error, key: "A 'set' accessor must have exactly one parameter.", isEarly: true },
|
||||
A_set_accessor_cannot_have_an_optional_parameter: { code: 1051, category: DiagnosticCategory.Error, key: "A 'set' accessor cannot have an optional parameter.", isEarly: true },
|
||||
A_set_accessor_parameter_cannot_have_an_initializer: { code: 1052, category: DiagnosticCategory.Error, key: "A 'set' accessor parameter cannot have an initializer.", isEarly: true },
|
||||
A_set_accessor_cannot_have_rest_parameter: { code: 1053, category: DiagnosticCategory.Error, key: "A 'set' accessor cannot have rest parameter.", isEarly: true },
|
||||
A_get_accessor_cannot_have_parameters: { code: 1054, category: DiagnosticCategory.Error, key: "A 'get' accessor cannot have parameters.", isEarly: true },
|
||||
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.", isEarly: true },
|
||||
Enum_member_must_have_initializer: { code: 1061, category: DiagnosticCategory.Error, key: "Enum member must have initializer.", isEarly: true },
|
||||
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.", isEarly: true },
|
||||
Ambient_enum_elements_can_only_have_integer_literal_initializers: { code: 1066, category: DiagnosticCategory.Error, key: "Ambient enum elements can only have integer literal initializers.", isEarly: true },
|
||||
A_rest_parameter_cannot_be_optional: { code: 1047, category: DiagnosticCategory.Error, key: "A rest parameter cannot be optional." },
|
||||
A_rest_parameter_cannot_have_an_initializer: { code: 1048, category: DiagnosticCategory.Error, key: "A rest parameter cannot have an initializer." },
|
||||
A_set_accessor_must_have_exactly_one_parameter: { code: 1049, category: DiagnosticCategory.Error, key: "A 'set' accessor must have exactly one parameter." },
|
||||
A_set_accessor_cannot_have_an_optional_parameter: { code: 1051, category: DiagnosticCategory.Error, key: "A 'set' accessor cannot have an optional parameter." },
|
||||
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." },
|
||||
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: 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." },
|
||||
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." },
|
||||
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.", isEarly: true },
|
||||
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.", isEarly: true },
|
||||
An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: DiagnosticCategory.Error, key: "An accessor cannot be declared in an ambient context.", isEarly: true },
|
||||
_0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a constructor declaration.", isEarly: true },
|
||||
_0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a parameter.", isEarly: true },
|
||||
Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { code: 1091, category: DiagnosticCategory.Error, key: "Only a single variable declaration is allowed in a 'for...in' statement.", isEarly: true },
|
||||
Type_parameters_cannot_appear_on_a_constructor_declaration: { code: 1092, category: DiagnosticCategory.Error, key: "Type parameters cannot appear on a constructor declaration.", isEarly: true },
|
||||
Type_annotation_cannot_appear_on_a_constructor_declaration: { code: 1093, category: DiagnosticCategory.Error, key: "Type annotation cannot appear on a constructor declaration.", isEarly: true },
|
||||
An_accessor_cannot_have_type_parameters: { code: 1094, category: DiagnosticCategory.Error, key: "An accessor cannot have type parameters.", isEarly: true },
|
||||
A_set_accessor_cannot_have_a_return_type_annotation: { code: 1095, category: DiagnosticCategory.Error, key: "A 'set' accessor cannot have a return type annotation.", isEarly: true },
|
||||
An_index_signature_must_have_exactly_one_parameter: { code: 1096, category: DiagnosticCategory.Error, key: "An index signature must have exactly one parameter.", isEarly: true },
|
||||
_0_list_cannot_be_empty: { code: 1097, category: DiagnosticCategory.Error, key: "'{0}' list cannot be empty.", isEarly: true },
|
||||
Type_parameter_list_cannot_be_empty: { code: 1098, category: DiagnosticCategory.Error, key: "Type parameter list cannot be empty.", isEarly: true },
|
||||
Type_argument_list_cannot_be_empty: { code: 1099, category: DiagnosticCategory.Error, key: "Type argument list cannot be empty.", isEarly: true },
|
||||
Invalid_use_of_0_in_strict_mode: { code: 1100, category: DiagnosticCategory.Error, key: "Invalid use of '{0}' in strict mode.", isEarly: true },
|
||||
with_statements_are_not_allowed_in_strict_mode: { code: 1101, category: DiagnosticCategory.Error, key: "'with' statements are not allowed in strict mode.", isEarly: true },
|
||||
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.", isEarly: true },
|
||||
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.", isEarly: true },
|
||||
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.", isEarly: true },
|
||||
Jump_target_cannot_cross_function_boundary: { code: 1107, category: DiagnosticCategory.Error, key: "Jump target cannot cross function boundary.", isEarly: true },
|
||||
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.", isEarly: true },
|
||||
Expression_expected: { code: 1109, category: DiagnosticCategory.Error, key: "Expression expected.", isEarly: true },
|
||||
Type_expected: { code: 1110, category: DiagnosticCategory.Error, key: "Type expected.", isEarly: true },
|
||||
A_class_member_cannot_be_declared_optional: { code: 1112, category: DiagnosticCategory.Error, key: "A class member cannot be declared optional.", isEarly: true },
|
||||
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.", isEarly: true },
|
||||
Duplicate_label_0: { code: 1114, category: DiagnosticCategory.Error, key: "Duplicate label '{0}'", isEarly: true },
|
||||
A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: DiagnosticCategory.Error, key: "A 'continue' statement can only jump to a label of an enclosing iteration statement.", isEarly: true },
|
||||
A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { code: 1116, category: DiagnosticCategory.Error, key: "A 'break' statement can only jump to a label of an enclosing statement.", isEarly: true },
|
||||
An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { code: 1117, category: DiagnosticCategory.Error, key: "An object literal cannot have multiple properties with the same name in strict mode.", isEarly: true },
|
||||
An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { code: 1118, category: DiagnosticCategory.Error, key: "An object literal cannot have multiple get/set accessors with the same name.", isEarly: true },
|
||||
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.", isEarly: true },
|
||||
An_export_assignment_cannot_have_modifiers: { code: 1120, category: DiagnosticCategory.Error, key: "An export assignment cannot have modifiers.", isEarly: true },
|
||||
Octal_literals_are_not_allowed_in_strict_mode: { code: 1121, category: DiagnosticCategory.Error, key: "Octal literals are not allowed in strict mode.", isEarly: true },
|
||||
A_tuple_type_element_list_cannot_be_empty: { code: 1122, category: DiagnosticCategory.Error, key: "A tuple type element list cannot be empty.", isEarly: true },
|
||||
Variable_declaration_list_cannot_be_empty: { code: 1123, category: DiagnosticCategory.Error, key: "Variable declaration list cannot be empty.", isEarly: true },
|
||||
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." },
|
||||
An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: DiagnosticCategory.Error, key: "An accessor cannot be declared in an ambient context." },
|
||||
_0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a constructor declaration." },
|
||||
_0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a parameter." },
|
||||
Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { code: 1091, category: DiagnosticCategory.Error, key: "Only a single variable declaration is allowed in a 'for...in' statement." },
|
||||
Type_parameters_cannot_appear_on_a_constructor_declaration: { code: 1092, category: DiagnosticCategory.Error, key: "Type parameters cannot appear on a constructor declaration." },
|
||||
Type_annotation_cannot_appear_on_a_constructor_declaration: { code: 1093, category: DiagnosticCategory.Error, key: "Type annotation cannot appear on a constructor declaration." },
|
||||
An_accessor_cannot_have_type_parameters: { code: 1094, category: DiagnosticCategory.Error, key: "An accessor cannot have type parameters." },
|
||||
A_set_accessor_cannot_have_a_return_type_annotation: { code: 1095, category: DiagnosticCategory.Error, key: "A 'set' accessor cannot have a return type annotation." },
|
||||
An_index_signature_must_have_exactly_one_parameter: { code: 1096, category: DiagnosticCategory.Error, key: "An index signature must have exactly one parameter." },
|
||||
_0_list_cannot_be_empty: { code: 1097, category: DiagnosticCategory.Error, key: "'{0}' list cannot be empty." },
|
||||
Type_parameter_list_cannot_be_empty: { code: 1098, category: DiagnosticCategory.Error, key: "Type parameter list cannot be empty." },
|
||||
Type_argument_list_cannot_be_empty: { code: 1099, category: DiagnosticCategory.Error, key: "Type argument list cannot be empty." },
|
||||
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." },
|
||||
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: 1109, category: DiagnosticCategory.Error, key: "Expression expected." },
|
||||
Type_expected: { code: 1110, category: DiagnosticCategory.Error, key: "Type expected." },
|
||||
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." },
|
||||
Duplicate_label_0: { code: 1114, category: DiagnosticCategory.Error, key: "Duplicate label '{0}'" },
|
||||
A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: DiagnosticCategory.Error, key: "A 'continue' statement can only jump to a label of an enclosing iteration statement." },
|
||||
A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { code: 1116, category: DiagnosticCategory.Error, key: "A 'break' statement can only jump to a label of an enclosing statement." },
|
||||
An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { code: 1117, category: DiagnosticCategory.Error, key: "An object literal cannot have multiple properties with the same name in strict mode." },
|
||||
An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { code: 1118, category: DiagnosticCategory.Error, key: "An object literal cannot have multiple get/set accessors with the same name." },
|
||||
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." },
|
||||
A_tuple_type_element_list_cannot_be_empty: { code: 1122, category: DiagnosticCategory.Error, key: "A tuple type element list cannot be empty." },
|
||||
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." },
|
||||
@@ -96,53 +96,53 @@ module ts {
|
||||
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.", isEarly: true },
|
||||
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.", isEarly: true },
|
||||
Line_break_not_permitted_here: { code: 1142, category: DiagnosticCategory.Error, key: "Line break not permitted here.", isEarly: true },
|
||||
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." },
|
||||
or_expected: { code: 1144, category: DiagnosticCategory.Error, key: "'{' or ';' expected." },
|
||||
Modifiers_not_permitted_on_index_signature_members: { code: 1145, category: DiagnosticCategory.Error, key: "Modifiers not permitted on index signature members.", isEarly: true },
|
||||
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.", isEarly: true },
|
||||
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: 1150, category: DiagnosticCategory.Error, key: "'new T[]' cannot be used to create an array. Use 'new Array<T>()' instead.", isEarly: true },
|
||||
new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: DiagnosticCategory.Error, key: "'new T[]' cannot be used to create an array. Use 'new Array<T>()' instead." },
|
||||
var_let_or_const_expected: { code: 1152, category: DiagnosticCategory.Error, key: "'var', 'let' or 'const' expected." },
|
||||
let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1153, category: DiagnosticCategory.Error, key: "'let' declarations are only available when targeting ECMAScript 6 and higher.", isEarly: true },
|
||||
const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1154, category: DiagnosticCategory.Error, key: "'const' declarations are only available when targeting ECMAScript 6 and higher.", isEarly: true },
|
||||
const_declarations_must_be_initialized: { code: 1155, category: DiagnosticCategory.Error, key: "'const' declarations must be initialized", isEarly: true },
|
||||
const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: DiagnosticCategory.Error, key: "'const' declarations can only be declared inside a block.", isEarly: true },
|
||||
let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: DiagnosticCategory.Error, key: "'let' declarations can only be declared inside a block.", isEarly: true },
|
||||
Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1159, category: DiagnosticCategory.Error, key: "Tagged templates are only available when targeting ECMAScript 6 and higher.", isEarly: true },
|
||||
let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1153, category: DiagnosticCategory.Error, key: "'let' declarations are only available when targeting ECMAScript 6 and higher." },
|
||||
const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1154, category: DiagnosticCategory.Error, key: "'const' declarations are only available when targeting ECMAScript 6 and higher." },
|
||||
const_declarations_must_be_initialized: { code: 1155, category: DiagnosticCategory.Error, key: "'const' declarations must be initialized" },
|
||||
const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: DiagnosticCategory.Error, key: "'const' declarations can only be declared inside a block." },
|
||||
let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: DiagnosticCategory.Error, key: "'let' declarations can only be declared inside a block." },
|
||||
Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1159, category: DiagnosticCategory.Error, key: "Tagged templates are only available when targeting ECMAScript 6 and higher." },
|
||||
Unterminated_template_literal: { code: 1160, category: DiagnosticCategory.Error, key: "Unterminated template literal." },
|
||||
Unterminated_regular_expression_literal: { code: 1161, category: DiagnosticCategory.Error, key: "Unterminated regular expression literal." },
|
||||
An_object_member_cannot_be_declared_optional: { code: 1162, category: DiagnosticCategory.Error, key: "An object member cannot be declared optional.", isEarly: true },
|
||||
yield_expression_must_be_contained_within_a_generator_declaration: { code: 1163, category: DiagnosticCategory.Error, key: "'yield' expression must be contained_within a generator declaration.", isEarly: true },
|
||||
Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in enums.", isEarly: true },
|
||||
Computed_property_names_are_not_allowed_in_an_ambient_context: { code: 1165, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in an ambient context.", isEarly: true },
|
||||
Computed_property_names_are_not_allowed_in_class_property_declarations: { code: 1166, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in class property declarations.", isEarly: true },
|
||||
Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1167, category: DiagnosticCategory.Error, key: "Computed property names are only available when targeting ECMAScript 6 and higher.", isEarly: true },
|
||||
Computed_property_names_are_not_allowed_in_method_overloads: { code: 1168, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in method overloads.", isEarly: true },
|
||||
Computed_property_names_are_not_allowed_in_interfaces: { code: 1169, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in interfaces.", isEarly: true },
|
||||
Computed_property_names_are_not_allowed_in_type_literals: { code: 1170, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in type literals.", isEarly: true },
|
||||
An_object_member_cannot_be_declared_optional: { code: 1162, category: DiagnosticCategory.Error, key: "An object member cannot be declared optional." },
|
||||
yield_expression_must_be_contained_within_a_generator_declaration: { code: 1163, category: DiagnosticCategory.Error, key: "'yield' expression must be contained_within a generator declaration." },
|
||||
Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in enums." },
|
||||
Computed_property_names_are_not_allowed_in_an_ambient_context: { code: 1165, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in an ambient context." },
|
||||
Computed_property_names_are_not_allowed_in_class_property_declarations: { code: 1166, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in class property declarations." },
|
||||
Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1167, category: DiagnosticCategory.Error, key: "Computed property names are only available when targeting ECMAScript 6 and higher." },
|
||||
Computed_property_names_are_not_allowed_in_method_overloads: { code: 1168, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in method overloads." },
|
||||
Computed_property_names_are_not_allowed_in_interfaces: { code: 1169, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in interfaces." },
|
||||
Computed_property_names_are_not_allowed_in_type_literals: { code: 1170, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in type literals." },
|
||||
A_comma_expression_is_not_allowed_in_a_computed_property_name: { code: 1171, category: DiagnosticCategory.Error, key: "A comma expression is not allowed in a computed property name." },
|
||||
extends_clause_already_seen: { code: 1172, category: DiagnosticCategory.Error, key: "'extends' clause already seen.", isEarly: true },
|
||||
extends_clause_must_precede_implements_clause: { code: 1173, category: DiagnosticCategory.Error, key: "'extends' clause must precede 'implements' clause.", isEarly: true },
|
||||
Classes_can_only_extend_a_single_class: { code: 1174, category: DiagnosticCategory.Error, key: "Classes can only extend a single class.", isEarly: true },
|
||||
implements_clause_already_seen: { code: 1175, category: DiagnosticCategory.Error, key: "'implements' clause already seen.", isEarly: true },
|
||||
Interface_declaration_cannot_have_implements_clause: { code: 1176, category: DiagnosticCategory.Error, key: "Interface declaration cannot have 'implements' clause.", isEarly: true },
|
||||
extends_clause_already_seen: { code: 1172, category: DiagnosticCategory.Error, key: "'extends' clause already seen." },
|
||||
extends_clause_must_precede_implements_clause: { code: 1173, category: DiagnosticCategory.Error, key: "'extends' clause must precede 'implements' clause." },
|
||||
Classes_can_only_extend_a_single_class: { code: 1174, category: DiagnosticCategory.Error, key: "Classes can only extend a single class." },
|
||||
implements_clause_already_seen: { code: 1175, category: DiagnosticCategory.Error, key: "'implements' clause already seen." },
|
||||
Interface_declaration_cannot_have_implements_clause: { code: 1176, category: DiagnosticCategory.Error, key: "Interface declaration cannot have 'implements' clause." },
|
||||
Binary_digit_expected: { code: 1177, category: DiagnosticCategory.Error, key: "Binary digit expected." },
|
||||
Octal_digit_expected: { code: 1178, category: DiagnosticCategory.Error, key: "Octal digit expected." },
|
||||
Unexpected_token_expected: { code: 1179, category: DiagnosticCategory.Error, key: "Unexpected token. '{' expected." },
|
||||
Property_destructuring_pattern_expected: { code: 1180, category: DiagnosticCategory.Error, key: "Property destructuring pattern expected." },
|
||||
Array_element_destructuring_pattern_expected: { code: 1181, category: DiagnosticCategory.Error, key: "Array element destructuring pattern expected." },
|
||||
A_destructuring_declaration_must_have_an_initializer: { code: 1182, category: DiagnosticCategory.Error, key: "A destructuring declaration must have an initializer.", isEarly: true },
|
||||
Destructuring_declarations_are_not_allowed_in_ambient_contexts: { code: 1183, category: DiagnosticCategory.Error, key: "Destructuring declarations are not allowed in ambient contexts.", isEarly: true },
|
||||
An_implementation_cannot_be_declared_in_ambient_contexts: { code: 1184, category: DiagnosticCategory.Error, key: "An implementation cannot be declared in ambient contexts.", isEarly: true },
|
||||
A_destructuring_declaration_must_have_an_initializer: { code: 1182, category: DiagnosticCategory.Error, key: "A destructuring declaration must have an initializer." },
|
||||
Destructuring_declarations_are_not_allowed_in_ambient_contexts: { code: 1183, category: DiagnosticCategory.Error, key: "Destructuring declarations are not allowed in ambient contexts." },
|
||||
An_implementation_cannot_be_declared_in_ambient_contexts: { code: 1184, category: DiagnosticCategory.Error, key: "An implementation cannot be declared in ambient contexts." },
|
||||
Modifiers_cannot_appear_here: { code: 1184, category: DiagnosticCategory.Error, key: "Modifiers cannot appear here." },
|
||||
Merge_conflict_marker_encountered: { code: 1185, category: DiagnosticCategory.Error, key: "Merge conflict marker encountered." },
|
||||
A_rest_element_cannot_have_an_initializer: { code: 1186, category: DiagnosticCategory.Error, key: "A rest element cannot have an initializer." },
|
||||
@@ -284,10 +284,10 @@ module ts {
|
||||
Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { code: 2445, category: DiagnosticCategory.Error, key: "Property '{0}' is protected and only accessible within class '{1}' and its subclasses." },
|
||||
Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: DiagnosticCategory.Error, key: "Property '{0}' is protected and only accessible through an instance of class '{1}'." },
|
||||
The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { code: 2447, category: DiagnosticCategory.Error, key: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." },
|
||||
Block_scoped_variable_0_used_before_its_declaration: { code: 2448, category: DiagnosticCategory.Error, key: "Block-scoped variable '{0}' used before its declaration.", isEarly: true },
|
||||
The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant: { code: 2449, category: DiagnosticCategory.Error, key: "The operand of an increment or decrement operator cannot be a constant.", isEarly: true },
|
||||
Left_hand_side_of_assignment_expression_cannot_be_a_constant: { code: 2450, category: DiagnosticCategory.Error, key: "Left-hand side of assignment expression cannot be a constant.", isEarly: true },
|
||||
Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: DiagnosticCategory.Error, key: "Cannot redeclare block-scoped variable '{0}'.", isEarly: true },
|
||||
Block_scoped_variable_0_used_before_its_declaration: { code: 2448, category: DiagnosticCategory.Error, key: "Block-scoped variable '{0}' used before its declaration." },
|
||||
The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant: { code: 2449, category: DiagnosticCategory.Error, key: "The operand of an increment or decrement operator cannot be a constant." },
|
||||
Left_hand_side_of_assignment_expression_cannot_be_a_constant: { code: 2450, category: DiagnosticCategory.Error, key: "Left-hand side of assignment expression cannot be a constant." },
|
||||
Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: DiagnosticCategory.Error, key: "Cannot redeclare block-scoped variable '{0}'." },
|
||||
An_enum_member_cannot_have_a_numeric_name: { code: 2452, category: DiagnosticCategory.Error, key: "An enum member cannot have a numeric name." },
|
||||
The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { code: 2453, category: DiagnosticCategory.Error, key: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." },
|
||||
Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2455, category: DiagnosticCategory.Error, key: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." },
|
||||
@@ -299,6 +299,10 @@ module ts {
|
||||
Type_0_is_not_an_array_type: { code: 2461, category: DiagnosticCategory.Error, key: "Type '{0}' is not an array type." },
|
||||
A_rest_element_must_be_last_in_an_array_destructuring_pattern: { code: 2462, category: DiagnosticCategory.Error, key: "A rest element must be last in an array destructuring pattern" },
|
||||
A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { code: 2463, category: DiagnosticCategory.Error, key: "A binding pattern parameter cannot be optional in an implementation signature." },
|
||||
A_computed_property_name_must_be_of_type_string_number_or_any: { code: 2464, category: DiagnosticCategory.Error, key: "A computed property name must be of type 'string', 'number', or 'any'." },
|
||||
this_cannot_be_referenced_in_a_computed_property_name: { code: 2465, category: DiagnosticCategory.Error, key: "'this' cannot be referenced in a computed property name." },
|
||||
super_cannot_be_referenced_in_a_computed_property_name: { code: 2466, category: DiagnosticCategory.Error, key: "'super' cannot be referenced in a computed property name." },
|
||||
A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2466, category: DiagnosticCategory.Error, key: "A computed property name cannot reference a type parameter from its containing type." },
|
||||
Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
|
||||
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
|
||||
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
|
||||
@@ -369,12 +373,12 @@ module ts {
|
||||
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}'." },
|
||||
Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: DiagnosticCategory.Error, key: "Exported type alias '{0}' has or is using private name '{1}'." },
|
||||
Enum_declarations_must_all_be_const_or_non_const: { code: 4082, category: DiagnosticCategory.Error, key: "Enum declarations must all be const or non-const." },
|
||||
In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 4083, category: DiagnosticCategory.Error, key: "In 'const' enum declarations member initializer must be constant expression.", isEarly: true },
|
||||
In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 4083, category: DiagnosticCategory.Error, key: "In 'const' enum declarations member initializer must be constant expression." },
|
||||
const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 4084, category: DiagnosticCategory.Error, key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." },
|
||||
A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 4085, category: DiagnosticCategory.Error, key: "A const enum member can only be accessed using a string literal.", isEarly: true },
|
||||
A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 4085, category: DiagnosticCategory.Error, key: "A const enum member can only be accessed using a string literal." },
|
||||
const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 4086, category: DiagnosticCategory.Error, key: "'const' enum member initializer was evaluated to a non-finite value." },
|
||||
const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 4087, category: DiagnosticCategory.Error, key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." },
|
||||
Property_0_does_not_exist_on_const_enum_1: { code: 4088, category: DiagnosticCategory.Error, key: "Property '{0}' does not exist on 'const' enum '{1}'.", isEarly: true },
|
||||
Property_0_does_not_exist_on_const_enum_1: { code: 4088, category: DiagnosticCategory.Error, key: "Property '{0}' does not exist on 'const' enum '{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}" },
|
||||
@@ -446,8 +450,8 @@ module ts {
|
||||
_0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: DiagnosticCategory.Error, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." },
|
||||
Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: DiagnosticCategory.Error, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." },
|
||||
You_cannot_rename_this_element: { code: 8000, category: DiagnosticCategory.Error, key: "You cannot rename this element." },
|
||||
yield_expressions_are_not_currently_supported: { code: 9000, category: DiagnosticCategory.Error, key: "'yield' expressions are not currently supported.", isEarly: true },
|
||||
Generators_are_not_currently_supported: { code: 9001, category: DiagnosticCategory.Error, key: "Generators are not currently supported.", isEarly: true },
|
||||
Computed_property_names_are_not_currently_supported: { code: 9002, category: DiagnosticCategory.Error, key: "Computed property names are not currently supported.", isEarly: true },
|
||||
yield_expressions_are_not_currently_supported: { code: 9000, category: DiagnosticCategory.Error, key: "'yield' expressions are not currently supported." },
|
||||
Generators_are_not_currently_supported: { code: 9001, category: DiagnosticCategory.Error, key: "Generators are not currently supported." },
|
||||
The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 9002, category: DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." },
|
||||
};
|
||||
}
|
||||
@@ -9,8 +9,7 @@
|
||||
},
|
||||
"'{0}' expected.": {
|
||||
"category": "Error",
|
||||
"code": 1005,
|
||||
"isEarly": true
|
||||
"code": 1005
|
||||
},
|
||||
"A file cannot have a reference to itself.": {
|
||||
"category": "Error",
|
||||
@@ -18,8 +17,7 @@
|
||||
},
|
||||
"Trailing comma not allowed.": {
|
||||
"category": "Error",
|
||||
"code": 1009,
|
||||
"isEarly": true
|
||||
"code": 1009
|
||||
},
|
||||
"'*/' expected.": {
|
||||
"category": "Error",
|
||||
@@ -31,58 +29,47 @@
|
||||
},
|
||||
"Catch clause parameter cannot have a type annotation.": {
|
||||
"category": "Error",
|
||||
"code": 1013,
|
||||
"isEarly": true
|
||||
"code": 1013
|
||||
},
|
||||
"A rest parameter must be last in a parameter list.": {
|
||||
"category": "Error",
|
||||
"code": 1014,
|
||||
"isEarly": true
|
||||
"code": 1014
|
||||
},
|
||||
"Parameter cannot have question mark and initializer.": {
|
||||
"category": "Error",
|
||||
"code": 1015,
|
||||
"isEarly": true
|
||||
"code": 1015
|
||||
},
|
||||
"A required parameter cannot follow an optional parameter.": {
|
||||
"category": "Error",
|
||||
"code": 1016,
|
||||
"isEarly": true
|
||||
"code": 1016
|
||||
},
|
||||
"An index signature cannot have a rest parameter.": {
|
||||
"category": "Error",
|
||||
"code": 1017,
|
||||
"isEarly": true
|
||||
"code": 1017
|
||||
},
|
||||
"An index signature parameter cannot have an accessibility modifier.": {
|
||||
"category": "Error",
|
||||
"code": 1018,
|
||||
"isEarly": true
|
||||
"code": 1018
|
||||
},
|
||||
"An index signature parameter cannot have a question mark.": {
|
||||
"category": "Error",
|
||||
"code": 1019,
|
||||
"isEarly": true
|
||||
"code": 1019
|
||||
},
|
||||
"An index signature parameter cannot have an initializer.": {
|
||||
"category": "Error",
|
||||
"code": 1020,
|
||||
"isEarly": true
|
||||
"code": 1020
|
||||
},
|
||||
"An index signature must have a type annotation.": {
|
||||
"category": "Error",
|
||||
"code": 1021,
|
||||
"isEarly": true
|
||||
"code": 1021
|
||||
},
|
||||
"An index signature parameter must have a type annotation.": {
|
||||
"category": "Error",
|
||||
"code": 1022,
|
||||
"isEarly": true
|
||||
"code": 1022
|
||||
},
|
||||
"An index signature parameter type must be 'string' or 'number'.": {
|
||||
"category": "Error",
|
||||
"code": 1023,
|
||||
"isEarly": true
|
||||
"code": 1023
|
||||
},
|
||||
"A class or interface declaration can only have one 'extends' clause.": {
|
||||
"category": "Error",
|
||||
@@ -102,23 +89,19 @@
|
||||
},
|
||||
"Accessibility modifier already seen.": {
|
||||
"category": "Error",
|
||||
"code": 1028,
|
||||
"isEarly": true
|
||||
"code": 1028
|
||||
},
|
||||
"'{0}' modifier must precede '{1}' modifier.": {
|
||||
"category": "Error",
|
||||
"code": 1029,
|
||||
"isEarly": true
|
||||
"code": 1029
|
||||
},
|
||||
"'{0}' modifier already seen.": {
|
||||
"category": "Error",
|
||||
"code": 1030,
|
||||
"isEarly": true
|
||||
"code": 1030
|
||||
},
|
||||
"'{0}' modifier cannot appear on a class element.": {
|
||||
"category": "Error",
|
||||
"code": 1031,
|
||||
"isEarly": true
|
||||
"code": 1031
|
||||
},
|
||||
"An interface declaration cannot have an 'implements' clause.": {
|
||||
"category": "Error",
|
||||
@@ -130,33 +113,27 @@
|
||||
},
|
||||
"Only ambient modules can use quoted names.": {
|
||||
"category": "Error",
|
||||
"code": 1035,
|
||||
"isEarly": true
|
||||
"code": 1035
|
||||
},
|
||||
"Statements are not allowed in ambient contexts.": {
|
||||
"category": "Error",
|
||||
"code": 1036,
|
||||
"isEarly": true
|
||||
"code": 1036
|
||||
},
|
||||
"A 'declare' modifier cannot be used in an already ambient context.": {
|
||||
"category": "Error",
|
||||
"code": 1038,
|
||||
"isEarly": true
|
||||
"code": 1038
|
||||
},
|
||||
"Initializers are not allowed in ambient contexts.": {
|
||||
"category": "Error",
|
||||
"code": 1039,
|
||||
"isEarly": true
|
||||
"code": 1039
|
||||
},
|
||||
"'{0}' modifier cannot appear on a module element.": {
|
||||
"category": "Error",
|
||||
"code": 1044,
|
||||
"isEarly": true
|
||||
"code": 1044
|
||||
},
|
||||
"A 'declare' modifier cannot be used with an interface declaration.": {
|
||||
"category": "Error",
|
||||
"code": 1045,
|
||||
"isEarly": true
|
||||
"code": 1045
|
||||
},
|
||||
"A 'declare' modifier is required for a top level declaration in a .d.ts file.": {
|
||||
"category": "Error",
|
||||
@@ -164,58 +141,47 @@
|
||||
},
|
||||
"A rest parameter cannot be optional.": {
|
||||
"category": "Error",
|
||||
"code": 1047,
|
||||
"isEarly": true
|
||||
"code": 1047
|
||||
},
|
||||
"A rest parameter cannot have an initializer.": {
|
||||
"category": "Error",
|
||||
"code": 1048,
|
||||
"isEarly": true
|
||||
"code": 1048
|
||||
},
|
||||
"A 'set' accessor must have exactly one parameter.": {
|
||||
"category": "Error",
|
||||
"code": 1049,
|
||||
"isEarly": true
|
||||
"code": 1049
|
||||
},
|
||||
"A 'set' accessor cannot have an optional parameter.": {
|
||||
"category": "Error",
|
||||
"code": 1051,
|
||||
"isEarly": true
|
||||
"code": 1051
|
||||
},
|
||||
"A 'set' accessor parameter cannot have an initializer.": {
|
||||
"category": "Error",
|
||||
"code": 1052,
|
||||
"isEarly": true
|
||||
"code": 1052
|
||||
},
|
||||
"A 'set' accessor cannot have rest parameter.": {
|
||||
"category": "Error",
|
||||
"code": 1053,
|
||||
"isEarly": true
|
||||
"code": 1053
|
||||
},
|
||||
"A 'get' accessor cannot have parameters.": {
|
||||
"category": "Error",
|
||||
"code": 1054,
|
||||
"isEarly": true
|
||||
"code": 1054
|
||||
},
|
||||
"Accessors are only available when targeting ECMAScript 5 and higher.": {
|
||||
"category": "Error",
|
||||
"code": 1056,
|
||||
"isEarly": true
|
||||
"code": 1056
|
||||
},
|
||||
"Enum member must have initializer.": {
|
||||
"category": "Error",
|
||||
"code": 1061,
|
||||
"isEarly": true
|
||||
"code": 1061
|
||||
},
|
||||
"An export assignment cannot be used in an internal module.": {
|
||||
"category": "Error",
|
||||
"code": 1063,
|
||||
"isEarly": true
|
||||
"code": 1063
|
||||
},
|
||||
"Ambient enum elements can only have integer literal initializers.": {
|
||||
"category": "Error",
|
||||
"code": 1066,
|
||||
"isEarly": true
|
||||
"code": 1066
|
||||
},
|
||||
"Unexpected token. A constructor, method, accessor, or property was expected.": {
|
||||
"category": "Error",
|
||||
@@ -223,8 +189,7 @@
|
||||
},
|
||||
"A 'declare' modifier cannot be used with an import declaration.": {
|
||||
"category": "Error",
|
||||
"code": 1079,
|
||||
"isEarly": true
|
||||
"code": 1079
|
||||
},
|
||||
"Invalid 'reference' directive syntax.": {
|
||||
"category": "Error",
|
||||
@@ -232,173 +197,139 @@
|
||||
},
|
||||
"Octal literals are not available when targeting ECMAScript 5 and higher.": {
|
||||
"category": "Error",
|
||||
"code": 1085,
|
||||
"isEarly": true
|
||||
"code": 1085
|
||||
},
|
||||
"An accessor cannot be declared in an ambient context.": {
|
||||
"category": "Error",
|
||||
"code": 1086,
|
||||
"isEarly": true
|
||||
"code": 1086
|
||||
},
|
||||
"'{0}' modifier cannot appear on a constructor declaration.": {
|
||||
"category": "Error",
|
||||
"code": 1089,
|
||||
"isEarly": true
|
||||
"code": 1089
|
||||
},
|
||||
"'{0}' modifier cannot appear on a parameter.": {
|
||||
"category": "Error",
|
||||
"code": 1090,
|
||||
"isEarly": true
|
||||
"code": 1090
|
||||
},
|
||||
"Only a single variable declaration is allowed in a 'for...in' statement.": {
|
||||
"category": "Error",
|
||||
"code": 1091,
|
||||
"isEarly": true
|
||||
"code": 1091
|
||||
},
|
||||
"Type parameters cannot appear on a constructor declaration.": {
|
||||
"category": "Error",
|
||||
"code": 1092,
|
||||
"isEarly": true
|
||||
"code": 1092
|
||||
},
|
||||
"Type annotation cannot appear on a constructor declaration.": {
|
||||
"category": "Error",
|
||||
"code": 1093,
|
||||
"isEarly": true
|
||||
"code": 1093
|
||||
},
|
||||
"An accessor cannot have type parameters.": {
|
||||
"category": "Error",
|
||||
"code": 1094,
|
||||
"isEarly": true
|
||||
"code": 1094
|
||||
},
|
||||
"A 'set' accessor cannot have a return type annotation.": {
|
||||
"category": "Error",
|
||||
"code": 1095,
|
||||
"isEarly": true
|
||||
"code": 1095
|
||||
},
|
||||
"An index signature must have exactly one parameter.": {
|
||||
"category": "Error",
|
||||
"code": 1096,
|
||||
"isEarly": true
|
||||
"code": 1096
|
||||
},
|
||||
"'{0}' list cannot be empty.": {
|
||||
"category": "Error",
|
||||
"code": 1097,
|
||||
"isEarly": true
|
||||
"code": 1097
|
||||
},
|
||||
"Type parameter list cannot be empty.": {
|
||||
"category": "Error",
|
||||
"code": 1098,
|
||||
"isEarly": true
|
||||
"code": 1098
|
||||
},
|
||||
"Type argument list cannot be empty.": {
|
||||
"category": "Error",
|
||||
"code": 1099,
|
||||
"isEarly": true
|
||||
"code": 1099
|
||||
},
|
||||
"Invalid use of '{0}' in strict mode.": {
|
||||
"category": "Error",
|
||||
"code": 1100,
|
||||
"isEarly": true
|
||||
"code": 1100
|
||||
},
|
||||
"'with' statements are not allowed in strict mode.": {
|
||||
"category": "Error",
|
||||
"code": 1101,
|
||||
"isEarly": true
|
||||
"code": 1101
|
||||
},
|
||||
"'delete' cannot be called on an identifier in strict mode.": {
|
||||
"category": "Error",
|
||||
"code": 1102,
|
||||
"isEarly": true
|
||||
"code": 1102
|
||||
},
|
||||
"A 'continue' statement can only be used within an enclosing iteration statement.": {
|
||||
"category": "Error",
|
||||
"code": 1104,
|
||||
"isEarly": true
|
||||
"code": 1104
|
||||
},
|
||||
"A 'break' statement can only be used within an enclosing iteration or switch statement.": {
|
||||
"category": "Error",
|
||||
"code": 1105,
|
||||
"isEarly": true
|
||||
"code": 1105
|
||||
},
|
||||
"Jump target cannot cross function boundary.": {
|
||||
"category": "Error",
|
||||
"code": 1107,
|
||||
"isEarly": true
|
||||
"code": 1107
|
||||
},
|
||||
"A 'return' statement can only be used within a function body.": {
|
||||
"category": "Error",
|
||||
"code": 1108,
|
||||
"isEarly": true
|
||||
"code": 1108
|
||||
},
|
||||
"Expression expected.": {
|
||||
"category": "Error",
|
||||
"code": 1109,
|
||||
"isEarly": true
|
||||
"code": 1109
|
||||
},
|
||||
"Type expected.": {
|
||||
"category": "Error",
|
||||
"code": 1110,
|
||||
"isEarly": true
|
||||
"code": 1110
|
||||
},
|
||||
"A class member cannot be declared optional.": {
|
||||
"category": "Error",
|
||||
"code": 1112,
|
||||
"isEarly": true
|
||||
"code": 1112
|
||||
},
|
||||
"A 'default' clause cannot appear more than once in a 'switch' statement.": {
|
||||
"category": "Error",
|
||||
"code": 1113,
|
||||
"isEarly": true
|
||||
"code": 1113
|
||||
},
|
||||
"Duplicate label '{0}'": {
|
||||
"category": "Error",
|
||||
"code": 1114,
|
||||
"isEarly": true
|
||||
"code": 1114
|
||||
},
|
||||
"A 'continue' statement can only jump to a label of an enclosing iteration statement.": {
|
||||
"category": "Error",
|
||||
"code": 1115,
|
||||
"isEarly": true
|
||||
"code": 1115
|
||||
},
|
||||
"A 'break' statement can only jump to a label of an enclosing statement.": {
|
||||
"category": "Error",
|
||||
"code": 1116,
|
||||
"isEarly": true
|
||||
"code": 1116
|
||||
},
|
||||
"An object literal cannot have multiple properties with the same name in strict mode.": {
|
||||
"category": "Error",
|
||||
"code": 1117,
|
||||
"isEarly": true
|
||||
"code": 1117
|
||||
},
|
||||
"An object literal cannot have multiple get/set accessors with the same name.": {
|
||||
"category": "Error",
|
||||
"code": 1118,
|
||||
"isEarly": true
|
||||
"code": 1118
|
||||
},
|
||||
"An object literal cannot have property and accessor with the same name.": {
|
||||
"category": "Error",
|
||||
"code": 1119,
|
||||
"isEarly": true
|
||||
"code": 1119
|
||||
},
|
||||
"An export assignment cannot have modifiers.": {
|
||||
"category": "Error",
|
||||
"code": 1120,
|
||||
"isEarly": true
|
||||
"code": 1120
|
||||
},
|
||||
"Octal literals are not allowed in strict mode.": {
|
||||
"category": "Error",
|
||||
"code": 1121,
|
||||
"isEarly": true
|
||||
"code": 1121
|
||||
},
|
||||
"A tuple type element list cannot be empty.": {
|
||||
"category": "Error",
|
||||
"code": 1122,
|
||||
"isEarly": true
|
||||
"code": 1122
|
||||
},
|
||||
"Variable declaration list cannot be empty.": {
|
||||
"category": "Error",
|
||||
"code": 1123,
|
||||
"isEarly": true
|
||||
"code": 1123
|
||||
},
|
||||
"Digit expected.": {
|
||||
"category": "Error",
|
||||
@@ -446,8 +377,7 @@
|
||||
},
|
||||
"Argument expression expected.": {
|
||||
"category": "Error",
|
||||
"code": 1135,
|
||||
"isEarly": true
|
||||
"code": 1135
|
||||
},
|
||||
"Property assignment expected.": {
|
||||
"category": "Error",
|
||||
@@ -471,13 +401,11 @@
|
||||
},
|
||||
"String literal expected.": {
|
||||
"category": "Error",
|
||||
"code": 1141,
|
||||
"isEarly": true
|
||||
"code": 1141
|
||||
},
|
||||
"Line break not permitted here.": {
|
||||
"category": "Error",
|
||||
"code": 1142,
|
||||
"isEarly": true
|
||||
"code": 1142
|
||||
},
|
||||
"'{' or ';' expected.": {
|
||||
"category": "Error",
|
||||
@@ -485,8 +413,7 @@
|
||||
},
|
||||
"Modifiers not permitted on index signature members.": {
|
||||
"category": "Error",
|
||||
"code": 1145,
|
||||
"isEarly": true
|
||||
"code": 1145
|
||||
},
|
||||
"Declaration expected.": {
|
||||
"category": "Error",
|
||||
@@ -494,8 +421,7 @@
|
||||
},
|
||||
"Import declarations in an internal module cannot reference an external module.": {
|
||||
"category": "Error",
|
||||
"code": 1147,
|
||||
"isEarly": true
|
||||
"code": 1147
|
||||
},
|
||||
"Cannot compile external modules unless the '--module' flag is provided.": {
|
||||
"category": "Error",
|
||||
@@ -507,8 +433,7 @@
|
||||
},
|
||||
"'new T[]' cannot be used to create an array. Use 'new Array<T>()' instead.": {
|
||||
"category": "Error",
|
||||
"code": 1150,
|
||||
"isEarly": true
|
||||
"code": 1150
|
||||
},
|
||||
"'var', 'let' or 'const' expected.": {
|
||||
"category": "Error",
|
||||
@@ -516,33 +441,27 @@
|
||||
},
|
||||
"'let' declarations are only available when targeting ECMAScript 6 and higher.": {
|
||||
"category": "Error",
|
||||
"code": 1153,
|
||||
"isEarly": true
|
||||
"code": 1153
|
||||
},
|
||||
"'const' declarations are only available when targeting ECMAScript 6 and higher.": {
|
||||
"category": "Error",
|
||||
"code": 1154,
|
||||
"isEarly": true
|
||||
"code": 1154
|
||||
},
|
||||
"'const' declarations must be initialized": {
|
||||
"category": "Error",
|
||||
"code": 1155,
|
||||
"isEarly": true
|
||||
"code": 1155
|
||||
},
|
||||
"'const' declarations can only be declared inside a block.": {
|
||||
"category": "Error",
|
||||
"code": 1156,
|
||||
"isEarly": true
|
||||
"code": 1156
|
||||
},
|
||||
"'let' declarations can only be declared inside a block.": {
|
||||
"category": "Error",
|
||||
"code": 1157,
|
||||
"isEarly": true
|
||||
"code": 1157
|
||||
},
|
||||
"Tagged templates are only available when targeting ECMAScript 6 and higher.": {
|
||||
"category": "Error",
|
||||
"code": 1159,
|
||||
"isEarly": true
|
||||
"code": 1159
|
||||
},
|
||||
"Unterminated template literal.": {
|
||||
"category": "Error",
|
||||
@@ -554,48 +473,39 @@
|
||||
},
|
||||
"An object member cannot be declared optional.": {
|
||||
"category": "Error",
|
||||
"code": 1162,
|
||||
"isEarly": true
|
||||
"code": 1162
|
||||
},
|
||||
"'yield' expression must be contained_within a generator declaration.": {
|
||||
"category": "Error",
|
||||
"code": 1163,
|
||||
"isEarly": true
|
||||
"code": 1163
|
||||
},
|
||||
"Computed property names are not allowed in enums.": {
|
||||
"category": "Error",
|
||||
"code": 1164,
|
||||
"isEarly": true
|
||||
"code": 1164
|
||||
},
|
||||
"Computed property names are not allowed in an ambient context.": {
|
||||
"category": "Error",
|
||||
"code": 1165,
|
||||
"isEarly": true
|
||||
"code": 1165
|
||||
},
|
||||
"Computed property names are not allowed in class property declarations.": {
|
||||
"category": "Error",
|
||||
"code": 1166,
|
||||
"isEarly": true
|
||||
"code": 1166
|
||||
},
|
||||
"Computed property names are only available when targeting ECMAScript 6 and higher.": {
|
||||
"category": "Error",
|
||||
"code": 1167,
|
||||
"isEarly": true
|
||||
"code": 1167
|
||||
},
|
||||
"Computed property names are not allowed in method overloads.": {
|
||||
"category": "Error",
|
||||
"code": 1168,
|
||||
"isEarly": true
|
||||
"code": 1168
|
||||
},
|
||||
"Computed property names are not allowed in interfaces.": {
|
||||
"category": "Error",
|
||||
"code": 1169,
|
||||
"isEarly": true
|
||||
"code": 1169
|
||||
},
|
||||
"Computed property names are not allowed in type literals.": {
|
||||
"category": "Error",
|
||||
"code": 1170,
|
||||
"isEarly": true
|
||||
"code": 1170
|
||||
},
|
||||
"A comma expression is not allowed in a computed property name.": {
|
||||
"category": "Error",
|
||||
@@ -603,28 +513,23 @@
|
||||
},
|
||||
"'extends' clause already seen.": {
|
||||
"category": "Error",
|
||||
"code": 1172,
|
||||
"isEarly": true
|
||||
"code": 1172
|
||||
},
|
||||
"'extends' clause must precede 'implements' clause.": {
|
||||
"category": "Error",
|
||||
"code": 1173,
|
||||
"isEarly": true
|
||||
"code": 1173
|
||||
},
|
||||
"Classes can only extend a single class.": {
|
||||
"category": "Error",
|
||||
"code": 1174,
|
||||
"isEarly": true
|
||||
"code": 1174
|
||||
},
|
||||
"'implements' clause already seen.": {
|
||||
"category": "Error",
|
||||
"code": 1175,
|
||||
"isEarly": true
|
||||
"code": 1175
|
||||
},
|
||||
"Interface declaration cannot have 'implements' clause.": {
|
||||
"category": "Error",
|
||||
"code": 1176,
|
||||
"isEarly": true
|
||||
"code": 1176
|
||||
},
|
||||
"Binary digit expected.": {
|
||||
"category": "Error",
|
||||
@@ -648,18 +553,15 @@
|
||||
},
|
||||
"A destructuring declaration must have an initializer.": {
|
||||
"category": "Error",
|
||||
"code": 1182,
|
||||
"isEarly": true
|
||||
"code": 1182
|
||||
},
|
||||
"Destructuring declarations are not allowed in ambient contexts.": {
|
||||
"category": "Error",
|
||||
"code": 1183,
|
||||
"isEarly": true
|
||||
"code": 1183
|
||||
},
|
||||
"An implementation cannot be declared in ambient contexts.": {
|
||||
"category": "Error",
|
||||
"code": 1184,
|
||||
"isEarly": true
|
||||
"code": 1184
|
||||
},
|
||||
"Modifiers cannot appear here.": {
|
||||
"category": "Error",
|
||||
@@ -675,7 +577,7 @@
|
||||
},
|
||||
"A parameter property may not be a binding pattern.": {
|
||||
"category": "Error",
|
||||
"code": 1187
|
||||
"code": 1187
|
||||
},
|
||||
|
||||
"Duplicate identifier '{0}'.": {
|
||||
@@ -1228,23 +1130,19 @@
|
||||
},
|
||||
"Block-scoped variable '{0}' used before its declaration.": {
|
||||
"category": "Error",
|
||||
"code": 2448,
|
||||
"isEarly": true
|
||||
"code": 2448
|
||||
},
|
||||
"The operand of an increment or decrement operator cannot be a constant.": {
|
||||
"category": "Error",
|
||||
"code": 2449,
|
||||
"isEarly": true
|
||||
"code": 2449
|
||||
},
|
||||
"Left-hand side of assignment expression cannot be a constant.": {
|
||||
"category": "Error",
|
||||
"code": 2450,
|
||||
"isEarly": true
|
||||
"code": 2450
|
||||
},
|
||||
"Cannot redeclare block-scoped variable '{0}'.": {
|
||||
"category": "Error",
|
||||
"code": 2451,
|
||||
"isEarly": true
|
||||
"code": 2451
|
||||
},
|
||||
"An enum member cannot have a numeric name.": {
|
||||
"category": "Error",
|
||||
@@ -1288,7 +1186,23 @@
|
||||
},
|
||||
"A binding pattern parameter cannot be optional in an implementation signature.": {
|
||||
"category": "Error",
|
||||
"code": 2463
|
||||
"code": 2463
|
||||
},
|
||||
"A computed property name must be of type 'string', 'number', or 'any'.": {
|
||||
"category": "Error",
|
||||
"code": 2464
|
||||
},
|
||||
"'this' cannot be referenced in a computed property name.": {
|
||||
"category": "Error",
|
||||
"code": 2465
|
||||
},
|
||||
"'super' cannot be referenced in a computed property name.": {
|
||||
"category": "Error",
|
||||
"code": 2466
|
||||
},
|
||||
"A computed property name cannot reference a type parameter from its containing type.": {
|
||||
"category": "Error",
|
||||
"code": 2466
|
||||
},
|
||||
|
||||
"Import declaration '{0}' is using private name '{1}'.": {
|
||||
@@ -1573,8 +1487,7 @@
|
||||
},
|
||||
"In 'const' enum declarations member initializer must be constant expression.": {
|
||||
"category": "Error",
|
||||
"code": 4083,
|
||||
"isEarly": true
|
||||
"code": 4083
|
||||
},
|
||||
"'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.": {
|
||||
"category": "Error",
|
||||
@@ -1582,8 +1495,7 @@
|
||||
},
|
||||
"A const enum member can only be accessed using a string literal.": {
|
||||
"category": "Error",
|
||||
"code": 4085,
|
||||
"isEarly": true
|
||||
"code": 4085
|
||||
},
|
||||
"'const' enum member initializer was evaluated to a non-finite value.": {
|
||||
"category": "Error",
|
||||
@@ -1595,8 +1507,7 @@
|
||||
},
|
||||
"Property '{0}' does not exist on 'const' enum '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 4088,
|
||||
"isEarly": true
|
||||
"code": 4088
|
||||
},
|
||||
"The current host does not support the '{0}' option.": {
|
||||
"category": "Error",
|
||||
@@ -1885,17 +1796,14 @@
|
||||
},
|
||||
"'yield' expressions are not currently supported.": {
|
||||
"category": "Error",
|
||||
"code": 9000,
|
||||
"isEarly": true
|
||||
"code": 9000
|
||||
},
|
||||
"Generators are not currently supported.": {
|
||||
"category": "Error",
|
||||
"code": 9001,
|
||||
"isEarly": true
|
||||
"code": 9001
|
||||
},
|
||||
"Computed property names are not currently supported.": {
|
||||
"The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression.": {
|
||||
"category": "Error",
|
||||
"code": 9002,
|
||||
"isEarly": true
|
||||
"code": 9002
|
||||
}
|
||||
}
|
||||
|
||||
+232
-136
@@ -932,6 +932,10 @@ module ts {
|
||||
}
|
||||
|
||||
function emitPropertyDeclaration(node: Declaration) {
|
||||
if (hasDynamicName(node)) {
|
||||
return;
|
||||
}
|
||||
|
||||
emitJsDocComments(node);
|
||||
emitClassMemberDeclarationFlags(node);
|
||||
emitVariableDeclaration(<VariableDeclaration>node);
|
||||
@@ -939,11 +943,13 @@ module ts {
|
||||
writeLine();
|
||||
}
|
||||
|
||||
// TODO(jfreeman): Factor out common part of property definition, but treat name differently
|
||||
function emitVariableDeclaration(node: VariableDeclaration) {
|
||||
// If we are emitting property it isn't moduleElement and hence we already know it needs to be emitted
|
||||
// so there is no check needed to see if declaration is visible
|
||||
if (node.kind !== SyntaxKind.VariableDeclaration || resolver.isDeclarationVisible(node)) {
|
||||
// If this node is a computed name, it can only be a symbol, because we've already skipped
|
||||
// it if it's not a well known symbol. In that case, the text of the name will be exactly
|
||||
// what we want, namely the name expression enclosed in brackets.
|
||||
writeTextOfNode(currentSourceFile, node.name);
|
||||
// If optional property emit ?
|
||||
if ((node.kind === SyntaxKind.PropertyDeclaration || node.kind === SyntaxKind.PropertySignature) && hasQuestionToken(node)) {
|
||||
@@ -1030,6 +1036,10 @@ module ts {
|
||||
}
|
||||
|
||||
function emitAccessorDeclaration(node: AccessorDeclaration) {
|
||||
if (hasDynamicName(node)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var accessors = getAllAccessorDeclarations(<ClassDeclaration>node.parent, node);
|
||||
if (node === accessors.firstAccessor) {
|
||||
emitJsDocComments(accessors.getAccessor);
|
||||
@@ -1107,6 +1117,10 @@ module ts {
|
||||
}
|
||||
|
||||
function emitFunctionDeclaration(node: FunctionLikeDeclaration) {
|
||||
if (hasDynamicName(node)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If we are emitting Method/Constructor it isn't moduleElement and hence already determined to be emitting
|
||||
// so no need to verify if the declaration is visible
|
||||
if ((node.kind !== SyntaxKind.FunctionDeclaration || resolver.isDeclarationVisible(node)) &&
|
||||
@@ -1473,7 +1487,6 @@ module ts {
|
||||
|
||||
// targetSourceFile is when users only want one file in entire project to be emitted. This is used in compilerOnSave feature
|
||||
export function emitFiles(resolver: EmitResolver, host: EmitHost, targetSourceFile?: SourceFile): EmitResult {
|
||||
// var program = resolver.getProgram();
|
||||
var compilerOptions = host.getCompilerOptions();
|
||||
var languageVersion = compilerOptions.target || ScriptTarget.ES3;
|
||||
var sourceMapDataList: SourceMapData[] = compilerOptions.sourceMap ? [] : undefined;
|
||||
@@ -1723,7 +1736,14 @@ module ts {
|
||||
if (scopeName) {
|
||||
var parentIndex = getSourceMapNameIndex();
|
||||
if (parentIndex !== -1) {
|
||||
scopeName = sourceMapData.sourceMapNames[parentIndex] + "." + scopeName;
|
||||
// Child scopes are always shown with a dot (even if they have no name),
|
||||
// unless it is a computed property. Then it is shown with brackets,
|
||||
// but the brackets are included in the name.
|
||||
var name = (<Declaration>node).name;
|
||||
if (!name || name.kind !== SyntaxKind.ComputedPropertyName) {
|
||||
scopeName = "." + scopeName;
|
||||
}
|
||||
scopeName = sourceMapData.sourceMapNames[parentIndex] + scopeName;
|
||||
}
|
||||
|
||||
scopeNameIndex = getProperty(sourceMapNameIndexMap, scopeName);
|
||||
@@ -1751,8 +1771,11 @@ module ts {
|
||||
node.kind === SyntaxKind.EnumDeclaration) {
|
||||
// Declaration and has associated name use it
|
||||
if ((<Declaration>node).name) {
|
||||
// TODO(jfreeman): Ask shkamat about what this name should be for source maps
|
||||
scopeName = (<Identifier>(<Declaration>node).name).text;
|
||||
var name = (<Declaration>node).name;
|
||||
// For computed property names, the text will include the brackets
|
||||
scopeName = name.kind === SyntaxKind.ComputedPropertyName
|
||||
? getTextOfNode(name)
|
||||
: (<Identifier>(<Declaration>node).name).text;
|
||||
}
|
||||
recordScopeNameStart(scopeName);
|
||||
}
|
||||
@@ -2051,8 +2074,6 @@ module ts {
|
||||
return;
|
||||
}
|
||||
|
||||
Debug.assert(node.parent.kind !== SyntaxKind.TaggedTemplateExpression);
|
||||
|
||||
var emitOuterParens = isExpression(node.parent)
|
||||
&& templateNeedsParens(node, <Expression>node.parent);
|
||||
|
||||
@@ -2130,10 +2151,9 @@ module ts {
|
||||
case SyntaxKind.CallExpression:
|
||||
case SyntaxKind.NewExpression:
|
||||
return (<CallExpression>parent).expression === template;
|
||||
case SyntaxKind.TaggedTemplateExpression:
|
||||
case SyntaxKind.ParenthesizedExpression:
|
||||
return false;
|
||||
case SyntaxKind.TaggedTemplateExpression:
|
||||
Debug.fail("Path should be unreachable; tagged templates not supported pre-ES6.");
|
||||
default:
|
||||
return comparePrecedenceToBinaryPlus(parent) !== Comparison.LessThan;
|
||||
}
|
||||
@@ -2153,7 +2173,6 @@ module ts {
|
||||
//
|
||||
// TODO (drosen): Note that we need to account for the upcoming 'yield' and
|
||||
// spread ('...') unary operators that are anticipated for ES6.
|
||||
Debug.assert(languageVersion < ScriptTarget.ES6);
|
||||
switch (expression.kind) {
|
||||
case SyntaxKind.BinaryExpression:
|
||||
switch ((<BinaryExpression>expression).operator) {
|
||||
@@ -2403,28 +2422,20 @@ module ts {
|
||||
}
|
||||
|
||||
function emitMethod(node: MethodDeclaration) {
|
||||
if (!isObjectLiteralMethod(node)) {
|
||||
return;
|
||||
}
|
||||
emitLeadingComments(node);
|
||||
emit(node.name);
|
||||
if (languageVersion < ScriptTarget.ES6) {
|
||||
write(": function ");
|
||||
}
|
||||
emitSignatureAndBody(node);
|
||||
emitTrailingComments(node);
|
||||
}
|
||||
|
||||
function emitPropertyAssignment(node: PropertyDeclaration) {
|
||||
emitLeadingComments(node);
|
||||
emit(node.name);
|
||||
write(": ");
|
||||
emit(node.initializer);
|
||||
emitTrailingComments(node);
|
||||
}
|
||||
|
||||
function emitShorthandPropertyAssignment(node: ShorthandPropertyAssignment) {
|
||||
emitLeadingComments(node);
|
||||
emit(node.name);
|
||||
// If short-hand property has a prefix, then regardless of the target version, we will emit it as normal property assignment. For example:
|
||||
// module m {
|
||||
@@ -2441,14 +2452,16 @@ module ts {
|
||||
// Short-hand, { x }, is equivalent of normal form { x: x }
|
||||
emitExpressionIdentifier(node.name);
|
||||
}
|
||||
emitTrailingComments(node);
|
||||
}
|
||||
|
||||
function tryEmitConstantValue(node: PropertyAccessExpression | ElementAccessExpression): boolean {
|
||||
var constantValue = resolver.getConstantValue(node);
|
||||
if (constantValue !== undefined) {
|
||||
var propertyName = node.kind === SyntaxKind.PropertyAccessExpression ? declarationNameToString((<PropertyAccessExpression>node).name) : getTextOfNode((<ElementAccessExpression>node).argumentExpression);
|
||||
write(constantValue.toString() + " /* " + propertyName + " */");
|
||||
write(constantValue.toString());
|
||||
if (!compilerOptions.removeComments) {
|
||||
var propertyName: string = node.kind === SyntaxKind.PropertyAccessExpression ? declarationNameToString((<PropertyAccessExpression>node).name) : getTextOfNode((<ElementAccessExpression>node).argumentExpression);
|
||||
write(" /* " + propertyName + " */");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -2516,7 +2529,6 @@ module ts {
|
||||
}
|
||||
|
||||
function emitTaggedTemplateExpression(node: TaggedTemplateExpression): void {
|
||||
Debug.assert(languageVersion >= ScriptTarget.ES6, "Trying to emit a tagged template in pre-ES6 mode.");
|
||||
emit(node.tag);
|
||||
write(" ");
|
||||
emit(node.template);
|
||||
@@ -2661,14 +2673,11 @@ module ts {
|
||||
}
|
||||
|
||||
function emitExpressionStatement(node: ExpressionStatement) {
|
||||
emitLeadingComments(node);
|
||||
emitParenthesized(node.expression, /*parenthesized*/ node.expression.kind === SyntaxKind.ArrowFunction);
|
||||
write(";");
|
||||
emitTrailingComments(node);
|
||||
}
|
||||
|
||||
function emitIfStatement(node: IfStatement) {
|
||||
emitLeadingComments(node);
|
||||
var endPos = emitToken(SyntaxKind.IfKeyword, node.pos);
|
||||
write(" ");
|
||||
endPos = emitToken(SyntaxKind.OpenParenToken, endPos);
|
||||
@@ -2686,7 +2695,6 @@ module ts {
|
||||
emitEmbeddedStatement(node.elseStatement);
|
||||
}
|
||||
}
|
||||
emitTrailingComments(node);
|
||||
}
|
||||
|
||||
function emitDoStatement(node: DoStatement) {
|
||||
@@ -2774,11 +2782,9 @@ module ts {
|
||||
}
|
||||
|
||||
function emitReturnStatement(node: ReturnStatement) {
|
||||
emitLeadingComments(node);
|
||||
emitToken(SyntaxKind.ReturnKeyword, node.pos);
|
||||
emitOptional(" ", node.expression);
|
||||
write(";");
|
||||
emitTrailingComments(node);
|
||||
}
|
||||
|
||||
function emitWithStatement(node: WhileStatement) {
|
||||
@@ -3102,7 +3108,6 @@ module ts {
|
||||
}
|
||||
|
||||
function emitVariableDeclaration(node: VariableDeclaration) {
|
||||
emitLeadingComments(node);
|
||||
if (isBindingPattern(node.name)) {
|
||||
if (languageVersion < ScriptTarget.ES6) {
|
||||
emitDestructuring(node);
|
||||
@@ -3116,11 +3121,9 @@ module ts {
|
||||
emitModuleMemberName(node);
|
||||
emitOptional(" = ", node.initializer);
|
||||
}
|
||||
emitTrailingComments(node);
|
||||
}
|
||||
|
||||
function emitVariableStatement(node: VariableStatement) {
|
||||
emitLeadingComments(node);
|
||||
if (!(node.flags & NodeFlags.Export)) {
|
||||
if (isLet(node.declarationList)) {
|
||||
write("let ");
|
||||
@@ -3134,11 +3137,9 @@ module ts {
|
||||
}
|
||||
emitCommaList(node.declarationList.declarations);
|
||||
write(";");
|
||||
emitTrailingComments(node);
|
||||
}
|
||||
|
||||
function emitParameter(node: ParameterDeclaration) {
|
||||
emitLeadingComments(node);
|
||||
if (languageVersion < ScriptTarget.ES6) {
|
||||
if (isBindingPattern(node.name)) {
|
||||
var name = createTempVariable(node);
|
||||
@@ -3159,7 +3160,6 @@ module ts {
|
||||
emit(node.name);
|
||||
emitOptional(" = ", node.initializer);
|
||||
}
|
||||
emitTrailingComments(node);
|
||||
}
|
||||
|
||||
function emitDefaultValueAssignments(node: FunctionLikeDeclaration) {
|
||||
@@ -3232,11 +3232,13 @@ module ts {
|
||||
}
|
||||
|
||||
function emitAccessor(node: AccessorDeclaration) {
|
||||
emitLeadingComments(node);
|
||||
write(node.kind === SyntaxKind.GetAccessor ? "get " : "set ");
|
||||
emit(node.name);
|
||||
emitSignatureAndBody(node);
|
||||
emitTrailingComments(node);
|
||||
}
|
||||
|
||||
function shouldEmitAsArrowFunction(node: FunctionLikeDeclaration): boolean {
|
||||
return node.kind === SyntaxKind.ArrowFunction && languageVersion >= ScriptTarget.ES6;
|
||||
}
|
||||
|
||||
function emitFunctionDeclaration(node: FunctionLikeDeclaration) {
|
||||
@@ -3248,7 +3250,13 @@ module ts {
|
||||
// Methods will emit the comments as part of emitting method declaration
|
||||
emitLeadingComments(node);
|
||||
}
|
||||
write("function ");
|
||||
|
||||
// For targeting below es6, emit functions-like declaration including arrow function using function keyword.
|
||||
// When targeting ES6, emit arrow function natively in ES6 by omitting function keyword and using fat arrow instead
|
||||
if (!shouldEmitAsArrowFunction(node)) {
|
||||
write("function ");
|
||||
}
|
||||
|
||||
if (node.kind === SyntaxKind.FunctionDeclaration || (node.kind === SyntaxKind.FunctionExpression && node.name)) {
|
||||
emit(node.name);
|
||||
}
|
||||
@@ -3279,6 +3287,15 @@ module ts {
|
||||
decreaseIndent();
|
||||
}
|
||||
|
||||
function emitSignatureParametersForArrow(node: FunctionLikeDeclaration) {
|
||||
// Check whether the parameter list needs parentheses and preserve no-parenthesis
|
||||
if (node.parameters.length === 1 && node.pos === node.parameters[0].pos) {
|
||||
emit(node.parameters[0]);
|
||||
return;
|
||||
}
|
||||
emitSignatureParameters(node);
|
||||
}
|
||||
|
||||
function emitSignatureAndBody(node: FunctionLikeDeclaration) {
|
||||
var saveTempCount = tempCount;
|
||||
var saveTempVariables = tempVariables;
|
||||
@@ -3286,61 +3303,82 @@ module ts {
|
||||
tempCount = 0;
|
||||
tempVariables = undefined;
|
||||
tempParameters = undefined;
|
||||
emitSignatureParameters(node);
|
||||
write(" {");
|
||||
scopeEmitStart(node);
|
||||
increaseIndent();
|
||||
|
||||
emitDetachedComments(node.body.kind === SyntaxKind.Block ? (<Block>node.body).statements : node.body);
|
||||
|
||||
var startIndex = 0;
|
||||
if (node.body.kind === SyntaxKind.Block) {
|
||||
startIndex = emitDirectivePrologues((<Block>node.body).statements, /*startWithNewLine*/ true);
|
||||
}
|
||||
var outPos = writer.getTextPos();
|
||||
emitCaptureThisForNodeIfNecessary(node);
|
||||
emitDefaultValueAssignments(node);
|
||||
emitRestParameter(node);
|
||||
if (node.body.kind !== SyntaxKind.Block && outPos === writer.getTextPos()) {
|
||||
decreaseIndent();
|
||||
write(" ");
|
||||
emitStart(node.body);
|
||||
write("return ");
|
||||
emitNode(node.body);
|
||||
emitEnd(node.body);
|
||||
write(";");
|
||||
emitTempDeclarations(/*newLine*/ false);
|
||||
write(" ");
|
||||
emitStart(node.body);
|
||||
write("}");
|
||||
emitEnd(node.body);
|
||||
// When targeting ES6, emit arrow function natively in ES6
|
||||
if (shouldEmitAsArrowFunction(node)) {
|
||||
emitSignatureParametersForArrow(node);
|
||||
write(" =>");
|
||||
}
|
||||
else {
|
||||
if (node.body.kind === SyntaxKind.Block) {
|
||||
emitLinesStartingAt((<Block>node.body).statements, startIndex);
|
||||
}
|
||||
else {
|
||||
writeLine();
|
||||
emitLeadingComments(node.body);
|
||||
write("return ");
|
||||
emit(node.body);
|
||||
write(";");
|
||||
emitTrailingComments(node.body);
|
||||
}
|
||||
emitTempDeclarations(/*newLine*/ true);
|
||||
emitSignatureParameters(node);
|
||||
}
|
||||
|
||||
write(" {");
|
||||
scopeEmitStart(node);
|
||||
|
||||
if (!node.body) {
|
||||
writeLine();
|
||||
write("}");
|
||||
}
|
||||
else {
|
||||
increaseIndent();
|
||||
|
||||
emitDetachedComments(node.body.kind === SyntaxKind.Block ? (<Block>node.body).statements : node.body);
|
||||
|
||||
var startIndex = 0;
|
||||
if (node.body.kind === SyntaxKind.Block) {
|
||||
emitLeadingCommentsOfPosition((<Block>node.body).statements.end);
|
||||
decreaseIndent();
|
||||
emitToken(SyntaxKind.CloseBraceToken,(<Block>node.body).statements.end);
|
||||
startIndex = emitDirectivePrologues((<Block>node.body).statements, /*startWithNewLine*/ true);
|
||||
}
|
||||
else {
|
||||
var outPos = writer.getTextPos();
|
||||
|
||||
emitCaptureThisForNodeIfNecessary(node);
|
||||
emitDefaultValueAssignments(node);
|
||||
emitRestParameter(node);
|
||||
if (node.body.kind !== SyntaxKind.Block && outPos === writer.getTextPos()) {
|
||||
decreaseIndent();
|
||||
write(" ");
|
||||
emitStart(node.body);
|
||||
write("return ");
|
||||
|
||||
// Don't emit comments on this body. We'll have already taken care of it above
|
||||
// when we called emitDetachedComments.
|
||||
emitNode(node.body, /*disableComments:*/ true);
|
||||
emitEnd(node.body);
|
||||
write(";");
|
||||
emitTempDeclarations(/*newLine*/ false);
|
||||
write(" ");
|
||||
emitStart(node.body);
|
||||
write("}");
|
||||
emitEnd(node.body);
|
||||
}
|
||||
else {
|
||||
if (node.body.kind === SyntaxKind.Block) {
|
||||
emitLinesStartingAt((<Block>node.body).statements, startIndex);
|
||||
}
|
||||
else {
|
||||
writeLine();
|
||||
emitLeadingComments(node.body);
|
||||
write("return ");
|
||||
emit(node.body, /*disableComments:*/ true);
|
||||
write(";");
|
||||
emitTrailingComments(node.body);
|
||||
}
|
||||
emitTempDeclarations(/*newLine*/ true);
|
||||
writeLine();
|
||||
if (node.body.kind === SyntaxKind.Block) {
|
||||
emitLeadingCommentsOfPosition((<Block>node.body).statements.end);
|
||||
decreaseIndent();
|
||||
emitToken(SyntaxKind.CloseBraceToken, (<Block>node.body).statements.end);
|
||||
}
|
||||
else {
|
||||
decreaseIndent();
|
||||
emitStart(node.body);
|
||||
write("}");
|
||||
emitEnd(node.body);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
scopeEmitEnd();
|
||||
if (node.flags & NodeFlags.Export) {
|
||||
writeLine();
|
||||
@@ -3504,7 +3542,6 @@ module ts {
|
||||
}
|
||||
|
||||
function emitClassDeclaration(node: ClassDeclaration) {
|
||||
emitLeadingComments(node);
|
||||
write("var ");
|
||||
emit(node.name);
|
||||
write(" = (function (");
|
||||
@@ -3554,7 +3591,6 @@ module ts {
|
||||
emitEnd(node);
|
||||
write(";");
|
||||
}
|
||||
emitTrailingComments(node);
|
||||
|
||||
function emitConstructorOfClass() {
|
||||
var saveTempCount = tempCount;
|
||||
@@ -3633,13 +3669,17 @@ module ts {
|
||||
emitPinnedOrTripleSlashComments(node);
|
||||
}
|
||||
|
||||
function shouldEmitEnumDeclaration(node: EnumDeclaration) {
|
||||
var isConstEnum = isConst(node);
|
||||
return !isConstEnum || compilerOptions.preserveConstEnums;
|
||||
}
|
||||
|
||||
function emitEnumDeclaration(node: EnumDeclaration) {
|
||||
// const enums are completely erased during compilation.
|
||||
var isConstEnum = isConst(node);
|
||||
if (isConstEnum && !compilerOptions.preserveConstEnums) {
|
||||
if (!shouldEmitEnumDeclaration(node)) {
|
||||
return;
|
||||
}
|
||||
emitLeadingComments(node);
|
||||
|
||||
if (!(node.flags & NodeFlags.Export)) {
|
||||
emitStart(node);
|
||||
write("var ");
|
||||
@@ -3656,7 +3696,7 @@ module ts {
|
||||
write(") {");
|
||||
increaseIndent();
|
||||
scopeEmitStart(node);
|
||||
emitEnumMemberDeclarations(isConstEnum);
|
||||
emitLines(node.members);
|
||||
decreaseIndent();
|
||||
writeLine();
|
||||
emitToken(SyntaxKind.CloseBraceToken, node.members.end);
|
||||
@@ -3677,31 +3717,38 @@ module ts {
|
||||
emitEnd(node);
|
||||
write(";");
|
||||
}
|
||||
emitTrailingComments(node);
|
||||
}
|
||||
|
||||
function emitEnumMemberDeclarations(isConstEnum: boolean) {
|
||||
forEach(node.members, member => {
|
||||
writeLine();
|
||||
emitLeadingComments(member);
|
||||
emitStart(member);
|
||||
write(resolver.getLocalNameOfContainer(node));
|
||||
write("[");
|
||||
write(resolver.getLocalNameOfContainer(node));
|
||||
write("[");
|
||||
emitExpressionForPropertyName(member.name);
|
||||
write("] = ");
|
||||
if (member.initializer && !isConstEnum) {
|
||||
emit(member.initializer);
|
||||
}
|
||||
else {
|
||||
write(resolver.getEnumMemberValue(member).toString());
|
||||
}
|
||||
write("] = ");
|
||||
emitExpressionForPropertyName(member.name);
|
||||
emitEnd(member);
|
||||
write(";");
|
||||
emitTrailingComments(member);
|
||||
});
|
||||
function emitEnumMember(node: EnumMember) {
|
||||
var enumParent = <EnumDeclaration>node.parent;
|
||||
emitStart(node);
|
||||
write(resolver.getLocalNameOfContainer(enumParent));
|
||||
write("[");
|
||||
write(resolver.getLocalNameOfContainer(enumParent));
|
||||
write("[");
|
||||
emitExpressionForPropertyName(node.name);
|
||||
write("] = ");
|
||||
writeEnumMemberDeclarationValue(node);
|
||||
write("] = ");
|
||||
emitExpressionForPropertyName(node.name);
|
||||
emitEnd(node);
|
||||
write(";");
|
||||
}
|
||||
|
||||
function writeEnumMemberDeclarationValue(member: EnumMember) {
|
||||
if (!member.initializer || isConst(member.parent)) {
|
||||
var value = resolver.getEnumMemberValue(member);
|
||||
if (value !== undefined) {
|
||||
write(value.toString());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (member.initializer) {
|
||||
emit(member.initializer);
|
||||
}
|
||||
else {
|
||||
write("undefined");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3712,14 +3759,18 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function shouldEmitModuleDeclaration(node: ModuleDeclaration) {
|
||||
return isInstantiatedModule(node, compilerOptions.preserveConstEnums);
|
||||
}
|
||||
|
||||
function emitModuleDeclaration(node: ModuleDeclaration) {
|
||||
// Emit only if this module is non-ambient.
|
||||
var shouldEmit = isInstantiatedModule(node, compilerOptions.preserveConstEnums);
|
||||
var shouldEmit = shouldEmitModuleDeclaration(node);
|
||||
|
||||
if (!shouldEmit) {
|
||||
return emitPinnedOrTripleSlashComments(node);
|
||||
}
|
||||
emitLeadingComments(node);
|
||||
|
||||
emitStart(node);
|
||||
write("var ");
|
||||
emit(node.name);
|
||||
@@ -3764,7 +3815,6 @@ module ts {
|
||||
emitModuleMemberName(node);
|
||||
write(" = {}));");
|
||||
emitEnd(node);
|
||||
emitTrailingComments(node);
|
||||
}
|
||||
|
||||
function emitImportDeclaration(node: ImportDeclaration) {
|
||||
@@ -3954,7 +4004,7 @@ module ts {
|
||||
emitLeadingComments(node.endOfFileToken);
|
||||
}
|
||||
|
||||
function emitNode(node: Node): void {
|
||||
function emitNode(node: Node, disableComments?:boolean): void {
|
||||
if (!node) {
|
||||
return;
|
||||
}
|
||||
@@ -3962,6 +4012,46 @@ module ts {
|
||||
if (node.flags & NodeFlags.Ambient) {
|
||||
return emitPinnedOrTripleSlashComments(node);
|
||||
}
|
||||
|
||||
var emitComments = !disableComments && shouldEmitLeadingAndTrailingComments(node);
|
||||
if (emitComments) {
|
||||
emitLeadingComments(node);
|
||||
}
|
||||
|
||||
emitJavaScriptWorker(node);
|
||||
|
||||
if (emitComments) {
|
||||
emitTrailingComments(node);
|
||||
}
|
||||
}
|
||||
|
||||
function shouldEmitLeadingAndTrailingComments(node: Node) {
|
||||
switch (node.kind) {
|
||||
// All of these entities are emitted in a specialized fashion. As such, we allow
|
||||
// the specilized methods for each to handle the comments on the nodes.
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.ImportDeclaration:
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
case SyntaxKind.ExportAssignment:
|
||||
return false;
|
||||
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
// Only emit the leading/trailing comments for a module if we're actually
|
||||
// emitting the module as well.
|
||||
return shouldEmitModuleDeclaration(<ModuleDeclaration>node);
|
||||
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
// Only emit the leading/trailing comments for an enum if we're actually
|
||||
// emitting the module as well.
|
||||
return shouldEmitEnumDeclaration(<EnumDeclaration>node);
|
||||
}
|
||||
|
||||
// Emit comments for everything else.
|
||||
return true;
|
||||
}
|
||||
|
||||
function emitJavaScriptWorker(node: Node) {
|
||||
// Check if the node can be emitted regardless of the ScriptTarget
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.Identifier:
|
||||
@@ -4099,6 +4189,8 @@ module ts {
|
||||
return emitInterfaceDeclaration(<InterfaceDeclaration>node);
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
return emitEnumDeclaration(<EnumDeclaration>node);
|
||||
case SyntaxKind.EnumMember:
|
||||
return emitEnumMember(<EnumMember>node);
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
return emitModuleDeclaration(<ModuleDeclaration>node);
|
||||
case SyntaxKind.ImportDeclaration:
|
||||
@@ -4128,17 +4220,19 @@ module ts {
|
||||
|
||||
function getLeadingCommentsToEmit(node: Node) {
|
||||
// Emit the leading comments only if the parent's pos doesn't match because parent should take care of emitting these comments
|
||||
if (node.parent.kind === SyntaxKind.SourceFile || node.pos !== node.parent.pos) {
|
||||
var leadingComments: CommentRange[];
|
||||
if (hasDetachedComments(node.pos)) {
|
||||
// get comments without detached comments
|
||||
leadingComments = getLeadingCommentsWithoutDetachedComments();
|
||||
if (node.parent) {
|
||||
if (node.parent.kind === SyntaxKind.SourceFile || node.pos !== node.parent.pos) {
|
||||
var leadingComments: CommentRange[];
|
||||
if (hasDetachedComments(node.pos)) {
|
||||
// get comments without detached comments
|
||||
leadingComments = getLeadingCommentsWithoutDetachedComments();
|
||||
}
|
||||
else {
|
||||
// get the leading comments from the node
|
||||
leadingComments = getLeadingCommentRangesOfNode(node, currentSourceFile);
|
||||
}
|
||||
return leadingComments;
|
||||
}
|
||||
else {
|
||||
// get the leading comments from the node
|
||||
leadingComments = getLeadingCommentRangesOfNode(node, currentSourceFile);
|
||||
}
|
||||
return leadingComments;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4151,10 +4245,12 @@ module ts {
|
||||
|
||||
function emitTrailingDeclarationComments(node: Node) {
|
||||
// Emit the trailing comments only if the parent's end doesn't match
|
||||
if (node.parent.kind === SyntaxKind.SourceFile || node.end !== node.parent.end) {
|
||||
var trailingComments = getTrailingCommentRanges(currentSourceFile.text, node.end);
|
||||
// trailing comments are emitted at space/*trailing comment1 */space/*trailing comment*/
|
||||
emitComments(currentSourceFile, writer, trailingComments, /*trailingSeparator*/ false, newLine, writeComment);
|
||||
if (node.parent) {
|
||||
if (node.parent.kind === SyntaxKind.SourceFile || node.end !== node.parent.end) {
|
||||
var trailingComments = getTrailingCommentRanges(currentSourceFile.text, node.end);
|
||||
// trailing comments are emitted at space/*trailing comment1 */space/*trailing comment*/
|
||||
emitComments(currentSourceFile, writer, trailingComments, /*trailingSeparator*/ false, newLine, writeComment);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4279,12 +4375,12 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
var hasSemanticErrors: boolean = false;
|
||||
var isEmitBlocked: boolean = false;
|
||||
var hasSemanticDiagnostics = false;
|
||||
var isEmitBlocked = false;
|
||||
|
||||
if (targetSourceFile === undefined) {
|
||||
// No targetSourceFile is specified (e.g. calling emitter from batch compiler)
|
||||
hasSemanticErrors = resolver.hasSemanticErrors();
|
||||
hasSemanticDiagnostics = resolver.hasSemanticDiagnostics();
|
||||
isEmitBlocked = host.isEmitBlocked();
|
||||
|
||||
forEach(host.getSourceFiles(), sourceFile => {
|
||||
@@ -4302,7 +4398,7 @@ module ts {
|
||||
// targetSourceFile is specified (e.g calling emitter from language service or calling getSemanticDiagnostic from language service)
|
||||
if (shouldEmitToOwnFile(targetSourceFile, compilerOptions)) {
|
||||
// If shouldEmitToOwnFile returns true or targetSourceFile is an external module file, then emit targetSourceFile in its own output file
|
||||
hasSemanticErrors = resolver.hasSemanticErrors(targetSourceFile);
|
||||
hasSemanticDiagnostics = resolver.hasSemanticDiagnostics(targetSourceFile);
|
||||
isEmitBlocked = host.isEmitBlocked(targetSourceFile);
|
||||
|
||||
var jsFilePath = getOwnEmitOutputFilePath(targetSourceFile, host, ".js");
|
||||
@@ -4313,7 +4409,7 @@ module ts {
|
||||
// Emit all, non-external-module file, into one single output file
|
||||
forEach(host.getSourceFiles(), sourceFile => {
|
||||
if (!shouldEmitToOwnFile(sourceFile, compilerOptions)) {
|
||||
hasSemanticErrors = hasSemanticErrors || resolver.hasSemanticErrors(sourceFile);
|
||||
hasSemanticDiagnostics = hasSemanticDiagnostics || resolver.hasSemanticDiagnostics(sourceFile);
|
||||
isEmitBlocked = isEmitBlocked || host.isEmitBlocked(sourceFile);
|
||||
}
|
||||
});
|
||||
@@ -4325,7 +4421,7 @@ module ts {
|
||||
function emitFile(jsFilePath: string, sourceFile?: SourceFile) {
|
||||
if (!isEmitBlocked) {
|
||||
emitJavaScript(jsFilePath, sourceFile);
|
||||
if (!hasSemanticErrors && compilerOptions.declaration) {
|
||||
if (!hasSemanticDiagnostics && compilerOptions.declaration) {
|
||||
writeDeclarationFile(jsFilePath, sourceFile);
|
||||
}
|
||||
}
|
||||
@@ -4344,9 +4440,9 @@ module ts {
|
||||
emitResultStatus = EmitReturnStatus.AllOutputGenerationSkipped;
|
||||
} else if (hasEmitterError) {
|
||||
emitResultStatus = EmitReturnStatus.EmitErrorsEncountered;
|
||||
} else if (hasSemanticErrors && compilerOptions.declaration) {
|
||||
} else if (hasSemanticDiagnostics && compilerOptions.declaration) {
|
||||
emitResultStatus = EmitReturnStatus.DeclarationGenerationSkipped;
|
||||
} else if (hasSemanticErrors && !compilerOptions.declaration) {
|
||||
} else if (hasSemanticDiagnostics && !compilerOptions.declaration) {
|
||||
emitResultStatus = EmitReturnStatus.JSGeneratedWithSemanticErrors;
|
||||
} else {
|
||||
emitResultStatus = EmitReturnStatus.Succeeded;
|
||||
|
||||
@@ -64,7 +64,7 @@ module ts {
|
||||
|
||||
return {
|
||||
getSourceFile,
|
||||
getDefaultLibFilename: options => combinePaths(getDirectoryPath(normalizePath(sys.getExecutingFilePath())), options.target === ScriptTarget.ES6 ? "lib.es6.d.ts" : "lib.d.ts"),
|
||||
getDefaultLibFilename: options => combinePaths(getDirectoryPath(normalizePath(sys.getExecutingFilePath())), getDefaultLibFilename(options)),
|
||||
writeFile,
|
||||
getCurrentDirectory: () => currentDirectory || (currentDirectory = sys.getCurrentDirectory()),
|
||||
useCaseSensitiveFileNames: () => sys.useCaseSensitiveFileNames,
|
||||
@@ -113,14 +113,12 @@ module ts {
|
||||
return emitHost || (emitHost = createEmitHostFromProgram(program));
|
||||
}
|
||||
|
||||
function hasEarlyErrors(sourceFile?: SourceFile): boolean {
|
||||
return forEach(getDiagnosticsProducingTypeChecker().getDiagnostics(sourceFile), d => d.isEarly);
|
||||
}
|
||||
|
||||
function isEmitBlocked(sourceFile?: SourceFile): boolean {
|
||||
return getDiagnostics(sourceFile).length !== 0 ||
|
||||
hasEarlyErrors(sourceFile) ||
|
||||
(options.noEmitOnError && getDiagnosticsProducingTypeChecker().getDiagnostics(sourceFile).length !== 0);
|
||||
if (options.noEmitOnError) {
|
||||
return getDiagnostics(sourceFile).length !== 0 || getDiagnosticsProducingTypeChecker().getDiagnostics(sourceFile).length !== 0;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function getDiagnosticsProducingTypeChecker() {
|
||||
@@ -176,7 +174,7 @@ module ts {
|
||||
}
|
||||
var diagnostic: DiagnosticMessage;
|
||||
if (hasExtension(filename)) {
|
||||
if (!options.allowNonTsExtensions && !fileExtensionIs(filename, ".ts")) {
|
||||
if (!options.allowNonTsExtensions && !fileExtensionIs(host.getCanonicalFileName(filename), ".ts")) {
|
||||
diagnostic = Diagnostics.File_0_must_have_extension_ts_or_d_ts;
|
||||
}
|
||||
else if (!findSourceFile(filename, isDefaultLib, refFile, refPos, refEnd)) {
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
/// <reference path="commandLineParser.ts"/>
|
||||
|
||||
module ts {
|
||||
var version = "1.4.0.0";
|
||||
var version = "1.5.0.0";
|
||||
|
||||
export interface SourceFile {
|
||||
fileWatcher: FileWatcher;
|
||||
|
||||
+30
-24
@@ -330,6 +330,12 @@ module ts {
|
||||
HasAggregatedChildData = 1 << 6
|
||||
}
|
||||
|
||||
export const enum RelationComparisonResult {
|
||||
Succeeded = 1, // Should be truthy
|
||||
Failed = 2,
|
||||
FailedAndReported = 3
|
||||
}
|
||||
|
||||
export interface Node extends TextRange {
|
||||
kind: SyntaxKind;
|
||||
flags: NodeFlags;
|
||||
@@ -1066,6 +1072,7 @@ module ts {
|
||||
WriteOwnNameForAnyLike = 0x00000010, // Write symbol's own name instead of 'any' for any like types (eg. unknown, __resolving__ etc)
|
||||
WriteTypeArgumentsOfSignature = 0x00000020, // Write the type arguments instead of type parameters of the signature
|
||||
InElementType = 0x00000040, // Writing an array or union element type
|
||||
UseFullyQualifiedType = 0x00000080, // Write out the fully qualified type name (eg. Module.Type, instead of Type)
|
||||
}
|
||||
|
||||
export const enum SymbolFormatFlags {
|
||||
@@ -1108,7 +1115,7 @@ module ts {
|
||||
isTopLevelValueImportWithEntityName(node: ImportDeclaration): boolean;
|
||||
getNodeCheckFlags(node: Node): NodeCheckFlags;
|
||||
getEnumMemberValue(node: EnumMember): number;
|
||||
hasSemanticErrors(sourceFile?: SourceFile): boolean;
|
||||
hasSemanticDiagnostics(sourceFile?: SourceFile): boolean;
|
||||
isDeclarationVisible(node: Declaration): boolean;
|
||||
isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
|
||||
writeTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
@@ -1258,29 +1265,33 @@ module ts {
|
||||
}
|
||||
|
||||
export const enum TypeFlags {
|
||||
Any = 0x00000001,
|
||||
String = 0x00000002,
|
||||
Number = 0x00000004,
|
||||
Boolean = 0x00000008,
|
||||
Void = 0x00000010,
|
||||
Undefined = 0x00000020,
|
||||
Null = 0x00000040,
|
||||
Enum = 0x00000080, // Enum type
|
||||
StringLiteral = 0x00000100, // String literal type
|
||||
TypeParameter = 0x00000200, // Type parameter
|
||||
Class = 0x00000400, // Class
|
||||
Interface = 0x00000800, // Interface
|
||||
Reference = 0x00001000, // Generic type reference
|
||||
Tuple = 0x00002000, // Tuple
|
||||
Union = 0x00004000, // Union
|
||||
Anonymous = 0x00008000, // Anonymous
|
||||
FromSignature = 0x00010000, // Created for signature assignment check
|
||||
Unwidened = 0x00020000, // Unwidened type (is or contains Undefined or Null type)
|
||||
Any = 0x00000001,
|
||||
String = 0x00000002,
|
||||
Number = 0x00000004,
|
||||
Boolean = 0x00000008,
|
||||
Void = 0x00000010,
|
||||
Undefined = 0x00000020,
|
||||
Null = 0x00000040,
|
||||
Enum = 0x00000080, // Enum type
|
||||
StringLiteral = 0x00000100, // String literal type
|
||||
TypeParameter = 0x00000200, // Type parameter
|
||||
Class = 0x00000400, // Class
|
||||
Interface = 0x00000800, // Interface
|
||||
Reference = 0x00001000, // Generic type reference
|
||||
Tuple = 0x00002000, // Tuple
|
||||
Union = 0x00004000, // Union
|
||||
Anonymous = 0x00008000, // Anonymous
|
||||
FromSignature = 0x00010000, // Created for signature assignment check
|
||||
ObjectLiteral = 0x00020000, // Originates in an object literal
|
||||
ContainsUndefinedOrNull = 0x00040000, // Type is or contains Undefined or Null type
|
||||
ContainsObjectLiteral = 0x00080000, // Type is or contains object literal type
|
||||
|
||||
Intrinsic = Any | String | Number | Boolean | Void | Undefined | Null,
|
||||
Primitive = String | Number | Boolean | Void | Undefined | Null | StringLiteral | Enum,
|
||||
StringLike = String | StringLiteral,
|
||||
NumberLike = Number | Enum,
|
||||
ObjectType = Class | Interface | Reference | Tuple | Anonymous,
|
||||
RequiresWidening = ContainsUndefinedOrNull | ContainsObjectLiteral
|
||||
}
|
||||
|
||||
// Properties common to all types
|
||||
@@ -1399,7 +1410,6 @@ module ts {
|
||||
key: string;
|
||||
category: DiagnosticCategory;
|
||||
code: number;
|
||||
isEarly?: boolean;
|
||||
}
|
||||
|
||||
// A linked list of formatted diagnostic messages to be used as part of a multiline message.
|
||||
@@ -1420,10 +1430,6 @@ module ts {
|
||||
messageText: string;
|
||||
category: DiagnosticCategory;
|
||||
code: number;
|
||||
/**
|
||||
* Early error - any error (can be produced at parsing\binding\typechecking step) that blocks emit
|
||||
*/
|
||||
isEarly?: boolean;
|
||||
}
|
||||
|
||||
export enum DiagnosticCategory {
|
||||
|
||||
@@ -399,6 +399,21 @@ module ts {
|
||||
return undefined;
|
||||
}
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.ComputedPropertyName:
|
||||
// If the grandparent node is an object literal (as opposed to a class),
|
||||
// then the computed property is not a 'this' container.
|
||||
// A computed property name in a class needs to be a this container
|
||||
// so that we can error on it.
|
||||
if (node.parent.parent.kind === SyntaxKind.ClassDeclaration) {
|
||||
return node;
|
||||
}
|
||||
// If this is a computed property, then the parent should not
|
||||
// make it a this container. The parent might be a property
|
||||
// in an object literal, like a method or accessor. But in order for
|
||||
// such a parent to be a this container, the reference must be in
|
||||
// the *body* of the container.
|
||||
node = node.parent;
|
||||
break;
|
||||
case SyntaxKind.ArrowFunction:
|
||||
if (!includeArrowFunctions) {
|
||||
continue;
|
||||
@@ -421,13 +436,32 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
export function getSuperContainer(node: Node): Node {
|
||||
export function getSuperContainer(node: Node, includeFunctions: boolean): Node {
|
||||
while (true) {
|
||||
node = node.parent;
|
||||
if (!node) {
|
||||
return undefined;
|
||||
}
|
||||
if (!node) return node;
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.ComputedPropertyName:
|
||||
// If the grandparent node is an object literal (as opposed to a class),
|
||||
// then the computed property is not a 'super' container.
|
||||
// A computed property name in a class needs to be a super container
|
||||
// so that we can error on it.
|
||||
if (node.parent.parent.kind === SyntaxKind.ClassDeclaration) {
|
||||
return node;
|
||||
}
|
||||
// If this is a computed property, then the parent should not
|
||||
// make it a super container. The parent might be a property
|
||||
// in an object literal, like a method or accessor. But in order for
|
||||
// such a parent to be a super container, the reference must be in
|
||||
// the *body* of the container.
|
||||
node = node.parent;
|
||||
break;
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
if (!includeFunctions) {
|
||||
continue;
|
||||
}
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
@@ -527,6 +561,8 @@ module ts {
|
||||
return node === (<TypeAssertion>parent).expression;
|
||||
case SyntaxKind.TemplateSpan:
|
||||
return node === (<TemplateSpan>parent).expression;
|
||||
case SyntaxKind.ComputedPropertyName:
|
||||
return node === (<ComputedPropertyName>parent).expression;
|
||||
default:
|
||||
if (isExpression(parent)) {
|
||||
return true;
|
||||
|
||||
@@ -237,9 +237,6 @@ module FourSlash {
|
||||
getLength: () => {
|
||||
return sourceText.length;
|
||||
},
|
||||
getLineStartPositions: () => {
|
||||
return <number[]>[];
|
||||
},
|
||||
getChangeRange: (oldSnapshot: ts.IScriptSnapshot) => {
|
||||
return <ts.TextChangeRange>undefined;
|
||||
}
|
||||
@@ -548,6 +545,18 @@ module FourSlash {
|
||||
}
|
||||
}
|
||||
|
||||
public verifyGetEmitOutputForCurrentFile(expected: string): void {
|
||||
var emit = this.languageService.getEmitOutput(this.activeFile.fileName);
|
||||
if (emit.outputFiles.length !== 1) {
|
||||
throw new Error("Expected exactly one output from emit of " + this.activeFile.fileName);
|
||||
}
|
||||
this.taoInvalidReason = 'verifyGetEmitOutputForCurrentFile impossible';
|
||||
var actual = emit.outputFiles[0].text;
|
||||
if (actual !== expected) {
|
||||
this.raiseError("Expected emit output to be '" + expected + "', but got '" + actual + "'");
|
||||
}
|
||||
}
|
||||
|
||||
public verifyMemberListContains(symbol: string, text?: string, documentation?: string, kind?: string) {
|
||||
this.scenarioActions.push('<ShowCompletionList />');
|
||||
this.scenarioActions.push('<VerifyCompletionContainsItem ItemName="' + symbol + '"/>');
|
||||
@@ -1391,7 +1400,7 @@ module FourSlash {
|
||||
var content = snapshot.getText(0, snapshot.getLength());
|
||||
|
||||
var referenceSourceFile = ts.createLanguageServiceSourceFile(
|
||||
this.activeFile.fileName, createScriptSnapShot(content), ts.ScriptTarget.Latest, /*version:*/ "0", /*isOpen:*/ false, /*setNodeParents:*/ false);
|
||||
this.activeFile.fileName, createScriptSnapShot(content), ts.ScriptTarget.Latest, /*version:*/ "0", /*setNodeParents:*/ false);
|
||||
var referenceSyntaxDiagnostics = ts.getSyntacticDiagnostics(referenceSourceFile);
|
||||
|
||||
Utils.assertDiagnosticsEquals(incrementalSyntaxDiagnostics, referenceSyntaxDiagnostics);
|
||||
|
||||
+14
-5
@@ -107,7 +107,7 @@ module Utils {
|
||||
export function memoize<T extends Function>(f: T): T {
|
||||
var cache: { [idx: string]: any } = {};
|
||||
|
||||
return <any>(() => {
|
||||
return <any>(function () {
|
||||
var key = Array.prototype.join.call(arguments);
|
||||
var cachedResult = cache[key];
|
||||
if (cachedResult) {
|
||||
@@ -308,7 +308,6 @@ module Utils {
|
||||
assert.equal(d1.messageText, d2.messageText, "d1.messageText !== d2.messageText");
|
||||
assert.equal(d1.category, d2.category, "d1.category !== d2.category");
|
||||
assert.equal(d1.code, d2.code, "d1.code !== d2.code");
|
||||
assert.equal(d1.isEarly, d2.isEarly, "d1.isEarly !== d2.isEarly");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -931,6 +930,8 @@ module Harness {
|
||||
settingsCallback(null);
|
||||
}
|
||||
|
||||
var newLine = '\r\n';
|
||||
|
||||
var useCaseSensitiveFileNames = ts.sys.useCaseSensitiveFileNames;
|
||||
this.settings.forEach(setting => {
|
||||
switch (setting.flag.toLowerCase()) {
|
||||
@@ -1009,7 +1010,7 @@ module Harness {
|
||||
|
||||
case 'newline':
|
||||
case 'newlines':
|
||||
ts.sys.newLine = setting.value;
|
||||
newLine = setting.value;
|
||||
break;
|
||||
|
||||
case 'comments':
|
||||
@@ -1051,7 +1052,7 @@ module Harness {
|
||||
break;
|
||||
|
||||
case 'includebuiltfile':
|
||||
inputFiles.push({ unitName: setting.value, content: IO.readFile(libFolder + setting.value) });
|
||||
inputFiles.push({ unitName: setting.value, content: normalizeLineEndings(IO.readFile(libFolder + setting.value), newLine) });
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -1097,7 +1098,7 @@ module Harness {
|
||||
onComplete(result, program);
|
||||
|
||||
// reset what newline means in case the last test changed it
|
||||
ts.sys.newLine = '\r\n';
|
||||
ts.sys.newLine = newLine;
|
||||
return options;
|
||||
}
|
||||
|
||||
@@ -1169,6 +1170,14 @@ module Harness {
|
||||
}
|
||||
}
|
||||
|
||||
function normalizeLineEndings(text: string, lineEnding: string): string {
|
||||
var normalized = text.replace(/\r\n?/g, '\n');
|
||||
if (lineEnding !== '\n') {
|
||||
normalized = normalized.replace(/\n/g, lineEnding);
|
||||
}
|
||||
return normalized;
|
||||
}
|
||||
|
||||
export function getMinimalDiagnostic(err: ts.Diagnostic): HarnessDiagnostic {
|
||||
var errorLineInfo = err.file ? err.file.getLineAndCharacterFromPosition(err.start) : { line: 0, character: 0 };
|
||||
return {
|
||||
|
||||
@@ -7,7 +7,7 @@ module Harness.LanguageService {
|
||||
public editRanges: { length: number; textChangeRange: ts.TextChangeRange; }[] = [];
|
||||
public lineMap: number[] = null;
|
||||
|
||||
constructor(public fileName: string, public content: string, public isOpen = true) {
|
||||
constructor(public fileName: string, public content: string) {
|
||||
this.setContent(content);
|
||||
}
|
||||
|
||||
@@ -72,14 +72,6 @@ module Harness.LanguageService {
|
||||
return this.textSnapshot.length;
|
||||
}
|
||||
|
||||
public getLineStartPositions(): string {
|
||||
if (this.lineMap === null) {
|
||||
this.lineMap = ts.computeLineStarts(this.textSnapshot);
|
||||
}
|
||||
|
||||
return JSON.stringify(this.lineMap);
|
||||
}
|
||||
|
||||
public getChangeRange(oldScript: ts.ScriptSnapshotShim): string {
|
||||
var oldShim = <ScriptSnapshotShim>oldScript;
|
||||
var range = this.scriptInfo.getTextChangeRangeBetweenVersions(oldShim.version, this.version);
|
||||
@@ -109,11 +101,9 @@ module Harness.LanguageService {
|
||||
fileName: string,
|
||||
compilationSettings: ts.CompilerOptions,
|
||||
scriptSnapshot: ts.IScriptSnapshot,
|
||||
version: string,
|
||||
isOpen: boolean): ts.SourceFile {
|
||||
version: string): ts.SourceFile {
|
||||
var sourceFile = ts.createSourceFile(fileName, scriptSnapshot.getText(0, scriptSnapshot.getLength()), compilationSettings.target);
|
||||
sourceFile.version = version;
|
||||
sourceFile.isOpen = isOpen;
|
||||
return sourceFile;
|
||||
}
|
||||
|
||||
@@ -123,10 +113,9 @@ module Harness.LanguageService {
|
||||
compilationSettings: ts.CompilerOptions,
|
||||
scriptSnapshot: ts.IScriptSnapshot,
|
||||
version: string,
|
||||
isOpen: boolean,
|
||||
textChangeRange: ts.TextChangeRange
|
||||
): ts.SourceFile {
|
||||
return ts.updateLanguageServiceSourceFile(document, scriptSnapshot, version, isOpen, textChangeRange);
|
||||
return ts.updateLanguageServiceSourceFile(document, scriptSnapshot, version, textChangeRange);
|
||||
}
|
||||
|
||||
public releaseDocument(fileName: string, compilationSettings: ts.CompilerOptions): void {
|
||||
@@ -159,13 +148,17 @@ module Harness.LanguageService {
|
||||
}
|
||||
|
||||
private getScriptInfo(fileName: string): ScriptInfo {
|
||||
return this.fileNameToScript[fileName];
|
||||
return ts.lookUp(this.fileNameToScript, fileName);
|
||||
}
|
||||
|
||||
public addScript(fileName: string, content: string) {
|
||||
this.fileNameToScript[fileName] = new ScriptInfo(fileName, content);
|
||||
}
|
||||
|
||||
private contains(fileName: string): boolean {
|
||||
return ts.hasProperty(this.fileNameToScript, fileName);
|
||||
}
|
||||
|
||||
public updateScript(fileName: string, content: string) {
|
||||
var script = this.getScriptInfo(fileName);
|
||||
if (script !== null) {
|
||||
@@ -223,20 +216,22 @@ module Harness.LanguageService {
|
||||
|
||||
public getScriptFileNames(): string {
|
||||
var fileNames: string[] = [];
|
||||
ts.forEachKey(this.fileNameToScript, (fileName) => { fileNames.push(fileName); });
|
||||
ts.forEachKey(this.fileNameToScript,(fileName) => { fileNames.push(fileName); });
|
||||
return JSON.stringify(fileNames);
|
||||
}
|
||||
|
||||
public getScriptSnapshot(fileName: string): ts.ScriptSnapshotShim {
|
||||
return new ScriptSnapshotShim(this.getScriptInfo(fileName));
|
||||
if (this.contains(fileName)) {
|
||||
return new ScriptSnapshotShim(this.getScriptInfo(fileName));
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public getScriptVersion(fileName: string): string {
|
||||
return this.getScriptInfo(fileName).version.toString();
|
||||
}
|
||||
|
||||
public getScriptIsOpen(fileName: string): boolean {
|
||||
return this.getScriptInfo(fileName).isOpen;
|
||||
if (this.contains(fileName)) {
|
||||
return this.getScriptInfo(fileName).version.toString();
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public getLocalizedDiagnosticMessages(): string {
|
||||
@@ -272,7 +267,6 @@ module Harness.LanguageService {
|
||||
public parseSourceText(fileName: string, sourceText: ts.IScriptSnapshot): ts.SourceFile {
|
||||
var result = ts.createSourceFile(fileName, sourceText.getText(0, sourceText.getLength()), ts.ScriptTarget.Latest);
|
||||
result.version = "1";
|
||||
result.isOpen = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -138,7 +138,7 @@ module Playback {
|
||||
|
||||
function recordReplay<T extends Function>(original: T, underlying: any) {
|
||||
function createWrapper(record: T, replay: T): T {
|
||||
return <any>(() => {
|
||||
return <any>(function () {
|
||||
if (replayLog !== undefined) {
|
||||
return replay.apply(undefined, arguments);
|
||||
} else if (recordLog !== undefined) {
|
||||
|
||||
@@ -186,7 +186,7 @@ class ProjectRunner extends RunnerBase {
|
||||
function createCompilerHost(): ts.CompilerHost {
|
||||
return {
|
||||
getSourceFile,
|
||||
getDefaultLibFilename: options => options.target === ts.ScriptTarget.ES6 ? "lib.es6.d.ts" : "lib.d.ts",
|
||||
getDefaultLibFilename: options => Harness.Compiler.defaultLibFileName,
|
||||
writeFile,
|
||||
getCurrentDirectory,
|
||||
getCanonicalFileName: Harness.Compiler.getCanonicalFileName,
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
///<reference path='references.ts' />
|
||||
|
||||
module TypeScript {
|
||||
export interface Logger {
|
||||
log(s: string): void;
|
||||
}
|
||||
|
||||
export class NullLogger implements Logger {
|
||||
public log(s: string): void {
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,266 +0,0 @@
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
///<reference path="references.ts" />
|
||||
|
||||
module TypeScript {
|
||||
export interface IOptions {
|
||||
name?: string;
|
||||
flag?: boolean;
|
||||
short?: string;
|
||||
usage?: {
|
||||
locCode: string; // DiagnosticCode
|
||||
args: string[]
|
||||
};
|
||||
set?: (s: string) => void;
|
||||
type?: string; // DiagnosticCode
|
||||
experimental?: boolean;
|
||||
}
|
||||
|
||||
export class OptionsParser {
|
||||
private DEFAULT_SHORT_FLAG = "-";
|
||||
private DEFAULT_LONG_FLAG = "--";
|
||||
|
||||
private printedVersion: boolean = false;
|
||||
|
||||
// Find the option record for the given string. Returns null if not found.
|
||||
private findOption(arg: string) {
|
||||
var upperCaseArg = arg && arg.toUpperCase();
|
||||
|
||||
for (var i = 0; i < this.options.length; i++) {
|
||||
var current = this.options[i];
|
||||
|
||||
if (upperCaseArg === (current.short && current.short.toUpperCase()) ||
|
||||
upperCaseArg === (current.name && current.name.toUpperCase())) {
|
||||
return current;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public unnamed: string[] = [];
|
||||
|
||||
public options: IOptions[] = [];
|
||||
|
||||
constructor(public host: IEnvironment, public version: string) {
|
||||
}
|
||||
|
||||
public printUsage() {
|
||||
this.printVersion();
|
||||
|
||||
var optionsWord = getLocalizedText(DiagnosticCode.options, null);
|
||||
var fileWord = getLocalizedText(DiagnosticCode.file1, null);
|
||||
var tscSyntax = "tsc [" + optionsWord + "] [" + fileWord + " ..]";
|
||||
var syntaxHelp = getLocalizedText(DiagnosticCode.Syntax_0, [tscSyntax]);
|
||||
this.host.standardOut.WriteLine(syntaxHelp);
|
||||
this.host.standardOut.WriteLine("");
|
||||
this.host.standardOut.WriteLine(getLocalizedText(DiagnosticCode.Examples, null) + " tsc hello.ts");
|
||||
this.host.standardOut.WriteLine(" tsc --out foo.js foo.ts");
|
||||
this.host.standardOut.WriteLine(" tsc @args.txt");
|
||||
this.host.standardOut.WriteLine("");
|
||||
this.host.standardOut.WriteLine(getLocalizedText(DiagnosticCode.Options, null));
|
||||
|
||||
var output: string[][] = [];
|
||||
var maxLength = 0;
|
||||
var i = 0;
|
||||
|
||||
this.options = this.options.sort(function (a, b) {
|
||||
var aName = a.name.toLowerCase();
|
||||
var bName = b.name.toLowerCase();
|
||||
|
||||
if (aName > bName) {
|
||||
return 1;
|
||||
} else if (aName < bName) {
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
|
||||
// Build up output array
|
||||
for (i = 0; i < this.options.length; i++) {
|
||||
var option = this.options[i];
|
||||
|
||||
if (option.experimental) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!option.usage) {
|
||||
break;
|
||||
}
|
||||
|
||||
var usageString = " ";
|
||||
var type = option.type ? (" " + TypeScript.getLocalizedText(option.type, null)) : "";
|
||||
|
||||
if (option.short) {
|
||||
usageString += this.DEFAULT_SHORT_FLAG + option.short + type + ", ";
|
||||
}
|
||||
|
||||
usageString += this.DEFAULT_LONG_FLAG + option.name + type;
|
||||
|
||||
output.push([usageString, TypeScript.getLocalizedText(option.usage.locCode, option.usage.args)]);
|
||||
|
||||
if (usageString.length > maxLength) {
|
||||
maxLength = usageString.length;
|
||||
}
|
||||
}
|
||||
|
||||
var fileDescription = getLocalizedText(DiagnosticCode.Insert_command_line_options_and_files_from_a_file, null);
|
||||
output.push([" @<" + fileWord + ">", fileDescription]);
|
||||
|
||||
// Print padded output
|
||||
for (i = 0; i < output.length; i++) {
|
||||
this.host.standardOut.WriteLine(output[i][0] + (new Array(maxLength - output[i][0].length + 3)).join(" ") + output[i][1]);
|
||||
}
|
||||
}
|
||||
|
||||
public printVersion() {
|
||||
if (!this.printedVersion) {
|
||||
this.host.standardOut.WriteLine(getLocalizedText(DiagnosticCode.Version_0, [this.version]));
|
||||
this.printedVersion = true;
|
||||
}
|
||||
}
|
||||
|
||||
public option(name: string, config: IOptions, short?: string) {
|
||||
if (!config) {
|
||||
config = <any>short;
|
||||
short = null;
|
||||
}
|
||||
|
||||
config.name = name;
|
||||
config.short = short;
|
||||
config.flag = false;
|
||||
|
||||
this.options.push(config);
|
||||
}
|
||||
|
||||
public flag(name: string, config: IOptions, short?: string) {
|
||||
if (!config) {
|
||||
config = <any>short;
|
||||
short = null;
|
||||
}
|
||||
|
||||
config.name = name;
|
||||
config.short = short;
|
||||
config.flag = true;
|
||||
|
||||
this.options.push(config);
|
||||
}
|
||||
|
||||
// Parse an arguments string
|
||||
public parseString(argString: string) {
|
||||
var position = 0;
|
||||
var tokens = argString.match(/\s+|"|[^\s"]+/g);
|
||||
|
||||
function peek() {
|
||||
return tokens[position];
|
||||
}
|
||||
|
||||
function consume() {
|
||||
return tokens[position++];
|
||||
}
|
||||
|
||||
function consumeQuotedString() {
|
||||
var value = '';
|
||||
consume(); // skip opening quote.
|
||||
|
||||
var token = peek();
|
||||
|
||||
while (token && token !== '"') {
|
||||
consume();
|
||||
|
||||
value += token;
|
||||
|
||||
token = peek();
|
||||
}
|
||||
|
||||
consume(); // skip ending quote;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
var args: string[] = [];
|
||||
var currentArg = '';
|
||||
|
||||
while (position < tokens.length) {
|
||||
var token = peek();
|
||||
|
||||
if (token === '"') {
|
||||
currentArg += consumeQuotedString();
|
||||
} else if (token.match(/\s/)) {
|
||||
if (currentArg.length > 0) {
|
||||
args.push(currentArg);
|
||||
currentArg = '';
|
||||
}
|
||||
|
||||
consume();
|
||||
} else {
|
||||
consume();
|
||||
currentArg += token;
|
||||
}
|
||||
}
|
||||
|
||||
if (currentArg.length > 0) {
|
||||
args.push(currentArg);
|
||||
}
|
||||
|
||||
this.parse(args);
|
||||
}
|
||||
|
||||
// Parse arguments as they come from the platform: split into arguments.
|
||||
public parse(args: string[]) {
|
||||
var position = 0;
|
||||
|
||||
function consume() {
|
||||
return args[position++];
|
||||
}
|
||||
|
||||
while (position < args.length) {
|
||||
var current = consume();
|
||||
var match = current.match(/^(--?|@)(.*)/);
|
||||
var value: any = null;
|
||||
|
||||
if (match) {
|
||||
if (match[1] === '@') {
|
||||
this.parseString(this.host.readFile(match[2], null).contents);
|
||||
} else {
|
||||
var arg = match[2];
|
||||
var option = this.findOption(arg);
|
||||
|
||||
if (option === null) {
|
||||
this.host.standardOut.WriteLine(getDiagnosticMessage(DiagnosticCode.Unknown_compiler_option_0, [arg]));
|
||||
this.host.standardOut.WriteLine(getLocalizedText(DiagnosticCode.Use_the_0_flag_to_see_options, ["--help"]));
|
||||
} else {
|
||||
if (!option.flag) {
|
||||
value = consume();
|
||||
if (value === undefined) {
|
||||
// No value provided
|
||||
this.host.standardOut.WriteLine(getDiagnosticMessage(DiagnosticCode.Option_0_specified_without_1, [arg, getLocalizedText(option.type, null)]));
|
||||
this.host.standardOut.WriteLine(getLocalizedText(DiagnosticCode.Use_the_0_flag_to_see_options, ["--help"]));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
option.set(value);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.unnamed.push(current);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,736 +0,0 @@
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
///<reference path='typescript.ts'/>
|
||||
///<reference path='io.ts'/>
|
||||
///<reference path='optionsParser.ts'/>
|
||||
|
||||
module TypeScript {
|
||||
class SourceFile {
|
||||
constructor(public scriptSnapshot: IScriptSnapshot, public byteOrderMark: ByteOrderMark) {
|
||||
}
|
||||
}
|
||||
|
||||
class DiagnosticsLogger implements ILogger {
|
||||
constructor(public ioHost: IEnvironment) {
|
||||
}
|
||||
public information(): boolean { return false; }
|
||||
public debug(): boolean { return false; }
|
||||
public warning(): boolean { return false; }
|
||||
public error(): boolean { return false; }
|
||||
public fatal(): boolean { return false; }
|
||||
public log(s: string): void {
|
||||
this.ioHost.standardOut.WriteLine(s);
|
||||
}
|
||||
}
|
||||
|
||||
export class BatchCompiler implements IReferenceResolverHost {
|
||||
public compilerVersion = "1.0.1.0";
|
||||
private inputFiles: string[] = [];
|
||||
private compilationSettings: ImmutableCompilationSettings;
|
||||
private resolvedFiles: IResolvedFile[] = [];
|
||||
private fileNameToSourceFile = new StringHashTable<SourceFile>();
|
||||
private hasErrors: boolean = false;
|
||||
private logger: ILogger = null;
|
||||
|
||||
constructor(private ioHost: IEnvironment) {
|
||||
}
|
||||
|
||||
// Begin batch compilation
|
||||
public batchCompile() {
|
||||
// Parse command line options
|
||||
if (this.parseOptions()) {
|
||||
var start = new Date().getTime();
|
||||
|
||||
if (this.compilationSettings.gatherDiagnostics()) {
|
||||
this.logger = new DiagnosticsLogger(this.ioHost);
|
||||
} else {
|
||||
this.logger = new NullLogger();
|
||||
}
|
||||
|
||||
if (this.compilationSettings.watch()) {
|
||||
// Watch will cause the program to stick around as long as the files exist
|
||||
this.watchFiles();
|
||||
return;
|
||||
}
|
||||
|
||||
// Resolve the compilation environemnt
|
||||
this.resolve();
|
||||
|
||||
this.compile();
|
||||
|
||||
if (this.compilationSettings.gatherDiagnostics()) {
|
||||
this.logger.log("");
|
||||
this.logger.log("File resolution time: " + TypeScript.fileResolutionTime);
|
||||
this.logger.log(" file read: " + TypeScript.fileResolutionIOTime);
|
||||
this.logger.log(" scan imports: " + TypeScript.fileResolutionScanImportsTime);
|
||||
this.logger.log(" import search: " + TypeScript.fileResolutionImportFileSearchTime);
|
||||
this.logger.log(" get lib.d.ts: " + TypeScript.fileResolutionGetDefaultLibraryTime);
|
||||
|
||||
this.logger.log("SyntaxTree parse time: " + TypeScript.syntaxTreeParseTime);
|
||||
this.logger.log("Syntax Diagnostics time: " + TypeScript.syntaxDiagnosticsTime);
|
||||
this.logger.log("Create declarations time: " + TypeScript.createDeclarationsTime);
|
||||
this.logger.log("");
|
||||
this.logger.log("Type check time: " + TypeScript.typeCheckTime);
|
||||
this.logger.log("");
|
||||
this.logger.log("Emit time: " + TypeScript.emitTime);
|
||||
this.logger.log("Declaration emit time: " + TypeScript.declarationEmitTime);
|
||||
|
||||
this.logger.log("Total number of symbols created: " + TypeScript.pullSymbolID);
|
||||
this.logger.log("Specialized types created: " + TypeScript.nSpecializationsCreated);
|
||||
this.logger.log("Specialized signatures created: " + TypeScript.nSpecializedSignaturesCreated);
|
||||
|
||||
this.logger.log(" IsExternallyVisibleTime: " + TypeScript.declarationEmitIsExternallyVisibleTime);
|
||||
this.logger.log(" TypeSignatureTime: " + TypeScript.declarationEmitTypeSignatureTime);
|
||||
this.logger.log(" GetBoundDeclTypeTime: " + TypeScript.declarationEmitGetBoundDeclTypeTime);
|
||||
this.logger.log(" IsOverloadedCallSignatureTime: " + TypeScript.declarationEmitIsOverloadedCallSignatureTime);
|
||||
this.logger.log(" FunctionDeclarationGetSymbolTime: " + TypeScript.declarationEmitFunctionDeclarationGetSymbolTime);
|
||||
this.logger.log(" GetBaseTypeTime: " + TypeScript.declarationEmitGetBaseTypeTime);
|
||||
this.logger.log(" GetAccessorFunctionTime: " + TypeScript.declarationEmitGetAccessorFunctionTime);
|
||||
this.logger.log(" GetTypeParameterSymbolTime: " + TypeScript.declarationEmitGetTypeParameterSymbolTime);
|
||||
this.logger.log(" GetImportDeclarationSymbolTime: " + TypeScript.declarationEmitGetImportDeclarationSymbolTime);
|
||||
|
||||
this.logger.log("Emit write file time: " + TypeScript.emitWriteFileTime);
|
||||
|
||||
this.logger.log("Compiler resolve path time: " + TypeScript.compilerResolvePathTime);
|
||||
this.logger.log("Compiler directory name time: " + TypeScript.compilerDirectoryNameTime);
|
||||
this.logger.log("Compiler directory exists time: " + TypeScript.compilerDirectoryExistsTime);
|
||||
this.logger.log("Compiler file exists time: " + TypeScript.compilerFileExistsTime);
|
||||
|
||||
this.logger.log("IO host resolve path time: " + TypeScript.ioHostResolvePathTime);
|
||||
this.logger.log("IO host directory name time: " + TypeScript.ioHostDirectoryNameTime);
|
||||
this.logger.log("IO host create directory structure time: " + TypeScript.ioHostCreateDirectoryStructureTime);
|
||||
this.logger.log("IO host write file time: " + TypeScript.ioHostWriteFileTime);
|
||||
|
||||
this.logger.log("Node make directory time: " + TypeScript.nodeMakeDirectoryTime);
|
||||
this.logger.log("Node writeFileSync time: " + TypeScript.nodeWriteFileSyncTime);
|
||||
this.logger.log("Node createBuffer time: " + TypeScript.nodeCreateBufferTime);
|
||||
|
||||
this.logger.log("Total time: " + (new Date().getTime() - start));
|
||||
}
|
||||
}
|
||||
|
||||
// Exit with the appropriate error code
|
||||
this.ioHost.quit(this.hasErrors ? 1 : 0);
|
||||
}
|
||||
|
||||
private resolve() {
|
||||
// Resolve file dependencies, if requested
|
||||
var includeDefaultLibrary = !this.compilationSettings.noLib();
|
||||
var resolvedFiles: IResolvedFile[] = [];
|
||||
|
||||
var start = new Date().getTime();
|
||||
|
||||
if (!this.compilationSettings.noResolve()) {
|
||||
// Resolve references
|
||||
var resolutionResults = ReferenceResolver.resolve(this.inputFiles, this, this.compilationSettings.useCaseSensitiveFileResolution());
|
||||
resolvedFiles = resolutionResults.resolvedFiles;
|
||||
|
||||
// Only include the library if useDefaultLib is set to true and did not see any 'no-default-lib' comments
|
||||
includeDefaultLibrary = !this.compilationSettings.noLib() && !resolutionResults.seenNoDefaultLibTag;
|
||||
|
||||
// Populate any diagnostic messages generated during resolution
|
||||
resolutionResults.diagnostics.forEach(d => this.addDiagnostic(d));
|
||||
}
|
||||
else {
|
||||
for (var i = 0, n = this.inputFiles.length; i < n; i++) {
|
||||
var inputFile = this.inputFiles[i];
|
||||
var referencedFiles: string[] = [];
|
||||
var importedFiles: string[] = [];
|
||||
|
||||
// If declaration files are going to be emitted, preprocess the file contents and add in referenced files as well
|
||||
if (this.compilationSettings.generateDeclarationFiles()) {
|
||||
var references = getReferencedFiles(inputFile, this.getScriptSnapshot(inputFile));
|
||||
for (var j = 0; j < references.length; j++) {
|
||||
referencedFiles.push(references[j].path);
|
||||
}
|
||||
|
||||
inputFile = this.resolvePath(inputFile);
|
||||
}
|
||||
|
||||
resolvedFiles.push({
|
||||
path: inputFile,
|
||||
referencedFiles: referencedFiles,
|
||||
importedFiles: importedFiles
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
var defaultLibStart = new Date().getTime();
|
||||
if (includeDefaultLibrary) {
|
||||
var libraryResolvedFile: IResolvedFile = {
|
||||
path: this.getDefaultLibraryFilePath(),
|
||||
referencedFiles: [],
|
||||
importedFiles: []
|
||||
};
|
||||
|
||||
// Prepend the library to the resolved list
|
||||
resolvedFiles = [libraryResolvedFile].concat(resolvedFiles);
|
||||
}
|
||||
TypeScript.fileResolutionGetDefaultLibraryTime += new Date().getTime() - defaultLibStart;
|
||||
|
||||
this.resolvedFiles = resolvedFiles;
|
||||
|
||||
TypeScript.fileResolutionTime = new Date().getTime() - start;
|
||||
}
|
||||
|
||||
// Returns true if compilation failed from some reason.
|
||||
private compile(): void {
|
||||
var compiler = new TypeScriptCompiler(this.logger, this.compilationSettings);
|
||||
|
||||
this.resolvedFiles.forEach(resolvedFile => {
|
||||
var sourceFile = this.getSourceFile(resolvedFile.path);
|
||||
compiler.addFile(resolvedFile.path, sourceFile.scriptSnapshot, sourceFile.byteOrderMark, /*version:*/ 0, /*isOpen:*/ false, resolvedFile.referencedFiles);
|
||||
});
|
||||
|
||||
for (var it = compiler.compile((path: string) => this.resolvePath(path)); it.moveNext();) {
|
||||
var result = it.current();
|
||||
|
||||
result.diagnostics.forEach(d => this.addDiagnostic(d));
|
||||
if (!this.tryWriteOutputFiles(result.outputFiles)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Parse command line options
|
||||
private parseOptions() {
|
||||
var opts = new OptionsParser(this.ioHost, this.compilerVersion);
|
||||
|
||||
var mutableSettings = new CompilationSettings();
|
||||
opts.option('out', {
|
||||
usage: {
|
||||
locCode: DiagnosticCode.Concatenate_and_emit_output_to_single_file,
|
||||
args: null
|
||||
},
|
||||
type: DiagnosticCode.file2,
|
||||
set: (str) => {
|
||||
mutableSettings.outFileOption = str;
|
||||
}
|
||||
});
|
||||
|
||||
opts.option('outDir', {
|
||||
usage: {
|
||||
locCode: DiagnosticCode.Redirect_output_structure_to_the_directory,
|
||||
args: null
|
||||
},
|
||||
type: DiagnosticCode.DIRECTORY,
|
||||
set: (str) => {
|
||||
mutableSettings.outDirOption = str;
|
||||
}
|
||||
});
|
||||
|
||||
opts.flag('sourcemap', {
|
||||
usage: {
|
||||
locCode: DiagnosticCode.Generates_corresponding_0_file,
|
||||
args: ['.map']
|
||||
},
|
||||
set: () => {
|
||||
mutableSettings.mapSourceFiles = true;
|
||||
}
|
||||
});
|
||||
|
||||
opts.option('mapRoot', {
|
||||
usage: {
|
||||
locCode: DiagnosticCode.Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations,
|
||||
args: null
|
||||
},
|
||||
type: DiagnosticCode.LOCATION,
|
||||
set: (str) => {
|
||||
mutableSettings.mapRoot = str;
|
||||
}
|
||||
});
|
||||
|
||||
opts.option('sourceRoot', {
|
||||
usage: {
|
||||
locCode: DiagnosticCode.Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations,
|
||||
args: null
|
||||
},
|
||||
type: DiagnosticCode.LOCATION,
|
||||
set: (str) => {
|
||||
mutableSettings.sourceRoot = str;
|
||||
}
|
||||
});
|
||||
|
||||
opts.flag('declaration', {
|
||||
usage: {
|
||||
locCode: DiagnosticCode.Generates_corresponding_0_file,
|
||||
args: ['.d.ts']
|
||||
},
|
||||
set: () => {
|
||||
mutableSettings.generateDeclarationFiles = true;
|
||||
}
|
||||
}, 'd');
|
||||
|
||||
if (this.ioHost.watchFile) {
|
||||
opts.flag('watch', {
|
||||
usage: {
|
||||
locCode: DiagnosticCode.Watch_input_files,
|
||||
args: null
|
||||
},
|
||||
set: () => {
|
||||
mutableSettings.watch = true;
|
||||
}
|
||||
}, 'w');
|
||||
}
|
||||
|
||||
opts.flag('propagateEnumConstants', {
|
||||
experimental: true,
|
||||
set: () => { mutableSettings.propagateEnumConstants = true; }
|
||||
});
|
||||
|
||||
opts.flag('removeComments', {
|
||||
usage: {
|
||||
locCode: DiagnosticCode.Do_not_emit_comments_to_output,
|
||||
args: null
|
||||
},
|
||||
set: () => {
|
||||
mutableSettings.removeComments = true;
|
||||
}
|
||||
});
|
||||
|
||||
opts.flag('noResolve', {
|
||||
experimental: true,
|
||||
usage: {
|
||||
locCode: DiagnosticCode.Skip_resolution_and_preprocessing,
|
||||
args: null
|
||||
},
|
||||
set: () => {
|
||||
mutableSettings.noResolve = true;
|
||||
}
|
||||
});
|
||||
|
||||
opts.flag('noLib', {
|
||||
experimental: true,
|
||||
set: () => {
|
||||
mutableSettings.noLib = true;
|
||||
}
|
||||
});
|
||||
|
||||
opts.flag('diagnostics', {
|
||||
experimental: true,
|
||||
set: () => {
|
||||
mutableSettings.gatherDiagnostics = true;
|
||||
}
|
||||
});
|
||||
|
||||
opts.option('target', {
|
||||
usage: {
|
||||
locCode: DiagnosticCode.Specify_ECMAScript_target_version_0_default_or_1,
|
||||
args: ['ES3', 'ES5']
|
||||
},
|
||||
type: DiagnosticCode.VERSION,
|
||||
set: (type) => {
|
||||
type = type.toLowerCase();
|
||||
|
||||
if (type === 'es3') {
|
||||
mutableSettings.codeGenTarget = LanguageVersion.EcmaScript3;
|
||||
}
|
||||
else if (type === 'es5') {
|
||||
mutableSettings.codeGenTarget = LanguageVersion.EcmaScript5;
|
||||
}
|
||||
else {
|
||||
this.addDiagnostic(
|
||||
new Diagnostic(null, null, 0, 0, DiagnosticCode.Argument_for_0_option_must_be_1_or_2, ["target", "ES3", "ES5"]));
|
||||
}
|
||||
}
|
||||
}, 't');
|
||||
|
||||
opts.option('module', {
|
||||
usage: {
|
||||
locCode: DiagnosticCode.Specify_module_code_generation_0_or_1,
|
||||
args: ['commonjs', 'amd']
|
||||
},
|
||||
type: DiagnosticCode.KIND,
|
||||
set: (type) => {
|
||||
type = type.toLowerCase();
|
||||
|
||||
if (type === 'commonjs') {
|
||||
mutableSettings.moduleGenTarget = ModuleGenTarget.Synchronous;
|
||||
}
|
||||
else if (type === 'amd') {
|
||||
mutableSettings.moduleGenTarget = ModuleGenTarget.Asynchronous;
|
||||
}
|
||||
else {
|
||||
this.addDiagnostic(
|
||||
new Diagnostic(null, null, 0, 0, DiagnosticCode.Argument_for_0_option_must_be_1_or_2, ["module", "commonjs", "amd"]));
|
||||
}
|
||||
}
|
||||
}, 'm');
|
||||
|
||||
var needsHelp = false;
|
||||
opts.flag('help', {
|
||||
usage: {
|
||||
locCode: DiagnosticCode.Print_this_message,
|
||||
args: null
|
||||
},
|
||||
set: () => {
|
||||
needsHelp = true;
|
||||
}
|
||||
}, 'h');
|
||||
|
||||
opts.flag('useCaseSensitiveFileResolution', {
|
||||
experimental: true,
|
||||
set: () => {
|
||||
mutableSettings.useCaseSensitiveFileResolution = true;
|
||||
}
|
||||
});
|
||||
var shouldPrintVersionOnly = false;
|
||||
opts.flag('version', {
|
||||
usage: {
|
||||
locCode: DiagnosticCode.Print_the_compiler_s_version_0,
|
||||
args: [this.compilerVersion]
|
||||
},
|
||||
set: () => {
|
||||
shouldPrintVersionOnly = true;
|
||||
}
|
||||
}, 'v');
|
||||
|
||||
var locale: string = null;
|
||||
opts.option('locale', {
|
||||
experimental: true,
|
||||
usage: {
|
||||
locCode: DiagnosticCode.Specify_locale_for_errors_and_messages_For_example_0_or_1,
|
||||
args: ['en', 'ja-jp']
|
||||
},
|
||||
type: DiagnosticCode.STRING,
|
||||
set: (value) => {
|
||||
locale = value;
|
||||
}
|
||||
});
|
||||
|
||||
opts.flag('noImplicitAny', {
|
||||
usage: {
|
||||
locCode: DiagnosticCode.Raise_error_on_expressions_and_declarations_with_an_implied_any_type,
|
||||
args: null
|
||||
},
|
||||
set: () => {
|
||||
mutableSettings.noImplicitAny = true;
|
||||
}
|
||||
});
|
||||
|
||||
if (Environment.supportsCodePage()) {
|
||||
opts.option('codepage', {
|
||||
usage: {
|
||||
locCode: DiagnosticCode.Specify_the_codepage_to_use_when_opening_source_files,
|
||||
args: null
|
||||
},
|
||||
type: DiagnosticCode.NUMBER,
|
||||
set: (arg) => {
|
||||
mutableSettings.codepage = parseInt(arg, 10);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
opts.parse(this.ioHost.arguments);
|
||||
|
||||
this.compilationSettings = ImmutableCompilationSettings.fromCompilationSettings(mutableSettings);
|
||||
|
||||
if (locale) {
|
||||
if (!this.setLocale(locale)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
this.inputFiles.push.apply(this.inputFiles, opts.unnamed);
|
||||
|
||||
if (shouldPrintVersionOnly) {
|
||||
opts.printVersion();
|
||||
return false;
|
||||
}
|
||||
// If no source files provided to compiler - print usage information
|
||||
else if (this.inputFiles.length === 0 || needsHelp) {
|
||||
opts.printUsage();
|
||||
return false;
|
||||
}
|
||||
|
||||
return !this.hasErrors;
|
||||
}
|
||||
|
||||
private setLocale(locale: string): boolean {
|
||||
var matchResult = /^([a-z]+)([_\-]([a-z]+))?$/.exec(locale.toLowerCase());
|
||||
if (!matchResult) {
|
||||
this.addDiagnostic(new Diagnostic(null, null, 0, 0, DiagnosticCode.Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1, ['en', 'ja-jp']));
|
||||
return false;
|
||||
}
|
||||
|
||||
var language = matchResult[1];
|
||||
var territory = matchResult[3];
|
||||
|
||||
// First try the entire locale, then fall back to just language if that's all we have.
|
||||
if (!this.setLanguageAndTerritory(language, territory) &&
|
||||
!this.setLanguageAndTerritory(language, null)) {
|
||||
|
||||
this.addDiagnostic(new Diagnostic(null, null, 0, 0, DiagnosticCode.Unsupported_locale_0, [locale]));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private setLanguageAndTerritory(language: string, territory: string): boolean {
|
||||
|
||||
var compilerFilePath = this.ioHost.executingFilePath();
|
||||
var containingDirectoryPath = this.ioHost.directoryName(compilerFilePath);
|
||||
|
||||
var filePath = IOUtils.combine(containingDirectoryPath, language);
|
||||
if (territory) {
|
||||
filePath = filePath + "-" + territory;
|
||||
}
|
||||
|
||||
filePath = this.resolvePath(IOUtils.combine(filePath, "diagnosticMessages.generated.json"));
|
||||
|
||||
if (!this.fileExists(filePath)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var fileContents = this.ioHost.readFile(filePath, this.compilationSettings.codepage());
|
||||
TypeScript.LocalizedDiagnosticMessages = JSON.parse(fileContents.contents);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Handle -watch switch
|
||||
private watchFiles() {
|
||||
if (!this.ioHost.watchFile) {
|
||||
this.addDiagnostic(
|
||||
new Diagnostic(null, null, 0, 0, DiagnosticCode.Current_host_does_not_support_0_option, ['-w[atch]']));
|
||||
return;
|
||||
}
|
||||
|
||||
var lastResolvedFileSet: string[] = []
|
||||
var watchers: { [x: string]: IFileWatcher; } = {};
|
||||
var firstTime = true;
|
||||
|
||||
var addWatcher = (fileName: string) => {
|
||||
if (!watchers[fileName]) {
|
||||
var watcher = this.ioHost.watchFile(fileName, onWatchedFileChange);
|
||||
watchers[fileName] = watcher;
|
||||
}
|
||||
};
|
||||
|
||||
var removeWatcher = (fileName: string) => {
|
||||
if (watchers[fileName]) {
|
||||
watchers[fileName].close();
|
||||
delete watchers[fileName];
|
||||
}
|
||||
};
|
||||
|
||||
var onWatchedFileChange = () => {
|
||||
// Clean errors for previous compilation
|
||||
this.hasErrors = false;
|
||||
|
||||
// Clear out any source file data we've cached.
|
||||
this.fileNameToSourceFile = new StringHashTable<SourceFile>();
|
||||
|
||||
// Resolve file dependencies, if requested
|
||||
this.resolve();
|
||||
|
||||
// Check if any new files were added to the environment as a result of the file change
|
||||
var oldFiles = lastResolvedFileSet;
|
||||
var newFiles = this.resolvedFiles.map(resolvedFile => resolvedFile.path).sort();
|
||||
|
||||
var i = 0, j = 0;
|
||||
while (i < oldFiles.length && j < newFiles.length) {
|
||||
|
||||
var compareResult = oldFiles[i].localeCompare(newFiles[j]);
|
||||
if (compareResult === 0) {
|
||||
// No change here
|
||||
i++;
|
||||
j++;
|
||||
}
|
||||
else if (compareResult < 0) {
|
||||
// Entry in old list does not exist in the new one, it was removed
|
||||
removeWatcher(oldFiles[i]);
|
||||
i++;
|
||||
}
|
||||
else {
|
||||
// Entry in new list does exist in the new one, it was added
|
||||
addWatcher(newFiles[j]);
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
// All remaining unmatched items in the old list have been removed
|
||||
for (var k = i; k < oldFiles.length; k++) {
|
||||
removeWatcher(oldFiles[k]);
|
||||
}
|
||||
|
||||
// All remaing unmatched items in the new list have been added
|
||||
for (k = j; k < newFiles.length; k++) {
|
||||
addWatcher(newFiles[k]);
|
||||
}
|
||||
|
||||
// Update the state
|
||||
lastResolvedFileSet = newFiles;
|
||||
|
||||
// Print header
|
||||
if (!firstTime) {
|
||||
var fileNames = "";
|
||||
for (var k = 0; k < lastResolvedFileSet.length; k++) {
|
||||
fileNames += Environment.newLine + " " + lastResolvedFileSet[k];
|
||||
}
|
||||
this.ioHost.standardError.WriteLine(getLocalizedText(DiagnosticCode.NL_Recompiling_0, [fileNames]));
|
||||
}
|
||||
else {
|
||||
firstTime = false;
|
||||
}
|
||||
|
||||
// Trigger a new compilation
|
||||
this.compile();
|
||||
};
|
||||
|
||||
// Switch to using stdout for all error messages
|
||||
this.ioHost.standardOut = this.ioHost.standardOut;
|
||||
|
||||
onWatchedFileChange();
|
||||
}
|
||||
|
||||
private getSourceFile(fileName: string): SourceFile {
|
||||
var sourceFile: SourceFile = this.fileNameToSourceFile.lookup(fileName);
|
||||
if (!sourceFile) {
|
||||
// Attempt to read the file
|
||||
var fileInformation: FileInformation;
|
||||
|
||||
try {
|
||||
fileInformation = this.ioHost.readFile(fileName, this.compilationSettings.codepage());
|
||||
}
|
||||
catch (e) {
|
||||
this.addDiagnostic(new Diagnostic(null, null, 0, 0, DiagnosticCode.Cannot_read_file_0_1, [fileName, e.message]));
|
||||
fileInformation = new FileInformation("", ByteOrderMark.None);
|
||||
}
|
||||
|
||||
var snapshot = ScriptSnapshot.fromString(fileInformation.contents);
|
||||
var sourceFile = new SourceFile(snapshot, fileInformation.byteOrderMark);
|
||||
this.fileNameToSourceFile.add(fileName, sourceFile);
|
||||
}
|
||||
|
||||
return sourceFile;
|
||||
}
|
||||
|
||||
private getDefaultLibraryFilePath(): string {
|
||||
var compilerFilePath = this.ioHost.executingFilePath();
|
||||
var containingDirectoryPath = this.ioHost.directoryName(compilerFilePath);
|
||||
var libraryFilePath = this.resolvePath(IOUtils.combine(containingDirectoryPath, "lib.d.ts"));
|
||||
|
||||
return libraryFilePath;
|
||||
}
|
||||
|
||||
/// IReferenceResolverHost methods
|
||||
getScriptSnapshot(fileName: string): IScriptSnapshot {
|
||||
return this.getSourceFile(fileName).scriptSnapshot;
|
||||
}
|
||||
|
||||
resolveRelativePath(path: string, directory: string): string {
|
||||
var unQuotedPath = stripStartAndEndQuotes(path);
|
||||
var normalizedPath: string;
|
||||
|
||||
if (isRooted(unQuotedPath) || !directory) {
|
||||
normalizedPath = unQuotedPath;
|
||||
} else {
|
||||
normalizedPath = IOUtils.combine(directory, unQuotedPath);
|
||||
}
|
||||
|
||||
// get the absolute path
|
||||
normalizedPath = this.resolvePath(normalizedPath);
|
||||
|
||||
// Switch to forward slashes
|
||||
normalizedPath = switchToForwardSlashes(normalizedPath);
|
||||
|
||||
return normalizedPath;
|
||||
}
|
||||
|
||||
private fileExistsCache = createIntrinsicsObject<boolean>();
|
||||
|
||||
fileExists(path: string): boolean {
|
||||
var exists = this.fileExistsCache[path];
|
||||
if (exists === undefined) {
|
||||
var start = new Date().getTime();
|
||||
exists = this.ioHost.fileExists(path);
|
||||
this.fileExistsCache[path] = exists;
|
||||
TypeScript.compilerFileExistsTime += new Date().getTime() - start;
|
||||
}
|
||||
|
||||
return exists;
|
||||
}
|
||||
|
||||
getParentDirectory(path: string): string {
|
||||
var start = new Date().getTime();
|
||||
var result = this.ioHost.directoryName(path);
|
||||
TypeScript.compilerDirectoryNameTime += new Date().getTime() - start;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
private addDiagnostic(diagnostic: Diagnostic): void {
|
||||
var diagnosticInfo = diagnostic.info();
|
||||
if (diagnosticInfo.category === DiagnosticCategory.Error) {
|
||||
this.hasErrors = true;
|
||||
}
|
||||
|
||||
this.ioHost.standardError.Write(TypeScriptCompiler.getFullDiagnosticText(diagnostic, path => this.resolvePath(path)));
|
||||
}
|
||||
|
||||
private tryWriteOutputFiles(outputFiles: OutputFile[]): boolean {
|
||||
for (var i = 0, n = outputFiles.length; i < n; i++) {
|
||||
var outputFile = outputFiles[i];
|
||||
|
||||
try {
|
||||
this.writeFile(outputFile.name, outputFile.text, outputFile.writeByteOrderMark);
|
||||
}
|
||||
catch (e) {
|
||||
this.addDiagnostic(
|
||||
new Diagnostic(outputFile.name, null, 0, 0, DiagnosticCode.Emit_Error_0, [e.message]));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
writeFile(fileName: string, contents: string, writeByteOrderMark: boolean): void {
|
||||
var start = new Date().getTime();
|
||||
IOUtils.writeFileAndFolderStructure(this.ioHost, fileName, contents, writeByteOrderMark);
|
||||
TypeScript.emitWriteFileTime += new Date().getTime() - start;
|
||||
}
|
||||
|
||||
directoryExists(path: string): boolean {
|
||||
var start = new Date().getTime();
|
||||
var result = this.ioHost.directoryExists(path);
|
||||
TypeScript.compilerDirectoryExistsTime += new Date().getTime() - start;
|
||||
return result;
|
||||
}
|
||||
|
||||
// For performance reasons we cache the results of resolvePath. This avoids costly lookup
|
||||
// on the disk once we've already resolved a path once.
|
||||
private resolvePathCache = createIntrinsicsObject<string>();
|
||||
|
||||
resolvePath(path: string): string {
|
||||
var cachedValue = this.resolvePathCache[path];
|
||||
if (!cachedValue) {
|
||||
var start = new Date().getTime();
|
||||
cachedValue = this.ioHost.absolutePath(path);
|
||||
this.resolvePathCache[path] = cachedValue;
|
||||
TypeScript.compilerResolvePathTime += new Date().getTime() - start;
|
||||
}
|
||||
|
||||
return cachedValue;
|
||||
}
|
||||
}
|
||||
|
||||
// Start the batch compilation using the current hosts IO
|
||||
var batch = new TypeScript.BatchCompiler(Environment);
|
||||
batch.batchCompile();
|
||||
}
|
||||
@@ -120,7 +120,14 @@ module ts.formatting {
|
||||
|
||||
function findOutermostParent(position: number, expectedTokenKind: SyntaxKind, sourceFile: SourceFile): Node {
|
||||
var precedingToken = findPrecedingToken(position, sourceFile);
|
||||
if (!precedingToken || precedingToken.kind !== expectedTokenKind) {
|
||||
|
||||
// when it is claimed that trigger character was typed at given position
|
||||
// we verify that there is a token with a matching kind whose end is equal to position (because the character was just typed).
|
||||
// If this condition is not hold - then trigger character was typed in some other context,
|
||||
// i.e.in comment and thus should not trigger autoformatting
|
||||
if (!precedingToken ||
|
||||
precedingToken.kind !== expectedTokenKind ||
|
||||
position !== precedingToken.getEnd()) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ module ts.formatting {
|
||||
private activeRules: Rule[];
|
||||
private rulesMap: RulesMap;
|
||||
|
||||
constructor(private logger: Logger) {
|
||||
constructor() {
|
||||
this.globalRules = new Rules();
|
||||
}
|
||||
|
||||
|
||||
@@ -50,8 +50,9 @@ module ts.NavigationBar {
|
||||
case SyntaxKind.ArrayBindingPattern:
|
||||
forEach((<BindingPattern>node).elements, visit);
|
||||
break;
|
||||
case SyntaxKind.BindingElement:
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
if (isBindingPattern(node)) {
|
||||
if (isBindingPattern((<VariableDeclaration>node).name)) {
|
||||
visit((<VariableDeclaration>node).name);
|
||||
break;
|
||||
}
|
||||
@@ -262,17 +263,34 @@ module ts.NavigationBar {
|
||||
return createItem(node, getTextOfNode((<FunctionLikeDeclaration>node).name), ts.ScriptElementKind.functionElement);
|
||||
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
if (isBindingPattern((<VariableDeclaration>node).name)) {
|
||||
break;
|
||||
}
|
||||
if (isConst(node)) {
|
||||
return createItem(node, getTextOfNode((<VariableDeclaration>node).name), ts.ScriptElementKind.constElement);
|
||||
}
|
||||
else if (isLet(node)) {
|
||||
return createItem(node, getTextOfNode((<VariableDeclaration>node).name), ts.ScriptElementKind.letElement);
|
||||
case SyntaxKind.BindingElement:
|
||||
var variableDeclarationNode: Node;
|
||||
var name: Node;
|
||||
|
||||
if (node.kind === SyntaxKind.BindingElement) {
|
||||
name = (<BindingElement>node).name;
|
||||
variableDeclarationNode = node;
|
||||
// binding elements are added only for variable declarations
|
||||
// bubble up to the containing variable declaration
|
||||
while (variableDeclarationNode && variableDeclarationNode.kind !== SyntaxKind.VariableDeclaration) {
|
||||
variableDeclarationNode = variableDeclarationNode.parent;
|
||||
}
|
||||
Debug.assert(variableDeclarationNode !== undefined);
|
||||
}
|
||||
else {
|
||||
return createItem(node, getTextOfNode((<VariableDeclaration>node).name), ts.ScriptElementKind.variableElement);
|
||||
Debug.assert(!isBindingPattern((<VariableDeclaration>node).name));
|
||||
variableDeclarationNode = node;
|
||||
name = (<VariableDeclaration>node).name;
|
||||
}
|
||||
|
||||
if (isConst(variableDeclarationNode)) {
|
||||
return createItem(node, getTextOfNode(name), ts.ScriptElementKind.constElement);
|
||||
}
|
||||
else if (isLet(variableDeclarationNode)) {
|
||||
return createItem(node, getTextOfNode(name), ts.ScriptElementKind.letElement);
|
||||
}
|
||||
else {
|
||||
return createItem(node, getTextOfNode(name), ts.ScriptElementKind.variableElement);
|
||||
}
|
||||
|
||||
case SyntaxKind.Constructor:
|
||||
|
||||
@@ -402,19 +402,13 @@ module TypeScript {
|
||||
Option_0_specified_without_1: "Option '{0}' specified without '{1}'",
|
||||
codepage_option_not_supported_on_current_platform: "'codepage' option not supported on current platform.",
|
||||
Concatenate_and_emit_output_to_single_file: "Concatenate and emit output to single file.",
|
||||
Generates_corresponding_0_file: "Generates corresponding {0} file.",
|
||||
Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: "Specifies the location where debugger should locate map files instead of generated locations.",
|
||||
Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: "Specifies the location where debugger should locate TypeScript files instead of source locations.",
|
||||
Watch_input_files: "Watch input files.",
|
||||
Redirect_output_structure_to_the_directory: "Redirect output structure to the directory.",
|
||||
Do_not_emit_comments_to_output: "Do not emit comments to output.",
|
||||
Skip_resolution_and_preprocessing: "Skip resolution and preprocessing.",
|
||||
Specify_ECMAScript_target_version_0_default_or_1: "Specify ECMAScript target version: '{0}' (default), or '{1}'",
|
||||
Specify_module_code_generation_0_or_1: "Specify module code generation: '{0}' or '{1}'",
|
||||
Print_this_message: "Print this message.",
|
||||
Print_the_compiler_s_version_0: "Print the compiler's version: {0}",
|
||||
Allow_use_of_deprecated_0_keyword_when_referencing_an_external_module: "Allow use of deprecated '{0}' keyword when referencing an external module.",
|
||||
Specify_locale_for_errors_and_messages_For_example_0_or_1: "Specify locale for errors and messages. For example '{0}' or '{1}'",
|
||||
Syntax_0: "Syntax: {0}",
|
||||
options: "options",
|
||||
file1: "file",
|
||||
@@ -431,7 +425,6 @@ module TypeScript {
|
||||
LOCATION: "LOCATION",
|
||||
DIRECTORY: "DIRECTORY",
|
||||
NUMBER: "NUMBER",
|
||||
Specify_the_codepage_to_use_when_opening_source_files: "Specify the codepage to use when opening source files.",
|
||||
Additional_locations: "Additional locations:",
|
||||
This_version_of_the_Javascript_runtime_does_not_support_the_0_function: "This version of the Javascript runtime does not support the '{0}' function.",
|
||||
Unknown_rule: "Unknown rule.",
|
||||
|
||||
+377
-278
File diff suppressed because it is too large
Load Diff
+15
-24
@@ -25,9 +25,6 @@ module ts {
|
||||
/** Gets the length of this script snapshot. */
|
||||
getLength(): number;
|
||||
|
||||
/** This call returns the JSON-encoded array of the type: number[] */
|
||||
getLineStartPositions(): string;
|
||||
|
||||
/**
|
||||
* Returns a JSON-encoded value of the type:
|
||||
* { span: { start: number; length: number }; newLength: number }
|
||||
@@ -37,6 +34,12 @@ module ts {
|
||||
getChangeRange(oldSnapshot: ScriptSnapshotShim): string;
|
||||
}
|
||||
|
||||
export interface Logger {
|
||||
log(s: string): void;
|
||||
trace(s: string): void;
|
||||
error(s: string): void;
|
||||
}
|
||||
|
||||
/** Public interface of the host of a language service shim instance.*/
|
||||
export interface LanguageServiceShimHost extends Logger {
|
||||
getCompilationSettings(): string;
|
||||
@@ -44,7 +47,6 @@ module ts {
|
||||
/** Returns a JSON-encoded value of the type: string[] */
|
||||
getScriptFileNames(): string;
|
||||
getScriptVersion(fileName: string): string;
|
||||
getScriptIsOpen(fileName: string): boolean;
|
||||
getScriptSnapshot(fileName: string): ScriptSnapshotShim;
|
||||
getLocalizedDiagnosticMessages(): string;
|
||||
getCancellationToken(): CancellationToken;
|
||||
@@ -187,14 +189,6 @@ module ts {
|
||||
return this.scriptSnapshotShim.getLength();
|
||||
}
|
||||
|
||||
public getLineStartPositions(): number[] {
|
||||
if (this.lineStartPositions == null) {
|
||||
this.lineStartPositions = JSON.parse(this.scriptSnapshotShim.getLineStartPositions());
|
||||
}
|
||||
|
||||
return this.lineStartPositions;
|
||||
}
|
||||
|
||||
public getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange {
|
||||
var oldSnapshotShim = <ScriptSnapshotShimAdapter>oldSnapshot;
|
||||
var encoded = this.scriptSnapshotShim.getChangeRange(oldSnapshotShim.scriptSnapshotShim);
|
||||
@@ -239,17 +233,14 @@ module ts {
|
||||
}
|
||||
|
||||
public getScriptSnapshot(fileName: string): IScriptSnapshot {
|
||||
return new ScriptSnapshotShimAdapter(this.shimHost.getScriptSnapshot(fileName));
|
||||
var scriptSnapshot = this.shimHost.getScriptSnapshot(fileName);
|
||||
return scriptSnapshot && new ScriptSnapshotShimAdapter(scriptSnapshot);
|
||||
}
|
||||
|
||||
public getScriptVersion(fileName: string): string {
|
||||
return this.shimHost.getScriptVersion(fileName);
|
||||
}
|
||||
|
||||
public getScriptIsOpen(fileName: string): boolean {
|
||||
return this.shimHost.getScriptIsOpen(fileName);
|
||||
}
|
||||
|
||||
public getLocalizedDiagnosticMessages(): any {
|
||||
var diagnosticMessagesJson = this.shimHost.getLocalizedDiagnosticMessages();
|
||||
if (diagnosticMessagesJson == null || diagnosticMessagesJson == "") {
|
||||
@@ -269,13 +260,13 @@ module ts {
|
||||
return this.shimHost.getCancellationToken();
|
||||
}
|
||||
|
||||
public getDefaultLibFilename(options: CompilerOptions): string {
|
||||
return this.shimHost.getDefaultLibFilename(JSON.stringify(options));
|
||||
}
|
||||
|
||||
public getCurrentDirectory(): string {
|
||||
return this.shimHost.getCurrentDirectory();
|
||||
}
|
||||
|
||||
public getDefaultLibFilename(options: CompilerOptions): string {
|
||||
return this.shimHost.getDefaultLibFilename(JSON.stringify(options));
|
||||
}
|
||||
}
|
||||
|
||||
function simpleForwardCall(logger: Logger, actionDescription: string, action: () => any): any {
|
||||
@@ -669,9 +660,9 @@ module ts {
|
||||
class ClassifierShimObject extends ShimBase implements ClassifierShim {
|
||||
public classifier: Classifier;
|
||||
|
||||
constructor(factory: ShimFactory, public logger: Logger) {
|
||||
constructor(factory: ShimFactory) {
|
||||
super(factory);
|
||||
this.classifier = createClassifier(this.logger);
|
||||
this.classifier = createClassifier();
|
||||
}
|
||||
|
||||
/// COLORIZATION
|
||||
@@ -761,7 +752,7 @@ module ts {
|
||||
|
||||
public createClassifierShim(logger: Logger): ClassifierShim {
|
||||
try {
|
||||
return new ClassifierShimObject(this, logger);
|
||||
return new ClassifierShimObject(this);
|
||||
}
|
||||
catch (err) {
|
||||
logInternalError(logger, err);
|
||||
|
||||
-7
@@ -383,19 +383,13 @@ declare module TypeScript {
|
||||
Option_0_specified_without_1: string;
|
||||
codepage_option_not_supported_on_current_platform: string;
|
||||
Concatenate_and_emit_output_to_single_file: string;
|
||||
Generates_corresponding_0_file: string;
|
||||
Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: string;
|
||||
Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: string;
|
||||
Watch_input_files: string;
|
||||
Redirect_output_structure_to_the_directory: string;
|
||||
Do_not_emit_comments_to_output: string;
|
||||
Skip_resolution_and_preprocessing: string;
|
||||
Specify_ECMAScript_target_version_0_default_or_1: string;
|
||||
Specify_module_code_generation_0_or_1: string;
|
||||
Print_this_message: string;
|
||||
Print_the_compiler_s_version_0: string;
|
||||
Allow_use_of_deprecated_0_keyword_when_referencing_an_external_module: string;
|
||||
Specify_locale_for_errors_and_messages_For_example_0_or_1: string;
|
||||
Syntax_0: string;
|
||||
options: string;
|
||||
file1: string;
|
||||
@@ -412,7 +406,6 @@ declare module TypeScript {
|
||||
LOCATION: string;
|
||||
DIRECTORY: string;
|
||||
NUMBER: string;
|
||||
Specify_the_codepage_to_use_when_opening_source_files: string;
|
||||
Additional_locations: string;
|
||||
This_version_of_the_Javascript_runtime_does_not_support_the_0_function: string;
|
||||
Unknown_rule: string;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,8 @@
|
||||
//// [ArrowFunction1.ts]
|
||||
var v = (a: ) => {
|
||||
|
||||
};
|
||||
|
||||
//// [ArrowFunction1.js]
|
||||
var v = function (a) {
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
//// [ArrowFunction2.ts]
|
||||
var v = (a: b,) => {
|
||||
|
||||
};
|
||||
|
||||
//// [ArrowFunction2.js]
|
||||
var v = function (a) {
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
//// [ArrowFunction3.ts]
|
||||
var v = (a): => {
|
||||
|
||||
};
|
||||
|
||||
//// [ArrowFunction3.js]
|
||||
var v = function (a) {
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
//// [ExportAssignment7.ts]
|
||||
export class C {
|
||||
}
|
||||
|
||||
export = B;
|
||||
|
||||
//// [ExportAssignment7.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
})();
|
||||
exports.C = C;
|
||||
@@ -0,0 +1,13 @@
|
||||
//// [ExportAssignment8.ts]
|
||||
export = B;
|
||||
|
||||
export class C {
|
||||
}
|
||||
|
||||
//// [ExportAssignment8.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
})();
|
||||
exports.C = C;
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
//// [ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.ts]
|
||||
module A {
|
||||
|
||||
class Point {
|
||||
constructor(public x: number, public y: number) { }
|
||||
}
|
||||
|
||||
export var UnitSquare : {
|
||||
top: { left: Point, right: Point },
|
||||
bottom: { left: Point, right: Point }
|
||||
} = null;
|
||||
}
|
||||
|
||||
//// [ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.js]
|
||||
var A;
|
||||
(function (A) {
|
||||
var Point = (function () {
|
||||
function Point(x, y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
return Point;
|
||||
})();
|
||||
A.UnitSquare = null;
|
||||
})(A || (A = {}));
|
||||
@@ -0,0 +1,8 @@
|
||||
//// [FunctionDeclaration10_es6.ts]
|
||||
function * foo(a = yield => yield) {
|
||||
}
|
||||
|
||||
//// [FunctionDeclaration10_es6.js]
|
||||
function foo(a) {
|
||||
if (a === void 0) { a = function (yield) { return yield; }; }
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
//// [FunctionDeclaration11_es6.ts]
|
||||
function * yield() {
|
||||
}
|
||||
|
||||
//// [FunctionDeclaration11_es6.js]
|
||||
function yield() {
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
//// [FunctionDeclaration12_es6.ts]
|
||||
var v = function * yield() { }
|
||||
|
||||
//// [FunctionDeclaration12_es6.js]
|
||||
var v = , yield = function () {
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
//// [FunctionDeclaration13_es6.ts]
|
||||
function * foo() {
|
||||
// Legal to use 'yield' in a type context.
|
||||
var v: yield;
|
||||
}
|
||||
|
||||
|
||||
//// [FunctionDeclaration13_es6.js]
|
||||
function foo() {
|
||||
// Legal to use 'yield' in a type context.
|
||||
var v;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
//// [FunctionDeclaration1_es6.ts]
|
||||
function * foo() {
|
||||
}
|
||||
|
||||
//// [FunctionDeclaration1_es6.js]
|
||||
function foo() {
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
//// [FunctionDeclaration5_es6.ts]
|
||||
function*foo(yield) {
|
||||
}
|
||||
|
||||
//// [FunctionDeclaration5_es6.js]
|
||||
yield;
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
//// [FunctionDeclaration6_es6.ts]
|
||||
function*foo(a = yield) {
|
||||
}
|
||||
|
||||
//// [FunctionDeclaration6_es6.js]
|
||||
function foo(a) {
|
||||
if (a === void 0) { a = yield; }
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
//// [FunctionDeclaration7_es6.ts]
|
||||
function*bar() {
|
||||
// 'yield' here is an identifier, and not a yield expression.
|
||||
function*foo(a = yield) {
|
||||
}
|
||||
}
|
||||
|
||||
//// [FunctionDeclaration7_es6.js]
|
||||
function bar() {
|
||||
// 'yield' here is an identifier, and not a yield expression.
|
||||
function foo(a) {
|
||||
if (a === void 0) { a = yield; }
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,13 @@
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts(1,11): error TS9002: Computed property names are not currently supported.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts(1,11): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts(1,12): error TS2304: Cannot find name 'yield'.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts(1,20): error TS2304: Cannot find name 'foo'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts (1 errors) ====
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts (3 errors) ====
|
||||
var v = { [yield]: foo }
|
||||
~~~~~~~
|
||||
!!! error TS9002: Computed property names are not currently supported.
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'yield'.
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'foo'.
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [FunctionDeclaration8_es6.ts]
|
||||
var v = { [yield]: foo }
|
||||
|
||||
//// [FunctionDeclaration8_es6.js]
|
||||
var v = { [yield]: foo };
|
||||
@@ -1,12 +1,15 @@
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(1,10): error TS9001: Generators are not currently supported.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(2,13): error TS9002: Computed property names are not currently supported.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(2,13): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(2,14): error TS9000: 'yield' expressions are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts (2 errors) ====
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts (3 errors) ====
|
||||
function * foo() {
|
||||
~
|
||||
!!! error TS9001: Generators are not currently supported.
|
||||
var v = { [yield]: foo }
|
||||
~~~~~~~
|
||||
!!! error TS9002: Computed property names are not currently supported.
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~~
|
||||
!!! error TS9000: 'yield' expressions are not currently supported.
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
//// [FunctionDeclaration9_es6.ts]
|
||||
function * foo() {
|
||||
var v = { [yield]: foo }
|
||||
}
|
||||
|
||||
//// [FunctionDeclaration9_es6.js]
|
||||
function foo() {
|
||||
var v = { []: foo };
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
//// [FunctionExpression1_es6.ts]
|
||||
var v = function * () { }
|
||||
|
||||
//// [FunctionExpression1_es6.js]
|
||||
var v = function () {
|
||||
};
|
||||
@@ -0,0 +1,6 @@
|
||||
//// [FunctionExpression2_es6.ts]
|
||||
var v = function * foo() { }
|
||||
|
||||
//// [FunctionExpression2_es6.js]
|
||||
var v = function foo() {
|
||||
};
|
||||
@@ -0,0 +1,6 @@
|
||||
//// [FunctionPropertyAssignments1_es6.ts]
|
||||
var v = { *foo() { } }
|
||||
|
||||
//// [FunctionPropertyAssignments1_es6.js]
|
||||
var v = { foo: function () {
|
||||
} };
|
||||
@@ -0,0 +1,6 @@
|
||||
//// [FunctionPropertyAssignments2_es6.ts]
|
||||
var v = { *() { } }
|
||||
|
||||
//// [FunctionPropertyAssignments2_es6.js]
|
||||
var v = { : function () {
|
||||
} };
|
||||
@@ -0,0 +1,6 @@
|
||||
//// [FunctionPropertyAssignments3_es6.ts]
|
||||
var v = { *{ } }
|
||||
|
||||
//// [FunctionPropertyAssignments3_es6.js]
|
||||
var v = { : function () {
|
||||
} };
|
||||
@@ -0,0 +1,6 @@
|
||||
//// [FunctionPropertyAssignments4_es6.ts]
|
||||
var v = { * }
|
||||
|
||||
//// [FunctionPropertyAssignments4_es6.js]
|
||||
var v = { : function () {
|
||||
} };
|
||||
@@ -1,7 +1,13 @@
|
||||
tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,12): error TS9002: Computed property names are not currently supported.
|
||||
tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,11): error TS9001: Generators are not currently supported.
|
||||
tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,13): error TS2304: Cannot find name 'foo'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts (1 errors) ====
|
||||
==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts (3 errors) ====
|
||||
var v = { *[foo()]() { } }
|
||||
~
|
||||
!!! error TS9001: Generators are not currently supported.
|
||||
~~~~~~~
|
||||
!!! error TS9002: Computed property names are not currently supported.
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'foo'.
|
||||
@@ -0,0 +1,6 @@
|
||||
//// [FunctionPropertyAssignments5_es6.ts]
|
||||
var v = { *[foo()]() { } }
|
||||
|
||||
//// [FunctionPropertyAssignments5_es6.js]
|
||||
var v = { [foo()]: function () {
|
||||
} };
|
||||
@@ -0,0 +1,6 @@
|
||||
//// [FunctionPropertyAssignments6_es6.ts]
|
||||
var v = { *<T>() { } }
|
||||
|
||||
//// [FunctionPropertyAssignments6_es6.js]
|
||||
var v = { : function () {
|
||||
} };
|
||||
@@ -0,0 +1,17 @@
|
||||
//// [MemberAccessorDeclaration15.ts]
|
||||
class C {
|
||||
set Foo(public a: number) { }
|
||||
}
|
||||
|
||||
//// [MemberAccessorDeclaration15.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
Object.defineProperty(C.prototype, "Foo", {
|
||||
set: function (a) {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,13 @@
|
||||
//// [MemberFunctionDeclaration1_es6.ts]
|
||||
class C {
|
||||
*foo() { }
|
||||
}
|
||||
|
||||
//// [MemberFunctionDeclaration1_es6.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.foo = function () {
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,13 @@
|
||||
//// [MemberFunctionDeclaration2_es6.ts]
|
||||
class C {
|
||||
public * foo() { }
|
||||
}
|
||||
|
||||
//// [MemberFunctionDeclaration2_es6.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.foo = function () {
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
@@ -1,9 +1,12 @@
|
||||
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration3_es6.ts(2,4): error TS9001: Generators are not currently supported.
|
||||
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration3_es6.ts(2,6): error TS2304: Cannot find name 'foo'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration3_es6.ts (1 errors) ====
|
||||
==== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration3_es6.ts (2 errors) ====
|
||||
class C {
|
||||
*[foo]() { }
|
||||
~
|
||||
!!! error TS9001: Generators are not currently supported.
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'foo'.
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
//// [MemberFunctionDeclaration3_es6.ts]
|
||||
class C {
|
||||
*[foo]() { }
|
||||
}
|
||||
|
||||
//// [MemberFunctionDeclaration3_es6.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype[foo] = function () {
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,13 @@
|
||||
//// [MemberFunctionDeclaration4_es6.ts]
|
||||
class C {
|
||||
*() { }
|
||||
}
|
||||
|
||||
//// [MemberFunctionDeclaration4_es6.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype. = function () {
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,11 @@
|
||||
//// [MemberFunctionDeclaration5_es6.ts]
|
||||
class C {
|
||||
*
|
||||
}
|
||||
|
||||
//// [MemberFunctionDeclaration5_es6.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,11 @@
|
||||
//// [MemberFunctionDeclaration6_es6.ts]
|
||||
class C {
|
||||
*foo
|
||||
}
|
||||
|
||||
//// [MemberFunctionDeclaration6_es6.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,13 @@
|
||||
//// [MemberFunctionDeclaration7_es6.ts]
|
||||
class C {
|
||||
*foo<T>() { }
|
||||
}
|
||||
|
||||
//// [MemberFunctionDeclaration7_es6.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.foo = function () {
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,22 @@
|
||||
//// [MemberFunctionDeclaration8_es6.ts]
|
||||
class C {
|
||||
foo() {
|
||||
// Make sure we don't think of *bar as the start of a generator method.
|
||||
if (a) # * bar;
|
||||
return bar;
|
||||
}
|
||||
}
|
||||
|
||||
//// [MemberFunctionDeclaration8_es6.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.foo = function () {
|
||||
// Make sure we don't think of *bar as the start of a generator method.
|
||||
if (a)
|
||||
;
|
||||
* bar;
|
||||
return bar;
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,10 @@
|
||||
//// [Protected1.ts]
|
||||
protected class C {
|
||||
}
|
||||
|
||||
//// [Protected1.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [Protected2.ts]
|
||||
protected module M {
|
||||
}
|
||||
|
||||
//// [Protected2.js]
|
||||
@@ -0,0 +1,11 @@
|
||||
//// [Protected3.ts]
|
||||
class C {
|
||||
protected constructor() { }
|
||||
}
|
||||
|
||||
//// [Protected3.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,13 @@
|
||||
//// [Protected4.ts]
|
||||
class C {
|
||||
protected public m() { }
|
||||
}
|
||||
|
||||
//// [Protected4.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.m = function () {
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,13 @@
|
||||
//// [Protected6.ts]
|
||||
class C {
|
||||
static protected m() { }
|
||||
}
|
||||
|
||||
//// [Protected6.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.m = function () {
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,13 @@
|
||||
//// [Protected7.ts]
|
||||
class C {
|
||||
protected private m() { }
|
||||
}
|
||||
|
||||
//// [Protected7.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.m = function () {
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [TemplateExpression1.ts]
|
||||
var v = `foo ${ a
|
||||
|
||||
//// [TemplateExpression1.js]
|
||||
var v = "foo " + a;
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [TupleType3.ts]
|
||||
var v: []
|
||||
|
||||
//// [TupleType3.js]
|
||||
var v;
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [TupleType4.ts]
|
||||
var v: [
|
||||
|
||||
//// [TupleType4.js]
|
||||
var v;
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [TupleType5.ts]
|
||||
var v: [number,]
|
||||
|
||||
//// [TupleType5.js]
|
||||
var v;
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
//// [tests/cases/conformance/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName.ts] ////
|
||||
|
||||
//// [part1.ts]
|
||||
export module A {
|
||||
export interface Point {
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
|
||||
export module Utils {
|
||||
export function mirror<T extends Point>(p: T) {
|
||||
return { x: p.y, y: p.x };
|
||||
}
|
||||
}
|
||||
|
||||
export var Origin: Point = { x: 0, y: 0 };
|
||||
}
|
||||
|
||||
//// [part2.ts]
|
||||
export module A {
|
||||
// collision with 'Origin' var in other part of merged module
|
||||
export var Origin: Point = { x: 0, y: 0 };
|
||||
|
||||
export module Utils {
|
||||
export class Plane {
|
||||
constructor(public tl: Point, public br: Point) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//// [part1.js]
|
||||
var A;
|
||||
(function (A) {
|
||||
var Utils;
|
||||
(function (Utils) {
|
||||
function mirror(p) {
|
||||
return { x: p.y, y: p.x };
|
||||
}
|
||||
Utils.mirror = mirror;
|
||||
})(Utils = A.Utils || (A.Utils = {}));
|
||||
A.Origin = { x: 0, y: 0 };
|
||||
})(A = exports.A || (exports.A = {}));
|
||||
//// [part2.js]
|
||||
var A;
|
||||
(function (A) {
|
||||
// collision with 'Origin' var in other part of merged module
|
||||
A.Origin = { x: 0, y: 0 };
|
||||
var Utils;
|
||||
(function (Utils) {
|
||||
var Plane = (function () {
|
||||
function Plane(tl, br) {
|
||||
this.tl = tl;
|
||||
this.br = br;
|
||||
}
|
||||
return Plane;
|
||||
})();
|
||||
Utils.Plane = Plane;
|
||||
})(Utils = A.Utils || (A.Utils = {}));
|
||||
})(A = exports.A || (exports.A = {}));
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [TypeArgumentList1.ts]
|
||||
Foo<A,B,\ C>(4, 5, 6);
|
||||
|
||||
//// [TypeArgumentList1.js]
|
||||
Foo(4, 5, 6);
|
||||
@@ -0,0 +1,77 @@
|
||||
//// [TypeGuardWithEnumUnion.ts]
|
||||
enum Color { R, G, B }
|
||||
|
||||
function f1(x: Color | string) {
|
||||
if (typeof x === "number") {
|
||||
var y = x;
|
||||
var y: Color;
|
||||
}
|
||||
else {
|
||||
var z = x;
|
||||
var z: string;
|
||||
}
|
||||
}
|
||||
|
||||
function f2(x: Color | string | string[]) {
|
||||
if (typeof x === "object") {
|
||||
var y = x;
|
||||
var y: string[];
|
||||
}
|
||||
if (typeof x === "number") {
|
||||
var z = x;
|
||||
var z: Color;
|
||||
}
|
||||
else {
|
||||
var w = x;
|
||||
var w: string | string[];
|
||||
}
|
||||
if (typeof x === "string") {
|
||||
var a = x;
|
||||
var a: string;
|
||||
}
|
||||
else {
|
||||
var b = x;
|
||||
var b: Color | string[];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//// [TypeGuardWithEnumUnion.js]
|
||||
var Color;
|
||||
(function (Color) {
|
||||
Color[Color["R"] = 0] = "R";
|
||||
Color[Color["G"] = 1] = "G";
|
||||
Color[Color["B"] = 2] = "B";
|
||||
})(Color || (Color = {}));
|
||||
function f1(x) {
|
||||
if (typeof x === "number") {
|
||||
var y = x;
|
||||
var y;
|
||||
}
|
||||
else {
|
||||
var z = x;
|
||||
var z;
|
||||
}
|
||||
}
|
||||
function f2(x) {
|
||||
if (typeof x === "object") {
|
||||
var y = x;
|
||||
var y;
|
||||
}
|
||||
if (typeof x === "number") {
|
||||
var z = x;
|
||||
var z;
|
||||
}
|
||||
else {
|
||||
var w = x;
|
||||
var w;
|
||||
}
|
||||
if (typeof x === "string") {
|
||||
var a = x;
|
||||
var a;
|
||||
}
|
||||
else {
|
||||
var b = x;
|
||||
var b;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
=== tests/cases/conformance/expressions/typeGuards/TypeGuardWithEnumUnion.ts ===
|
||||
enum Color { R, G, B }
|
||||
>Color : Color
|
||||
>R : Color
|
||||
>G : Color
|
||||
>B : Color
|
||||
|
||||
function f1(x: Color | string) {
|
||||
>f1 : (x: string | Color) => void
|
||||
>x : string | Color
|
||||
>Color : Color
|
||||
|
||||
if (typeof x === "number") {
|
||||
>typeof x === "number" : boolean
|
||||
>typeof x : string
|
||||
>x : string | Color
|
||||
|
||||
var y = x;
|
||||
>y : Color
|
||||
>x : Color
|
||||
|
||||
var y: Color;
|
||||
>y : Color
|
||||
>Color : Color
|
||||
}
|
||||
else {
|
||||
var z = x;
|
||||
>z : string
|
||||
>x : string
|
||||
|
||||
var z: string;
|
||||
>z : string
|
||||
}
|
||||
}
|
||||
|
||||
function f2(x: Color | string | string[]) {
|
||||
>f2 : (x: string | string[] | Color) => void
|
||||
>x : string | string[] | Color
|
||||
>Color : Color
|
||||
|
||||
if (typeof x === "object") {
|
||||
>typeof x === "object" : boolean
|
||||
>typeof x : string
|
||||
>x : string | string[] | Color
|
||||
|
||||
var y = x;
|
||||
>y : string[]
|
||||
>x : string[]
|
||||
|
||||
var y: string[];
|
||||
>y : string[]
|
||||
}
|
||||
if (typeof x === "number") {
|
||||
>typeof x === "number" : boolean
|
||||
>typeof x : string
|
||||
>x : string | string[] | Color
|
||||
|
||||
var z = x;
|
||||
>z : Color
|
||||
>x : Color
|
||||
|
||||
var z: Color;
|
||||
>z : Color
|
||||
>Color : Color
|
||||
}
|
||||
else {
|
||||
var w = x;
|
||||
>w : string | string[]
|
||||
>x : string | string[]
|
||||
|
||||
var w: string | string[];
|
||||
>w : string | string[]
|
||||
}
|
||||
if (typeof x === "string") {
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>x : string | string[] | Color
|
||||
|
||||
var a = x;
|
||||
>a : string
|
||||
>x : string
|
||||
|
||||
var a: string;
|
||||
>a : string
|
||||
}
|
||||
else {
|
||||
var b = x;
|
||||
>b : string[] | Color
|
||||
>x : string[] | Color
|
||||
|
||||
var b: Color | string[];
|
||||
>b : string[] | Color
|
||||
>Color : Color
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user