mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' into refactorGrammarCheck
Conflicts: src/compiler/diagnosticInformationMap.generated.ts src/compiler/diagnosticMessages.json src/compiler/parser.ts src/compiler/types.ts tests/baselines/reference/YieldExpression8_es6.errors.txt tests/baselines/reference/ambientErrors.errors.txt tests/baselines/reference/giant.errors.txt
This commit is contained in:
@@ -35,6 +35,7 @@ var compilerSources = [
|
||||
"types.ts",
|
||||
"scanner.ts",
|
||||
"parser.ts",
|
||||
"utilities.ts",
|
||||
"binder.ts",
|
||||
"checker.ts",
|
||||
"emitter.ts",
|
||||
@@ -47,26 +48,60 @@ var compilerSources = [
|
||||
|
||||
var servicesSources = [
|
||||
"core.ts",
|
||||
"sys.ts",
|
||||
"types.ts",
|
||||
"scanner.ts",
|
||||
"parser.ts",
|
||||
"utilities.ts",
|
||||
"binder.ts",
|
||||
"checker.ts",
|
||||
"emitter.ts"
|
||||
"emitter.ts",
|
||||
"diagnosticInformationMap.generated.ts"
|
||||
].map(function (f) {
|
||||
return path.join(compilerDirectory, f);
|
||||
}).concat([
|
||||
"breakpoints.ts",
|
||||
"navigationBar.ts",
|
||||
"outliningElementsCollector.ts",
|
||||
"services.ts",
|
||||
"shims.ts",
|
||||
"signatureHelp.ts",
|
||||
"utilities.ts",
|
||||
"navigationBar.ts",
|
||||
"outliningElementsCollector.ts"
|
||||
"formatting/formatting.ts",
|
||||
"formatting/formattingContext.ts",
|
||||
"formatting/formattingRequestKind.ts",
|
||||
"formatting/formattingScanner.ts",
|
||||
"formatting/references.ts",
|
||||
"formatting/rule.ts",
|
||||
"formatting/ruleAction.ts",
|
||||
"formatting/ruleDescriptor.ts",
|
||||
"formatting/ruleFlag.ts",
|
||||
"formatting/ruleOperation.ts",
|
||||
"formatting/ruleOperationContext.ts",
|
||||
"formatting/rules.ts",
|
||||
"formatting/rulesMap.ts",
|
||||
"formatting/rulesProvider.ts",
|
||||
"formatting/smartIndenter.ts",
|
||||
"formatting/tokenRange.ts"
|
||||
].map(function (f) {
|
||||
return path.join(servicesDirectory, f);
|
||||
}));
|
||||
|
||||
var definitionsRoots = [
|
||||
"compiler/types.d.ts",
|
||||
"compiler/scanner.d.ts",
|
||||
"compiler/parser.d.ts",
|
||||
"compiler/checker.d.ts",
|
||||
"services/services.d.ts",
|
||||
];
|
||||
|
||||
var internalDefinitionsRoots = [
|
||||
"compiler/core.d.ts",
|
||||
"compiler/sys.d.ts",
|
||||
"compiler/utilities.d.ts",
|
||||
"services/utilities.d.ts",
|
||||
];
|
||||
|
||||
var harnessSources = [
|
||||
"harness.ts",
|
||||
"sourceMapRecorder.ts",
|
||||
@@ -84,6 +119,7 @@ var harnessSources = [
|
||||
].map(function (f) {
|
||||
return path.join(harnessDirectory, f);
|
||||
}).concat([
|
||||
"incrementalParser.ts",
|
||||
"services/colorization.ts",
|
||||
"services/documentRegistry.ts",
|
||||
"services/preProcessFile.ts"
|
||||
@@ -148,25 +184,48 @@ var compilerFilename = "tsc.js";
|
||||
* @param prefixes: a list of files to prepend to the target file
|
||||
* @param useBuiltCompiler: true to use the built compiler, false to use the LKG
|
||||
* @param noOutFile: true to compile without using --out
|
||||
* @param generateDeclarations: true to compile using --declaration
|
||||
* @param outDir: true to compile using --outDir
|
||||
* @param keepComments: false to compile using --removeComments
|
||||
* @param callback: a function to execute after the compilation process ends
|
||||
*/
|
||||
function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOutFile, generateDeclarations, callback) {
|
||||
function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOutFile, generateDeclarations, outDir, keepComments, noResolve, callback) {
|
||||
file(outFile, prereqs, function() {
|
||||
var dir = useBuiltCompiler ? builtLocalDirectory : LKGDirectory;
|
||||
var options = "-removeComments --module commonjs -noImplicitAny ";
|
||||
var options = "--module commonjs -noImplicitAny";
|
||||
|
||||
if (!keepComments) {
|
||||
options += " -removeComments";
|
||||
}
|
||||
|
||||
if (generateDeclarations) {
|
||||
options += "--declaration ";
|
||||
options += " --declaration";
|
||||
}
|
||||
|
||||
if (useDebugMode) {
|
||||
options += "--preserveConstEnums ";
|
||||
options += " --preserveConstEnums";
|
||||
}
|
||||
|
||||
if (outDir) {
|
||||
options += " --outDir " + outDir;
|
||||
}
|
||||
|
||||
if (!noOutFile) {
|
||||
options += " --out " + outFile;
|
||||
}
|
||||
|
||||
if(noResolve) {
|
||||
options += " --noResolve";
|
||||
}
|
||||
|
||||
if (useDebugMode) {
|
||||
options += " -sourcemap -mapRoot file:///" + path.resolve(path.dirname(outFile));
|
||||
}
|
||||
|
||||
var cmd = host + " " + dir + compilerFilename + " " + options + " ";
|
||||
cmd = cmd + sources.join(" ") + (!noOutFile ? " -out " + outFile : "");
|
||||
if (useDebugMode) {
|
||||
cmd = cmd + " -sourcemap -mapRoot file:///" + path.resolve(path.dirname(outFile));
|
||||
}
|
||||
cmd = cmd + sources.join(" ");
|
||||
console.log(cmd + "\n");
|
||||
|
||||
var ex = jake.createExec([cmd]);
|
||||
// Add listeners for output and error
|
||||
ex.addListener("stdout", function(output) {
|
||||
@@ -190,7 +249,7 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOu
|
||||
});
|
||||
ex.addListener("error", function() {
|
||||
fs.unlinkSync(outFile);
|
||||
console.log("Compilation of " + outFile + " unsuccessful");
|
||||
fail("Compilation of " + outFile + " unsuccessful");
|
||||
});
|
||||
ex.run();
|
||||
}, {async: true});
|
||||
@@ -259,24 +318,49 @@ var tscFile = path.join(builtLocalDirectory, compilerFilename);
|
||||
compileFile(tscFile, compilerSources, [builtLocalDirectory, copyright].concat(compilerSources), [copyright], /*useBuiltCompiler:*/ false);
|
||||
|
||||
var servicesFile = path.join(builtLocalDirectory, "typescriptServices.js");
|
||||
var servicesDefinitionsFile = path.join(builtLocalDirectory, "typescriptServices.d.ts");
|
||||
compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].concat(servicesSources), [copyright], /*useBuiltCompiler*/ true);
|
||||
|
||||
compileFile(servicesFile,
|
||||
servicesSources,
|
||||
[builtLocalDirectory, copyright].concat(servicesSources),
|
||||
[copyright],
|
||||
var nodeDefinitionsFile = path.join(builtLocalDirectory, "typescript.d.ts");
|
||||
var standaloneDefinitionsFile = path.join(builtLocalDirectory, "typescriptServices.d.ts");
|
||||
var internalNodeDefinitionsFile = path.join(builtLocalDirectory, "typescript_internal.d.ts");
|
||||
var internalStandaloneDefinitionsFile = path.join(builtLocalDirectory, "typescriptServices_internal.d.ts");
|
||||
var tempDirPath = path.join(builtLocalDirectory, "temptempdir");
|
||||
compileFile(nodeDefinitionsFile, servicesSources,[builtLocalDirectory, copyright].concat(servicesSources),
|
||||
/*prefixes*/ undefined,
|
||||
/*useBuiltCompiler*/ true,
|
||||
/*noOutFile*/ false,
|
||||
/*noOutFile*/ true,
|
||||
/*generateDeclarations*/ true,
|
||||
/*callback*/ fixDeclarationFile);
|
||||
/*outDir*/ tempDirPath,
|
||||
/*keepComments*/ true,
|
||||
/*noResolve*/ true,
|
||||
/*callback*/ function () {
|
||||
function makeDefinitionFiles(definitionsRoots, standaloneDefinitionsFile, nodeDefinitionsFile) {
|
||||
// Create the standalone definition file
|
||||
concatenateFiles(standaloneDefinitionsFile, definitionsRoots.map(function (f) {
|
||||
return path.join(tempDirPath, f);
|
||||
}));
|
||||
prependFile(copyright, standaloneDefinitionsFile);
|
||||
|
||||
function fixDeclarationFile() {
|
||||
fs.appendFileSync(servicesDefinitionsFile, os.EOL + "export = ts;")
|
||||
}
|
||||
// Create the node definition file by replacing 'ts' module with '"typescript"' as a module.
|
||||
jake.cpR(standaloneDefinitionsFile, nodeDefinitionsFile, {silent: true});
|
||||
var definitionFileContents = fs.readFileSync(nodeDefinitionsFile).toString();
|
||||
definitionFileContents = definitionFileContents.replace(/declare module ts/g, 'declare module "typescript"');
|
||||
fs.writeFileSync(nodeDefinitionsFile, definitionFileContents);
|
||||
}
|
||||
|
||||
// Create the public definition files
|
||||
makeDefinitionFiles(definitionsRoots, standaloneDefinitionsFile, nodeDefinitionsFile);
|
||||
|
||||
// Create the internal definition files
|
||||
makeDefinitionFiles(internalDefinitionsRoots, internalStandaloneDefinitionsFile, internalNodeDefinitionsFile);
|
||||
|
||||
// Delete the temp dir
|
||||
jake.rmRf(tempDirPath, {silent: true});
|
||||
});
|
||||
|
||||
// Local target to build the compiler and services
|
||||
desc("Builds the full compiler and services");
|
||||
task("local", ["generate-diagnostics", "lib", tscFile, servicesFile]);
|
||||
task("local", ["generate-diagnostics", "lib", tscFile, servicesFile, nodeDefinitionsFile]);
|
||||
|
||||
// Local target to build the compiler and services
|
||||
desc("Sets release mode flag");
|
||||
@@ -327,7 +411,7 @@ task("generate-spec", [specMd])
|
||||
// Makes a new LKG. This target does not build anything, but errors if not all the outputs are present in the built/local directory
|
||||
desc("Makes a new LKG out of the built js files");
|
||||
task("LKG", ["clean", "release", "local"].concat(libraryTargets), function() {
|
||||
var expectedFiles = [tscFile, servicesFile, servicesDefinitionsFile].concat(libraryTargets);
|
||||
var expectedFiles = [tscFile, servicesFile, nodeDefinitionsFile, standaloneDefinitionsFile, internalNodeDefinitionsFile, internalStandaloneDefinitionsFile].concat(libraryTargets);
|
||||
var missingFiles = expectedFiles.filter(function (f) {
|
||||
return !fs.existsSync(f);
|
||||
});
|
||||
@@ -381,15 +465,10 @@ function exec(cmd, completeHandler) {
|
||||
complete();
|
||||
});
|
||||
ex.addListener("error", function(e, status) {
|
||||
process.stderr.write(status);
|
||||
process.stderr.write(e);
|
||||
complete();
|
||||
fail("Process exited with code " + status);
|
||||
})
|
||||
try{
|
||||
ex.run();
|
||||
} catch(e) {
|
||||
console.log('Exception: ' + e)
|
||||
}
|
||||
|
||||
ex.run();
|
||||
}
|
||||
|
||||
function cleanTestDirs() {
|
||||
@@ -419,7 +498,7 @@ function deleteTemporaryProjectOutput() {
|
||||
}
|
||||
}
|
||||
|
||||
var testTimeout = 5000;
|
||||
var testTimeout = 20000;
|
||||
desc("Runs the tests using the built run.js file. Syntax is jake runtests. Optional parameters 'host=', 'tests=[regex], reporter=[list|spec|json|<more>]'.");
|
||||
task("runtests", ["tests", builtLocalDirectory], function() {
|
||||
cleanTestDirs();
|
||||
|
||||
Vendored
+66
-23
@@ -124,10 +124,7 @@ interface Object {
|
||||
propertyIsEnumerable(v: string): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides functionality common to all JavaScript objects.
|
||||
*/
|
||||
declare var Object: {
|
||||
interface ObjectConstructor {
|
||||
new (value?: any): Object;
|
||||
(): any;
|
||||
(value: any): any;
|
||||
@@ -221,6 +218,11 @@ declare var Object: {
|
||||
keys(o: any): string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides functionality common to all JavaScript objects.
|
||||
*/
|
||||
declare var Object: ObjectConstructor;
|
||||
|
||||
/**
|
||||
* Creates a new function.
|
||||
*/
|
||||
@@ -255,8 +257,8 @@ interface Function {
|
||||
caller: Function;
|
||||
}
|
||||
|
||||
declare var Function: {
|
||||
/**
|
||||
interface FunctionConstructor {
|
||||
/**
|
||||
* Creates a new function.
|
||||
* @param args A list of arguments the function accepts.
|
||||
*/
|
||||
@@ -265,6 +267,8 @@ declare var Function: {
|
||||
prototype: Function;
|
||||
}
|
||||
|
||||
declare var Function: FunctionConstructor;
|
||||
|
||||
interface IArguments {
|
||||
[index: number]: any;
|
||||
length: number;
|
||||
@@ -424,24 +428,31 @@ interface String {
|
||||
[index: number]: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows manipulation and formatting of text strings and determination and location of substrings within strings.
|
||||
*/
|
||||
declare var String: {
|
||||
interface StringConstructor {
|
||||
new (value?: any): String;
|
||||
(value?: any): string;
|
||||
prototype: String;
|
||||
fromCharCode(...codes: number[]): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows manipulation and formatting of text strings and determination and location of substrings within strings.
|
||||
*/
|
||||
declare var String: StringConstructor;
|
||||
|
||||
interface Boolean {
|
||||
/** Returns the primitive value of the specified object. */
|
||||
valueOf(): boolean;
|
||||
}
|
||||
declare var Boolean: {
|
||||
|
||||
interface BooleanConstructor {
|
||||
new (value?: any): Boolean;
|
||||
(value?: any): boolean;
|
||||
prototype: Boolean;
|
||||
}
|
||||
|
||||
declare var Boolean: BooleanConstructor;
|
||||
|
||||
interface Number {
|
||||
/**
|
||||
* Returns a string representation of an object.
|
||||
@@ -468,8 +479,7 @@ interface Number {
|
||||
toPrecision(precision?: number): string;
|
||||
}
|
||||
|
||||
/** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */
|
||||
declare var Number: {
|
||||
interface NumberConstructor {
|
||||
new (value?: any): Number;
|
||||
(value?: any): number;
|
||||
prototype: Number;
|
||||
@@ -499,6 +509,9 @@ declare var Number: {
|
||||
POSITIVE_INFINITY: number;
|
||||
}
|
||||
|
||||
/** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */
|
||||
declare var Number: NumberConstructor;
|
||||
|
||||
interface TemplateStringsArray extends Array<string> {
|
||||
raw: string[];
|
||||
}
|
||||
@@ -768,7 +781,7 @@ interface Date {
|
||||
toJSON(key?: any): string;
|
||||
}
|
||||
|
||||
declare var Date: {
|
||||
interface DateConstructor {
|
||||
new (): Date;
|
||||
new (value: number): Date;
|
||||
new (value: string): Date;
|
||||
@@ -794,6 +807,8 @@ declare var Date: {
|
||||
now(): number;
|
||||
}
|
||||
|
||||
declare var Date: DateConstructor;
|
||||
|
||||
interface RegExpMatchArray extends Array<string> {
|
||||
index?: number;
|
||||
input?: string;
|
||||
@@ -834,9 +849,11 @@ interface RegExp {
|
||||
// Non-standard extensions
|
||||
compile(): RegExp;
|
||||
}
|
||||
declare var RegExp: {
|
||||
|
||||
interface RegExpConstructor {
|
||||
new (pattern: string, flags?: string): RegExp;
|
||||
(pattern: string, flags?: string): RegExp;
|
||||
prototype: RegExp;
|
||||
|
||||
// Non-standard extensions
|
||||
$1: string;
|
||||
@@ -851,64 +868,87 @@ declare var RegExp: {
|
||||
lastMatch: string;
|
||||
}
|
||||
|
||||
declare var RegExp: RegExpConstructor;
|
||||
|
||||
interface Error {
|
||||
name: string;
|
||||
message: string;
|
||||
}
|
||||
declare var Error: {
|
||||
|
||||
interface ErrorConstructor {
|
||||
new (message?: string): Error;
|
||||
(message?: string): Error;
|
||||
prototype: Error;
|
||||
}
|
||||
|
||||
declare var Error: ErrorConstructor;
|
||||
|
||||
interface EvalError extends Error {
|
||||
}
|
||||
declare var EvalError: {
|
||||
|
||||
interface EvalErrorConstructor {
|
||||
new (message?: string): EvalError;
|
||||
(message?: string): EvalError;
|
||||
prototype: EvalError;
|
||||
}
|
||||
|
||||
declare var EvalError: EvalErrorConstructor;
|
||||
|
||||
interface RangeError extends Error {
|
||||
}
|
||||
declare var RangeError: {
|
||||
|
||||
interface RangeErrorConstructor {
|
||||
new (message?: string): RangeError;
|
||||
(message?: string): RangeError;
|
||||
prototype: RangeError;
|
||||
}
|
||||
|
||||
declare var RangeError: RangeErrorConstructor;
|
||||
|
||||
interface ReferenceError extends Error {
|
||||
}
|
||||
declare var ReferenceError: {
|
||||
|
||||
interface ReferenceErrorConstructor {
|
||||
new (message?: string): ReferenceError;
|
||||
(message?: string): ReferenceError;
|
||||
prototype: ReferenceError;
|
||||
}
|
||||
|
||||
declare var ReferenceError: ReferenceErrorConstructor;
|
||||
|
||||
interface SyntaxError extends Error {
|
||||
}
|
||||
declare var SyntaxError: {
|
||||
|
||||
interface SyntaxErrorConstructor {
|
||||
new (message?: string): SyntaxError;
|
||||
(message?: string): SyntaxError;
|
||||
prototype: SyntaxError;
|
||||
}
|
||||
|
||||
declare var SyntaxError: SyntaxErrorConstructor;
|
||||
|
||||
interface TypeError extends Error {
|
||||
}
|
||||
declare var TypeError: {
|
||||
|
||||
interface TypeErrorConstructor {
|
||||
new (message?: string): TypeError;
|
||||
(message?: string): TypeError;
|
||||
prototype: TypeError;
|
||||
}
|
||||
|
||||
declare var TypeError: TypeErrorConstructor;
|
||||
|
||||
interface URIError extends Error {
|
||||
}
|
||||
declare var URIError: {
|
||||
|
||||
interface URIErrorConstructor {
|
||||
new (message?: string): URIError;
|
||||
(message?: string): URIError;
|
||||
prototype: URIError;
|
||||
}
|
||||
|
||||
declare var URIError: URIErrorConstructor;
|
||||
|
||||
interface JSON {
|
||||
/**
|
||||
* Converts a JavaScript Object Notation (JSON) string into an object.
|
||||
@@ -1111,7 +1151,8 @@ interface Array<T> {
|
||||
|
||||
[n: number]: T;
|
||||
}
|
||||
declare var Array: {
|
||||
|
||||
interface ArrayConstructor {
|
||||
new (arrayLength?: number): any[];
|
||||
new <T>(arrayLength: number): T[];
|
||||
new <T>(...items: T[]): T[];
|
||||
@@ -1121,3 +1162,5 @@ declare var Array: {
|
||||
isArray(arg: any): boolean;
|
||||
prototype: Array<any>;
|
||||
}
|
||||
|
||||
declare var Array: ArrayConstructor;
|
||||
|
||||
Vendored
+4803
File diff suppressed because it is too large
Load Diff
Vendored
+73
-25
@@ -124,10 +124,7 @@ interface Object {
|
||||
propertyIsEnumerable(v: string): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides functionality common to all JavaScript objects.
|
||||
*/
|
||||
declare var Object: {
|
||||
interface ObjectConstructor {
|
||||
new (value?: any): Object;
|
||||
(): any;
|
||||
(value: any): any;
|
||||
@@ -221,6 +218,11 @@ declare var Object: {
|
||||
keys(o: any): string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides functionality common to all JavaScript objects.
|
||||
*/
|
||||
declare var Object: ObjectConstructor;
|
||||
|
||||
/**
|
||||
* Creates a new function.
|
||||
*/
|
||||
@@ -255,8 +257,8 @@ interface Function {
|
||||
caller: Function;
|
||||
}
|
||||
|
||||
declare var Function: {
|
||||
/**
|
||||
interface FunctionConstructor {
|
||||
/**
|
||||
* Creates a new function.
|
||||
* @param args A list of arguments the function accepts.
|
||||
*/
|
||||
@@ -265,6 +267,8 @@ declare var Function: {
|
||||
prototype: Function;
|
||||
}
|
||||
|
||||
declare var Function: FunctionConstructor;
|
||||
|
||||
interface IArguments {
|
||||
[index: number]: any;
|
||||
length: number;
|
||||
@@ -424,24 +428,31 @@ interface String {
|
||||
[index: number]: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows manipulation and formatting of text strings and determination and location of substrings within strings.
|
||||
*/
|
||||
declare var String: {
|
||||
interface StringConstructor {
|
||||
new (value?: any): String;
|
||||
(value?: any): string;
|
||||
prototype: String;
|
||||
fromCharCode(...codes: number[]): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows manipulation and formatting of text strings and determination and location of substrings within strings.
|
||||
*/
|
||||
declare var String: StringConstructor;
|
||||
|
||||
interface Boolean {
|
||||
/** Returns the primitive value of the specified object. */
|
||||
valueOf(): boolean;
|
||||
}
|
||||
declare var Boolean: {
|
||||
|
||||
interface BooleanConstructor {
|
||||
new (value?: any): Boolean;
|
||||
(value?: any): boolean;
|
||||
prototype: Boolean;
|
||||
}
|
||||
|
||||
declare var Boolean: BooleanConstructor;
|
||||
|
||||
interface Number {
|
||||
/**
|
||||
* Returns a string representation of an object.
|
||||
@@ -468,8 +479,7 @@ interface Number {
|
||||
toPrecision(precision?: number): string;
|
||||
}
|
||||
|
||||
/** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */
|
||||
declare var Number: {
|
||||
interface NumberConstructor {
|
||||
new (value?: any): Number;
|
||||
(value?: any): number;
|
||||
prototype: Number;
|
||||
@@ -499,6 +509,9 @@ declare var Number: {
|
||||
POSITIVE_INFINITY: number;
|
||||
}
|
||||
|
||||
/** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */
|
||||
declare var Number: NumberConstructor;
|
||||
|
||||
interface TemplateStringsArray extends Array<string> {
|
||||
raw: string[];
|
||||
}
|
||||
@@ -768,7 +781,7 @@ interface Date {
|
||||
toJSON(key?: any): string;
|
||||
}
|
||||
|
||||
declare var Date: {
|
||||
interface DateConstructor {
|
||||
new (): Date;
|
||||
new (value: number): Date;
|
||||
new (value: string): Date;
|
||||
@@ -794,6 +807,8 @@ declare var Date: {
|
||||
now(): number;
|
||||
}
|
||||
|
||||
declare var Date: DateConstructor;
|
||||
|
||||
interface RegExpMatchArray extends Array<string> {
|
||||
index?: number;
|
||||
input?: string;
|
||||
@@ -834,9 +849,11 @@ interface RegExp {
|
||||
// Non-standard extensions
|
||||
compile(): RegExp;
|
||||
}
|
||||
declare var RegExp: {
|
||||
|
||||
interface RegExpConstructor {
|
||||
new (pattern: string, flags?: string): RegExp;
|
||||
(pattern: string, flags?: string): RegExp;
|
||||
prototype: RegExp;
|
||||
|
||||
// Non-standard extensions
|
||||
$1: string;
|
||||
@@ -851,64 +868,87 @@ declare var RegExp: {
|
||||
lastMatch: string;
|
||||
}
|
||||
|
||||
declare var RegExp: RegExpConstructor;
|
||||
|
||||
interface Error {
|
||||
name: string;
|
||||
message: string;
|
||||
}
|
||||
declare var Error: {
|
||||
|
||||
interface ErrorConstructor {
|
||||
new (message?: string): Error;
|
||||
(message?: string): Error;
|
||||
prototype: Error;
|
||||
}
|
||||
|
||||
declare var Error: ErrorConstructor;
|
||||
|
||||
interface EvalError extends Error {
|
||||
}
|
||||
declare var EvalError: {
|
||||
|
||||
interface EvalErrorConstructor {
|
||||
new (message?: string): EvalError;
|
||||
(message?: string): EvalError;
|
||||
prototype: EvalError;
|
||||
}
|
||||
|
||||
declare var EvalError: EvalErrorConstructor;
|
||||
|
||||
interface RangeError extends Error {
|
||||
}
|
||||
declare var RangeError: {
|
||||
|
||||
interface RangeErrorConstructor {
|
||||
new (message?: string): RangeError;
|
||||
(message?: string): RangeError;
|
||||
prototype: RangeError;
|
||||
}
|
||||
|
||||
declare var RangeError: RangeErrorConstructor;
|
||||
|
||||
interface ReferenceError extends Error {
|
||||
}
|
||||
declare var ReferenceError: {
|
||||
|
||||
interface ReferenceErrorConstructor {
|
||||
new (message?: string): ReferenceError;
|
||||
(message?: string): ReferenceError;
|
||||
prototype: ReferenceError;
|
||||
}
|
||||
|
||||
declare var ReferenceError: ReferenceErrorConstructor;
|
||||
|
||||
interface SyntaxError extends Error {
|
||||
}
|
||||
declare var SyntaxError: {
|
||||
|
||||
interface SyntaxErrorConstructor {
|
||||
new (message?: string): SyntaxError;
|
||||
(message?: string): SyntaxError;
|
||||
prototype: SyntaxError;
|
||||
}
|
||||
|
||||
declare var SyntaxError: SyntaxErrorConstructor;
|
||||
|
||||
interface TypeError extends Error {
|
||||
}
|
||||
declare var TypeError: {
|
||||
|
||||
interface TypeErrorConstructor {
|
||||
new (message?: string): TypeError;
|
||||
(message?: string): TypeError;
|
||||
prototype: TypeError;
|
||||
}
|
||||
|
||||
declare var TypeError: TypeErrorConstructor;
|
||||
|
||||
interface URIError extends Error {
|
||||
}
|
||||
declare var URIError: {
|
||||
|
||||
interface URIErrorConstructor {
|
||||
new (message?: string): URIError;
|
||||
(message?: string): URIError;
|
||||
prototype: URIError;
|
||||
}
|
||||
|
||||
declare var URIError: URIErrorConstructor;
|
||||
|
||||
interface JSON {
|
||||
/**
|
||||
* Converts a JavaScript Object Notation (JSON) string into an object.
|
||||
@@ -1111,7 +1151,8 @@ interface Array<T> {
|
||||
|
||||
[n: number]: T;
|
||||
}
|
||||
declare var Array: {
|
||||
|
||||
interface ArrayConstructor {
|
||||
new (arrayLength?: number): any[];
|
||||
new <T>(arrayLength: number): T[];
|
||||
new <T>(...items: T[]): T[];
|
||||
@@ -1122,6 +1163,8 @@ declare var Array: {
|
||||
prototype: Array<any>;
|
||||
}
|
||||
|
||||
declare var Array: ArrayConstructor;
|
||||
|
||||
/////////////////////////////
|
||||
/// IE10 ECMAScript Extensions
|
||||
/////////////////////////////
|
||||
@@ -1489,7 +1532,7 @@ interface Uint32Array extends ArrayBufferView {
|
||||
set(array: number[], offset?: number): void;
|
||||
|
||||
/**
|
||||
* Gets a new Uint32Array view of the ArrayBuffer Object store for this array, specifying the first and last members of the subarray.
|
||||
* Gets a new Int8Array view of the ArrayBuffer Object store for this array, specifying the first and last members of the subarray.
|
||||
* @param begin The index of the beginning of the array.
|
||||
* @param end The index of the end of the array.
|
||||
*/
|
||||
@@ -1754,6 +1797,7 @@ interface Map<K, V> {
|
||||
}
|
||||
declare var Map: {
|
||||
new <K, V>(): Map<K, V>;
|
||||
prototype: Map<any, any>;
|
||||
}
|
||||
|
||||
interface WeakMap<K, V> {
|
||||
@@ -1765,6 +1809,7 @@ interface WeakMap<K, V> {
|
||||
}
|
||||
declare var WeakMap: {
|
||||
new <K, V>(): WeakMap<K, V>;
|
||||
prototype: WeakMap<any, any>;
|
||||
}
|
||||
|
||||
interface Set<T> {
|
||||
@@ -1777,10 +1822,13 @@ interface Set<T> {
|
||||
}
|
||||
declare var Set: {
|
||||
new <T>(): Set<T>;
|
||||
prototype: Set<any>;
|
||||
}
|
||||
/////////////////////////////
|
||||
/// ECMAScript Internationalization API
|
||||
/////////////////////////////
|
||||
|
||||
declare module Intl {
|
||||
|
||||
interface CollatorOptions {
|
||||
usage?: string;
|
||||
localeMatcher?: string;
|
||||
|
||||
Vendored
+6
-1
@@ -647,6 +647,7 @@ interface Map<K, V> {
|
||||
}
|
||||
declare var Map: {
|
||||
new <K, V>(): Map<K, V>;
|
||||
prototype: Map<any, any>;
|
||||
}
|
||||
|
||||
interface WeakMap<K, V> {
|
||||
@@ -658,6 +659,7 @@ interface WeakMap<K, V> {
|
||||
}
|
||||
declare var WeakMap: {
|
||||
new <K, V>(): WeakMap<K, V>;
|
||||
prototype: WeakMap<any, any>;
|
||||
}
|
||||
|
||||
interface Set<T> {
|
||||
@@ -670,10 +672,13 @@ interface Set<T> {
|
||||
}
|
||||
declare var Set: {
|
||||
new <T>(): Set<T>;
|
||||
prototype: Set<any>;
|
||||
}
|
||||
/////////////////////////////
|
||||
/// ECMAScript Internationalization API
|
||||
/////////////////////////////
|
||||
|
||||
declare module Intl {
|
||||
|
||||
interface CollatorOptions {
|
||||
usage?: string;
|
||||
localeMatcher?: string;
|
||||
|
||||
Vendored
+17197
File diff suppressed because it is too large
Load Diff
Vendored
+6
-1
@@ -647,6 +647,7 @@ interface Map<K, V> {
|
||||
}
|
||||
declare var Map: {
|
||||
new <K, V>(): Map<K, V>;
|
||||
prototype: Map<any, any>;
|
||||
}
|
||||
|
||||
interface WeakMap<K, V> {
|
||||
@@ -658,6 +659,7 @@ interface WeakMap<K, V> {
|
||||
}
|
||||
declare var WeakMap: {
|
||||
new <K, V>(): WeakMap<K, V>;
|
||||
prototype: WeakMap<any, any>;
|
||||
}
|
||||
|
||||
interface Set<T> {
|
||||
@@ -670,10 +672,13 @@ interface Set<T> {
|
||||
}
|
||||
declare var Set: {
|
||||
new <T>(): Set<T>;
|
||||
prototype: Set<any>;
|
||||
}
|
||||
/////////////////////////////
|
||||
/// ECMAScript Internationalization API
|
||||
/////////////////////////////
|
||||
|
||||
declare module Intl {
|
||||
|
||||
interface CollatorOptions {
|
||||
usage?: string;
|
||||
localeMatcher?: string;
|
||||
|
||||
+5404
-3987
File diff suppressed because it is too large
Load Diff
Vendored
+1878
File diff suppressed because it is too large
Load Diff
Vendored
+1878
File diff suppressed because it is too large
Load Diff
+7259
-5603
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -25,7 +25,7 @@
|
||||
"url" : "https://github.com/Microsoft/TypeScript.git"
|
||||
},
|
||||
"preferGlobal" : true,
|
||||
"main" : "./bin/tsc.js",
|
||||
"main" : "./bin/typescriptServices.js",
|
||||
"bin" : {
|
||||
"tsc" : "./bin/tsc"
|
||||
},
|
||||
|
||||
@@ -15,6 +15,7 @@ interface IIndexable<V> {
|
||||
}
|
||||
|
||||
function main(): void {
|
||||
var sys = ts.sys;
|
||||
if (sys.args.length < 1) {
|
||||
sys.write("Usage:" + sys.newLine)
|
||||
sys.write("\tnode processDiagnosticMessages.js <diagnostic-json-input-file>" + sys.newLine);
|
||||
|
||||
+31
-22
@@ -227,23 +227,27 @@ module ts {
|
||||
if (symbolKind & SymbolFlags.HasLocals) {
|
||||
node.locals = {};
|
||||
}
|
||||
|
||||
var saveParent = parent;
|
||||
var saveContainer = container;
|
||||
var savedBlockScopeContainer = blockScopeContainer;
|
||||
parent = node;
|
||||
if (symbolKind & SymbolFlags.IsContainer) {
|
||||
container = node;
|
||||
// If container is not on container list, add it to the list
|
||||
if (lastContainer !== container && !container.nextContainer) {
|
||||
if (lastContainer) {
|
||||
lastContainer.nextContainer = container;
|
||||
}
|
||||
lastContainer = container;
|
||||
Debug.assert(container.nextContainer === undefined);
|
||||
|
||||
if (lastContainer) {
|
||||
Debug.assert(lastContainer.nextContainer === undefined);
|
||||
lastContainer.nextContainer = container;
|
||||
}
|
||||
|
||||
lastContainer = container;
|
||||
}
|
||||
|
||||
if (isBlockScopeContainer) {
|
||||
blockScopeContainer = node;
|
||||
}
|
||||
|
||||
forEachChild(node, bind);
|
||||
container = saveContainer;
|
||||
parent = saveParent;
|
||||
@@ -292,15 +296,6 @@ module ts {
|
||||
bindChildren(node, symbolKind, isBlockScopeContainer);
|
||||
}
|
||||
|
||||
function bindConstructorDeclaration(node: ConstructorDeclaration) {
|
||||
bindDeclaration(node, SymbolFlags.Constructor, 0, /*isBlockScopeContainer*/ true);
|
||||
forEach(node.parameters, p => {
|
||||
if (p.flags & (NodeFlags.Public | NodeFlags.Private | NodeFlags.Protected)) {
|
||||
bindDeclaration(p, SymbolFlags.Property, SymbolFlags.PropertyExcludes, /*isBlockScopeContainer*/ false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function bindModuleDeclaration(node: ModuleDeclaration) {
|
||||
if (node.name.kind === SyntaxKind.StringLiteral) {
|
||||
bindDeclaration(node, SymbolFlags.ValueModule, SymbolFlags.ValueModuleExcludes, /*isBlockScopeContainer*/ true);
|
||||
@@ -389,12 +384,7 @@ module ts {
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.TypeParameter, SymbolFlags.TypeParameterExcludes, /*isBlockScopeContainer*/ false);
|
||||
break;
|
||||
case SyntaxKind.Parameter:
|
||||
if (isBindingPattern((<Declaration>node).name)) {
|
||||
bindAnonymousDeclaration(<Declaration>node, SymbolFlags.FunctionScopedVariable, getDestructuringParameterName(<Declaration>node), /*isBlockScopeContainer*/ false);
|
||||
}
|
||||
else {
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.FunctionScopedVariable, SymbolFlags.ParameterExcludes, /*isBlockScopeContainer*/ false);
|
||||
}
|
||||
bindParameter(<ParameterDeclaration>node);
|
||||
break;
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
case SyntaxKind.BindingElement:
|
||||
@@ -437,7 +427,7 @@ module ts {
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.Function, SymbolFlags.FunctionExcludes, /*isBlockScopeContainer*/ true);
|
||||
break;
|
||||
case SyntaxKind.Constructor:
|
||||
bindConstructorDeclaration(<ConstructorDeclaration>node);
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.Constructor, /*symbolExcludes:*/ 0, /*isBlockScopeContainer:*/ true);
|
||||
break;
|
||||
case SyntaxKind.GetAccessor:
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.GetAccessor, SymbolFlags.GetAccessorExcludes, /*isBlockScopeContainer*/ true);
|
||||
@@ -508,5 +498,24 @@ module ts {
|
||||
parent = saveParent;
|
||||
}
|
||||
}
|
||||
|
||||
function bindParameter(node: ParameterDeclaration) {
|
||||
if (isBindingPattern(node.name)) {
|
||||
bindAnonymousDeclaration(node, SymbolFlags.FunctionScopedVariable, getDestructuringParameterName(node), /*isBlockScopeContainer*/ false);
|
||||
}
|
||||
else {
|
||||
bindDeclaration(node, SymbolFlags.FunctionScopedVariable, SymbolFlags.ParameterExcludes, /*isBlockScopeContainer*/ false);
|
||||
}
|
||||
|
||||
// If this is a property-parameter, then also declare the property symbol into the
|
||||
// containing class.
|
||||
if (node.flags & NodeFlags.AccessibilityModifier &&
|
||||
node.parent.kind === SyntaxKind.Constructor &&
|
||||
node.parent.parent.kind === SyntaxKind.ClassDeclaration) {
|
||||
|
||||
var classDeclaration = <ClassDeclaration>node.parent.parent;
|
||||
declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, SymbolFlags.Property, SymbolFlags.PropertyExcludes);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+68
-76
@@ -4,57 +4,12 @@
|
||||
/// <reference path="parser.ts"/>
|
||||
/// <reference path="binder.ts"/>
|
||||
/// <reference path="emitter.ts"/>
|
||||
/// <reference path="utilities.ts"/>
|
||||
|
||||
module ts {
|
||||
var nextSymbolId = 1;
|
||||
var nextNodeId = 1;
|
||||
var nextMergeId = 1;
|
||||
|
||||
export function getDeclarationOfKind(symbol: Symbol, kind: SyntaxKind): Declaration {
|
||||
var declarations = symbol.declarations;
|
||||
for (var i = 0; i < declarations.length; i++) {
|
||||
var declaration = declarations[i];
|
||||
if (declaration.kind === kind) {
|
||||
return declaration;
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export interface StringSymbolWriter extends SymbolWriter {
|
||||
string(): string;
|
||||
}
|
||||
|
||||
// Pool writers to avoid needing to allocate them for every symbol we write.
|
||||
var stringWriters: StringSymbolWriter[] = [];
|
||||
export function getSingleLineStringWriter(): StringSymbolWriter {
|
||||
if (stringWriters.length == 0) {
|
||||
var str = "";
|
||||
|
||||
var writeText: (text: string) => void = text => str += text;
|
||||
return {
|
||||
string: () => str,
|
||||
writeKeyword: writeText,
|
||||
writeOperator: writeText,
|
||||
writePunctuation: writeText,
|
||||
writeSpace: writeText,
|
||||
writeStringLiteral: writeText,
|
||||
writeParameter: writeText,
|
||||
writeSymbol: writeText,
|
||||
|
||||
// Completely ignore indentation for string writers. And map newlines to
|
||||
// a single space.
|
||||
writeLine: () => str += " ",
|
||||
increaseIndent: () => { },
|
||||
decreaseIndent: () => { },
|
||||
clear: () => str = "",
|
||||
trackSymbol: () => { }
|
||||
};
|
||||
}
|
||||
|
||||
return stringWriters.pop();
|
||||
}
|
||||
var nextMergeId = 1;
|
||||
|
||||
/// fullTypeCheck denotes if this instance of the typechecker will be used to get semantic diagnostics.
|
||||
/// If fullTypeCheck === true, then the typechecker should do every possible check to produce all errors
|
||||
@@ -1019,11 +974,6 @@ module ts {
|
||||
};
|
||||
}
|
||||
|
||||
function releaseStringWriter(writer: StringSymbolWriter) {
|
||||
writer.clear()
|
||||
stringWriters.push(writer);
|
||||
}
|
||||
|
||||
function writeKeyword(writer: SymbolWriter, kind: SyntaxKind) {
|
||||
writer.writeKeyword(tokenToString(kind));
|
||||
}
|
||||
@@ -4629,8 +4579,8 @@ module ts {
|
||||
// Get the narrowed type of a given symbol at a given location
|
||||
function getNarrowedTypeOfSymbol(symbol: Symbol, node: Node) {
|
||||
var type = getTypeOfSymbol(symbol);
|
||||
// Only narrow when symbol is variable of a structured type
|
||||
if (node && (symbol.flags & SymbolFlags.Variable && type.flags & TypeFlags.Structured)) {
|
||||
// Only narrow when symbol is variable of an object, union, or type parameter type
|
||||
if (node && symbol.flags & SymbolFlags.Variable && type.flags & (TypeFlags.ObjectType | TypeFlags.Union | TypeFlags.TypeParameter)) {
|
||||
loop: while (node.parent) {
|
||||
var child = node;
|
||||
node = node.parent;
|
||||
@@ -4791,14 +4741,49 @@ module ts {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
/*Transitively mark all linked imports as referenced*/
|
||||
function markLinkedImportsAsReferenced(node: ImportDeclaration): void {
|
||||
var nodeLinks = getNodeLinks(node);
|
||||
while (nodeLinks.importOnRightSide) {
|
||||
var rightSide = nodeLinks.importOnRightSide;
|
||||
nodeLinks.importOnRightSide = undefined;
|
||||
|
||||
getSymbolLinks(rightSide).referenced = true;
|
||||
Debug.assert((rightSide.flags & SymbolFlags.Import) !== 0);
|
||||
|
||||
nodeLinks = getNodeLinks(getDeclarationOfKind(rightSide, SyntaxKind.ImportDeclaration))
|
||||
}
|
||||
}
|
||||
|
||||
function checkIdentifier(node: Identifier): Type {
|
||||
var symbol = getResolvedSymbol(node);
|
||||
|
||||
if (symbol.flags & SymbolFlags.Import) {
|
||||
// Mark the import as referenced so that we emit it in the final .js file.
|
||||
// exception: identifiers that appear in type queries, const enums, modules that contain only const enums
|
||||
getSymbolLinks(symbol).referenced = getSymbolLinks(symbol).referenced || (!isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveImport(symbol)));
|
||||
var symbolLinks = getSymbolLinks(symbol);
|
||||
if (!symbolLinks.referenced) {
|
||||
var importOrExportAssignment = getLeftSideOfImportOrExportAssignment(node);
|
||||
|
||||
// decision about whether import is referenced can be made now if
|
||||
// - import that are used anywhere except right side of import declarations
|
||||
// - imports that are used on the right side of exported import declarations
|
||||
// for other cases defer decision until the check of left side
|
||||
if (!importOrExportAssignment ||
|
||||
(importOrExportAssignment.flags & NodeFlags.Export) ||
|
||||
(importOrExportAssignment.kind === SyntaxKind.ExportAssignment)) {
|
||||
// Mark the import as referenced so that we emit it in the final .js file.
|
||||
// exception: identifiers that appear in type queries, const enums, modules that contain only const enums
|
||||
symbolLinks.referenced = !isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveImport(symbol));
|
||||
}
|
||||
else {
|
||||
var nodeLinks = getNodeLinks(importOrExportAssignment);
|
||||
Debug.assert(!nodeLinks.importOnRightSide);
|
||||
nodeLinks.importOnRightSide = symbol;
|
||||
}
|
||||
}
|
||||
|
||||
if (symbolLinks.referenced) {
|
||||
markLinkedImportsAsReferenced(<ImportDeclaration>getDeclarationOfKind(symbol, SyntaxKind.ImportDeclaration));
|
||||
}
|
||||
}
|
||||
|
||||
checkCollisionWithCapturedSuperVariable(node, node);
|
||||
@@ -5624,7 +5609,7 @@ module ts {
|
||||
}
|
||||
|
||||
// Fall back to any.
|
||||
if (compilerOptions.noImplicitAny && objectType !== anyType) {
|
||||
if (compilerOptions.noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors && objectType !== anyType) {
|
||||
error(node, Diagnostics.Index_signature_of_object_type_implicitly_has_an_any_type);
|
||||
}
|
||||
|
||||
@@ -6649,12 +6634,12 @@ module ts {
|
||||
return numberType;
|
||||
}
|
||||
|
||||
// Return true if type is any, an object type, a type parameter, or a union type composed of only those kinds of types
|
||||
// Return true if type an object type, a type parameter, or a union type composed of only those kinds of types
|
||||
function isStructuredType(type: Type): boolean {
|
||||
if (type.flags & TypeFlags.Union) {
|
||||
return !forEach((<UnionType>type).types, t => !isStructuredType(t));
|
||||
}
|
||||
return (type.flags & TypeFlags.Structured) !== 0;
|
||||
return (type.flags & (TypeFlags.ObjectType | TypeFlags.TypeParameter)) !== 0;
|
||||
}
|
||||
|
||||
function isConstEnumObjectType(type: Type): boolean {
|
||||
@@ -6671,11 +6656,11 @@ module ts {
|
||||
// and the right operand to be of type Any or a subtype of the 'Function' interface type.
|
||||
// The result is always of the Boolean primitive type.
|
||||
// NOTE: do not raise error if leftType is unknown as related error was already reported
|
||||
if (leftType !== unknownType && !isStructuredType(leftType)) {
|
||||
if (!(leftType.flags & TypeFlags.Any || isStructuredType(leftType))) {
|
||||
error(node.left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
|
||||
}
|
||||
// NOTE: do not raise error if right is unknown as related error was already reported
|
||||
if (rightType !== unknownType && rightType !== anyType && !isTypeSubtypeOf(rightType, globalFunctionType)) {
|
||||
if (!(rightType.flags & TypeFlags.Any || isTypeSubtypeOf(rightType, globalFunctionType))) {
|
||||
error(node.right, Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type);
|
||||
}
|
||||
return booleanType;
|
||||
@@ -6689,7 +6674,7 @@ module ts {
|
||||
if (leftType !== anyType && leftType !== stringType && leftType !== numberType) {
|
||||
error(node.left, Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_types_any_string_or_number);
|
||||
}
|
||||
if (!isStructuredType(rightType)) {
|
||||
if (!(rightType.flags & TypeFlags.Any || isStructuredType(rightType))) {
|
||||
error(node.right, Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
|
||||
}
|
||||
return booleanType;
|
||||
@@ -8177,7 +8162,7 @@ module ts {
|
||||
var exprType = checkExpression(node.expression);
|
||||
// unknownType is returned i.e. if node.expression is identifier whose name cannot be resolved
|
||||
// in this case error about missing name is already reported - do not report extra one
|
||||
if (!isStructuredType(exprType) && exprType !== unknownType) {
|
||||
if (!(exprType.flags & TypeFlags.Any || isStructuredType(exprType))) {
|
||||
error(node.expression, Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter);
|
||||
}
|
||||
|
||||
@@ -9253,6 +9238,8 @@ module ts {
|
||||
if (symbol && symbol.flags & SymbolFlags.Import) {
|
||||
// Mark the import as referenced so that we emit it in the final .js file.
|
||||
getSymbolLinks(symbol).referenced = true;
|
||||
// mark any import declarations that depend upon this import as referenced
|
||||
markLinkedImportsAsReferenced(<ImportDeclaration>getDeclarationOfKind(symbol, SyntaxKind.ImportDeclaration))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9478,19 +9465,24 @@ module ts {
|
||||
return false;
|
||||
}
|
||||
|
||||
function getLeftSideOfImportOrExportAssignment(nodeOnRightSide: EntityName): ImportDeclaration | ExportAssignment {
|
||||
while (nodeOnRightSide.parent.kind === SyntaxKind.QualifiedName) {
|
||||
nodeOnRightSide = <QualifiedName>nodeOnRightSide.parent;
|
||||
}
|
||||
|
||||
if (nodeOnRightSide.parent.kind === SyntaxKind.ImportDeclaration) {
|
||||
return (<ImportDeclaration>nodeOnRightSide.parent).moduleReference === nodeOnRightSide && <ImportDeclaration>nodeOnRightSide.parent;
|
||||
}
|
||||
|
||||
if (nodeOnRightSide.parent.kind === SyntaxKind.ExportAssignment) {
|
||||
return (<ExportAssignment>nodeOnRightSide.parent).exportName === nodeOnRightSide && <ExportAssignment>nodeOnRightSide.parent;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function isInRightSideOfImportOrExportAssignment(node: EntityName) {
|
||||
while (node.parent.kind === SyntaxKind.QualifiedName) {
|
||||
node = <QualifiedName>node.parent;
|
||||
}
|
||||
|
||||
if (node.parent.kind === SyntaxKind.ImportDeclaration) {
|
||||
return (<ImportDeclaration>node.parent).moduleReference === node;
|
||||
}
|
||||
if (node.parent.kind === SyntaxKind.ExportAssignment) {
|
||||
return (<ExportAssignment>node.parent).exportName === node;
|
||||
}
|
||||
|
||||
return false;
|
||||
return getLeftSideOfImportOrExportAssignment(node) !== undefined;
|
||||
}
|
||||
|
||||
function isRightSideOfQualifiedNameOrPropertyAccess(node: Node) {
|
||||
|
||||
@@ -88,6 +88,11 @@ module ts {
|
||||
description: Diagnostics.Redirect_output_structure_to_the_directory,
|
||||
paramType: Diagnostics.DIRECTORY,
|
||||
},
|
||||
{
|
||||
name: "preserveConstEnums",
|
||||
type: "boolean",
|
||||
description: Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code
|
||||
},
|
||||
{
|
||||
name: "removeComments",
|
||||
type: "boolean",
|
||||
@@ -104,6 +109,11 @@ module ts {
|
||||
description: Diagnostics.Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations,
|
||||
paramType: Diagnostics.LOCATION,
|
||||
},
|
||||
{
|
||||
name: "suppressImplicitAnyIndexErrors",
|
||||
type: "boolean",
|
||||
description: Diagnostics.Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures,
|
||||
},
|
||||
{
|
||||
name: "target",
|
||||
shortName: "t",
|
||||
@@ -123,14 +133,9 @@ module ts {
|
||||
shortName: "w",
|
||||
type: "boolean",
|
||||
description: Diagnostics.Watch_input_files,
|
||||
},
|
||||
{
|
||||
name: "preserveConstEnums",
|
||||
type: "boolean",
|
||||
description: Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
var shortOptionNames: Map<string> = {};
|
||||
var optionNameMap: Map<CommandLineOption> = {};
|
||||
|
||||
|
||||
+24
-11
@@ -15,10 +15,6 @@ module ts {
|
||||
True = -1
|
||||
}
|
||||
|
||||
export interface Map<T> {
|
||||
[index: string]: T;
|
||||
}
|
||||
|
||||
export const enum Comparison {
|
||||
LessThan = -1,
|
||||
EqualTo = 0,
|
||||
@@ -591,27 +587,44 @@ module ts {
|
||||
return path;
|
||||
}
|
||||
|
||||
var escapedCharsRegExp = /[\t\v\f\b\0\r\n\"\\\u2028\u2029\u0085]/g;
|
||||
var backslashOrDoubleQuote = /[\"\\]/g;
|
||||
var escapedCharsRegExp = /[\0-\19\t\v\f\b\0\r\n\u2028\u2029\u0085]/g;
|
||||
var escapedCharsMap: Map<string> = {
|
||||
"\0": "\\0",
|
||||
"\t": "\\t",
|
||||
"\v": "\\v",
|
||||
"\f": "\\f",
|
||||
"\b": "\\b",
|
||||
"\0": "\\0",
|
||||
"\r": "\\r",
|
||||
"\n": "\\n",
|
||||
"\\": "\\\\",
|
||||
"\"": "\\\"",
|
||||
"\u2028": "\\u2028", // lineSeparator
|
||||
"\u2029": "\\u2029", // paragraphSeparator
|
||||
"\u0085": "\\u0085" // nextLine
|
||||
};
|
||||
|
||||
/** NOTE: This *does not* support the full escape characters, it only supports the subset that can be used in file names
|
||||
* or string literals. If the information encoded in the map changes, this needs to be revisited. */
|
||||
/**
|
||||
* Based heavily on the abstract 'Quote' operation from ECMA-262 (24.3.2.2),
|
||||
* but augmented for a few select characters.
|
||||
* Note that this doesn't actually wrap the input in double quotes.
|
||||
*/
|
||||
export function escapeString(s: string): string {
|
||||
return escapedCharsRegExp.test(s) ? s.replace(escapedCharsRegExp, c => {
|
||||
return escapedCharsMap[c] || c;
|
||||
}) : s;
|
||||
// Prioritize '"' and '\'
|
||||
s = backslashOrDoubleQuote.test(s) ? s.replace(backslashOrDoubleQuote, getReplacement) : s;
|
||||
s = escapedCharsRegExp.test(s) ? s.replace(escapedCharsRegExp, getReplacement) : s;
|
||||
|
||||
return s;
|
||||
|
||||
function getReplacement(c: string) {
|
||||
return escapedCharsMap[c] || unicodeEscape(c);
|
||||
}
|
||||
|
||||
function unicodeEscape(c: string): string {
|
||||
var hexCharCode = c.charCodeAt(0).toString(16);
|
||||
var paddedHexCode = ("0000" + hexCharCode).slice(-4);
|
||||
return "\\u" + paddedHexCode;
|
||||
}
|
||||
}
|
||||
|
||||
export interface ObjectAllocator {
|
||||
|
||||
@@ -145,6 +145,7 @@ module ts {
|
||||
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 },
|
||||
Merge_conflict_marker_encountered: { code: 1184, category: DiagnosticCategory.Error, key: "Merge conflict marker encountered." },
|
||||
Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." },
|
||||
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." },
|
||||
Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." },
|
||||
@@ -417,6 +418,7 @@ module ts {
|
||||
Warn_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: DiagnosticCategory.Message, key: "Warn on expressions and declarations with an implied 'any' type." },
|
||||
File_0_not_found: { code: 6053, category: DiagnosticCategory.Error, key: "File '{0}' not found." },
|
||||
File_0_must_have_extension_ts_or_d_ts: { code: 6054, category: DiagnosticCategory.Error, key: "File '{0}' must have extension '.ts' or '.d.ts'." },
|
||||
Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: DiagnosticCategory.Message, key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." },
|
||||
Variable_0_implicitly_has_an_1_type: { code: 7005, category: DiagnosticCategory.Error, key: "Variable '{0}' implicitly has an '{1}' type." },
|
||||
Parameter_0_implicitly_has_an_1_type: { code: 7006, category: DiagnosticCategory.Error, key: "Parameter '{0}' implicitly has an '{1}' type." },
|
||||
Member_0_implicitly_has_an_1_type: { code: 7008, category: DiagnosticCategory.Error, key: "Member '{0}' implicitly has an '{1}' type." },
|
||||
|
||||
@@ -670,6 +670,10 @@
|
||||
"code": 1184,
|
||||
"isEarly": true
|
||||
},
|
||||
"Merge conflict marker encountered.": {
|
||||
"category": "Error",
|
||||
"code": 1184
|
||||
},
|
||||
|
||||
"Duplicate identifier '{0}'.": {
|
||||
"category": "Error",
|
||||
@@ -1765,6 +1769,10 @@
|
||||
"category": "Error",
|
||||
"code": 6054
|
||||
},
|
||||
"Suppress noImplicitAny errors for indexing objects lacking index signatures.": {
|
||||
"category": "Message",
|
||||
"code": 6055
|
||||
},
|
||||
|
||||
"Variable '{0}' implicitly has an '{1}' type.": {
|
||||
"category": "Error",
|
||||
|
||||
@@ -2819,9 +2819,8 @@ module ts {
|
||||
function createVoidZero(): Expression {
|
||||
var zero = <LiteralExpression>createNode(SyntaxKind.NumericLiteral);
|
||||
zero.text = "0";
|
||||
var result = <PrefixUnaryExpression>createNode(SyntaxKind.PrefixUnaryExpression);
|
||||
result.operator = SyntaxKind.VoidKeyword;
|
||||
result.operand = zero;
|
||||
var result = <VoidExpression>createNode(SyntaxKind.VoidExpression);
|
||||
result.expression = zero;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
+148
-723
@@ -1,41 +1,11 @@
|
||||
/// <reference path="types.ts"/>
|
||||
/// <reference path="core.ts"/>
|
||||
/// <reference path="scanner.ts"/>
|
||||
/// <reference path="utilities.ts"/>
|
||||
|
||||
module ts {
|
||||
var nodeConstructors = new Array<new () => Node>(SyntaxKind.Count);
|
||||
|
||||
export function getFullWidth(node: Node) {
|
||||
return node.end - node.pos;
|
||||
}
|
||||
|
||||
function hasFlag(val: number, flag: number): boolean {
|
||||
return (val & flag) !== 0;
|
||||
}
|
||||
|
||||
// Returns true if this node contains a parse error anywhere underneath it.
|
||||
export function containsParseError(node: Node): boolean {
|
||||
if (!hasFlag(node.parserContextFlags, ParserContextFlags.HasPropagatedChildContainsErrorFlag)) {
|
||||
// A node is considered to contain a parse error if:
|
||||
// a) the parser explicitly marked that it had an error
|
||||
// b) any of it's children reported that it had an error.
|
||||
var val = hasFlag(node.parserContextFlags, ParserContextFlags.ContainsError) ||
|
||||
forEachChild(node, containsParseError);
|
||||
|
||||
// If so, mark ourselves accordingly.
|
||||
if (val) {
|
||||
node.parserContextFlags |= ParserContextFlags.ContainsError;
|
||||
}
|
||||
|
||||
// Also mark that we've propogated the child information to this node. This way we can
|
||||
// always consult the bit directly on this node without needing to check its children
|
||||
// again.
|
||||
node.parserContextFlags |= ParserContextFlags.HasPropagatedChildContainsErrorFlag;
|
||||
}
|
||||
|
||||
return hasFlag(node.parserContextFlags, ParserContextFlags.ContainsError);
|
||||
}
|
||||
|
||||
export function getNodeConstructor(kind: SyntaxKind): new () => Node {
|
||||
return nodeConstructors[kind] || (nodeConstructors[kind] = objectAllocator.getNodeConstructor(kind));
|
||||
}
|
||||
@@ -43,183 +13,7 @@ module ts {
|
||||
export function createNode(kind: SyntaxKind): Node {
|
||||
return new (getNodeConstructor(kind))();
|
||||
}
|
||||
|
||||
export function getSourceFileOfNode(node: Node): SourceFile {
|
||||
while (node && node.kind !== SyntaxKind.SourceFile) node = node.parent;
|
||||
return <SourceFile>node;
|
||||
}
|
||||
|
||||
// This is a useful function for debugging purposes.
|
||||
export function nodePosToString(node: Node): string {
|
||||
var file = getSourceFileOfNode(node);
|
||||
var loc = file.getLineAndCharacterFromPosition(node.pos);
|
||||
return file.filename + "(" + loc.line + "," + loc.character + ")";
|
||||
}
|
||||
|
||||
export function getStartPosOfNode(node: Node): number {
|
||||
return node.pos;
|
||||
}
|
||||
|
||||
export function isMissingNode(node: Node) {
|
||||
return node.pos === node.end && node.kind !== SyntaxKind.EndOfFileToken;
|
||||
}
|
||||
|
||||
export function getTokenPosOfNode(node: Node, sourceFile?: SourceFile): number {
|
||||
// With nodes that have no width (i.e. 'Missing' nodes), we actually *don't*
|
||||
// want to skip trivia because this will launch us forward to the next token.
|
||||
if (isMissingNode(node)) {
|
||||
return node.pos;
|
||||
}
|
||||
|
||||
return skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos);
|
||||
}
|
||||
|
||||
export function getSourceTextOfNodeFromSourceFile(sourceFile: SourceFile, node: Node): string {
|
||||
if (isMissingNode(node)) {
|
||||
return "";
|
||||
}
|
||||
|
||||
var text = sourceFile.text;
|
||||
return text.substring(skipTrivia(text, node.pos), node.end);
|
||||
}
|
||||
|
||||
export function getTextOfNodeFromSourceText(sourceText: string, node: Node): string {
|
||||
if (isMissingNode(node)) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return sourceText.substring(skipTrivia(sourceText, node.pos), node.end);
|
||||
}
|
||||
|
||||
export function getTextOfNode(node: Node): string {
|
||||
return getSourceTextOfNodeFromSourceFile(getSourceFileOfNode(node), node);
|
||||
}
|
||||
|
||||
// Add an extra underscore to identifiers that start with two underscores to avoid issues with magic names like '__proto__'
|
||||
export function escapeIdentifier(identifier: string): string {
|
||||
return identifier.length >= 2 && identifier.charCodeAt(0) === CharacterCodes._ && identifier.charCodeAt(1) === CharacterCodes._ ? "_" + identifier : identifier;
|
||||
}
|
||||
|
||||
// Remove extra underscore from escaped identifier
|
||||
export function unescapeIdentifier(identifier: string): string {
|
||||
return identifier.length >= 3 && identifier.charCodeAt(0) === CharacterCodes._ && identifier.charCodeAt(1) === CharacterCodes._ && identifier.charCodeAt(2) === CharacterCodes._ ? identifier.substr(1) : identifier;
|
||||
}
|
||||
|
||||
// Return display name of an identifier
|
||||
// Computed property names will just be emitted as "[<expr>]", where <expr> is the source
|
||||
// text of the expression in the computed property.
|
||||
export function declarationNameToString(name: DeclarationName) {
|
||||
return getFullWidth(name) === 0 ? "(Missing)" : getTextOfNode(name);
|
||||
}
|
||||
|
||||
export function createDiagnosticForNode(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): Diagnostic {
|
||||
node = getErrorSpanForNode(node);
|
||||
var file = getSourceFileOfNode(node);
|
||||
|
||||
var start = getFullWidth(node) === 0 ? node.pos : skipTrivia(file.text, node.pos);
|
||||
var length = node.end - start;
|
||||
|
||||
return createFileDiagnostic(file, start, length, message, arg0, arg1, arg2);
|
||||
}
|
||||
|
||||
export function createDiagnosticForNodeFromMessageChain(node: Node, messageChain: DiagnosticMessageChain, newLine: string): Diagnostic {
|
||||
node = getErrorSpanForNode(node);
|
||||
var file = getSourceFileOfNode(node);
|
||||
var start = skipTrivia(file.text, node.pos);
|
||||
var length = node.end - start;
|
||||
return flattenDiagnosticChain(file, start, length, messageChain, newLine);
|
||||
}
|
||||
|
||||
export function getErrorSpanForNode(node: Node): Node {
|
||||
var errorSpan: Node;
|
||||
switch (node.kind) {
|
||||
// This list is a work in progress. Add missing node kinds to improve their error
|
||||
// spans.
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
case SyntaxKind.BindingElement:
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
case SyntaxKind.EnumMember:
|
||||
errorSpan = (<Declaration>node).name;
|
||||
break;
|
||||
}
|
||||
|
||||
// We now have the ideal error span, but it may be a node that is optional and absent
|
||||
// (e.g. the name of a function expression), in which case errorSpan will be undefined.
|
||||
// Alternatively, it might be required and missing (e.g. the name of a module), in which
|
||||
// case its pos will equal its end (length 0). In either of these cases, we should fall
|
||||
// back to the original node that the error was issued on.
|
||||
return errorSpan && errorSpan.pos < errorSpan.end ? errorSpan : node;
|
||||
}
|
||||
|
||||
export function isExternalModule(file: SourceFile): boolean {
|
||||
return file.externalModuleIndicator !== undefined;
|
||||
}
|
||||
|
||||
export function isDeclarationFile(file: SourceFile): boolean {
|
||||
return (file.flags & NodeFlags.DeclarationFile) !== 0;
|
||||
}
|
||||
|
||||
export function isConstEnumDeclaration(node: Node): boolean {
|
||||
return node.kind === SyntaxKind.EnumDeclaration && isConst(node);
|
||||
}
|
||||
|
||||
export function isConst(node: Node): boolean {
|
||||
return !!(node.flags & NodeFlags.Const);
|
||||
}
|
||||
|
||||
export function isLet(node: Node): boolean {
|
||||
return !!(node.flags & NodeFlags.Let);
|
||||
}
|
||||
|
||||
export function isPrologueDirective(node: Node): boolean {
|
||||
return node.kind === SyntaxKind.ExpressionStatement && (<ExpressionStatement>node).expression.kind === SyntaxKind.StringLiteral;
|
||||
}
|
||||
|
||||
export function isEvalOrArgumentsIdentifier(node: Node): boolean {
|
||||
return node.kind === SyntaxKind.Identifier &&
|
||||
(<Identifier>node).text &&
|
||||
((<Identifier>node).text === "eval" || (<Identifier>node).text === "arguments");
|
||||
}
|
||||
|
||||
/// Should be called only on prologue directives (isPrologueDirective(node) should be true)
|
||||
function isUseStrictPrologueDirective(node: Node): boolean {
|
||||
Debug.assert(isPrologueDirective(node));
|
||||
return (<Identifier>(<ExpressionStatement>node).expression).text === "use strict";
|
||||
}
|
||||
|
||||
export function getLeadingCommentRangesOfNode(node: Node, sourceFileOfNode?: SourceFile) {
|
||||
sourceFileOfNode = sourceFileOfNode || getSourceFileOfNode(node);
|
||||
|
||||
// If parameter/type parameter, the prev token trailing comments are part of this node too
|
||||
if (node.kind === SyntaxKind.Parameter || node.kind === SyntaxKind.TypeParameter) {
|
||||
// e.g. (/** blah */ a, /** blah */ b);
|
||||
return concatenate(getTrailingCommentRanges(sourceFileOfNode.text, node.pos),
|
||||
// e.g.: (
|
||||
// /** blah */ a,
|
||||
// /** blah */ b);
|
||||
getLeadingCommentRanges(sourceFileOfNode.text, node.pos));
|
||||
}
|
||||
else {
|
||||
return getLeadingCommentRanges(sourceFileOfNode.text, node.pos);
|
||||
}
|
||||
}
|
||||
|
||||
export function getJsDocComments(node: Node, sourceFileOfNode: SourceFile) {
|
||||
return filter(getLeadingCommentRangesOfNode(node, sourceFileOfNode), isJsDocComment);
|
||||
|
||||
function isJsDocComment(comment: CommentRange) {
|
||||
// True if the comment starts with '/**' but not if it is '/**/'
|
||||
return sourceFileOfNode.text.charCodeAt(comment.pos + 1) === CharacterCodes.asterisk &&
|
||||
sourceFileOfNode.text.charCodeAt(comment.pos + 2) === CharacterCodes.asterisk &&
|
||||
sourceFileOfNode.text.charCodeAt(comment.pos + 3) !== CharacterCodes.slash;
|
||||
}
|
||||
}
|
||||
|
||||
export var fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*<reference\s+path\s*=\s*)('|")(.+?)\2.*?\/>/
|
||||
|
||||
|
||||
// Invokes a callback for each child of the given node. The 'cbNode' callback is invoked for all child nodes
|
||||
// stored in properties. If a 'cbNodes' callback is specified, it is invoked for embedded arrays; otherwise,
|
||||
// embedded arrays are flattened and the 'cbNode' callback is invoked for each element. If a callback returns
|
||||
@@ -467,424 +261,78 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
// Warning: This has the same semantics as the forEach family of functions,
|
||||
// in that traversal terminates in the event that 'visitor' supplies a truthy value.
|
||||
export function forEachReturnStatement<T>(body: Block, visitor: (stmt: ReturnStatement) => T): T {
|
||||
// TODO (drosen, mhegazy): Move to a more appropriate file.
|
||||
export function createCompilerHost(options: CompilerOptions): CompilerHost {
|
||||
var currentDirectory: string;
|
||||
var existingDirectories: Map<boolean> = {};
|
||||
|
||||
return traverse(body);
|
||||
|
||||
function traverse(node: Node): T {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.ReturnStatement:
|
||||
return visitor(<ReturnStatement>node);
|
||||
case SyntaxKind.Block:
|
||||
case SyntaxKind.IfStatement:
|
||||
case SyntaxKind.DoStatement:
|
||||
case SyntaxKind.WhileStatement:
|
||||
case SyntaxKind.ForStatement:
|
||||
case SyntaxKind.ForInStatement:
|
||||
case SyntaxKind.WithStatement:
|
||||
case SyntaxKind.SwitchStatement:
|
||||
case SyntaxKind.CaseClause:
|
||||
case SyntaxKind.DefaultClause:
|
||||
case SyntaxKind.LabeledStatement:
|
||||
case SyntaxKind.TryStatement:
|
||||
case SyntaxKind.TryBlock:
|
||||
case SyntaxKind.CatchClause:
|
||||
case SyntaxKind.FinallyBlock:
|
||||
return forEachChild(node, traverse);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function isAnyFunction(node: Node): boolean {
|
||||
if (node) {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
case SyntaxKind.CallSignature:
|
||||
case SyntaxKind.ConstructSignature:
|
||||
case SyntaxKind.IndexSignature:
|
||||
case SyntaxKind.FunctionType:
|
||||
case SyntaxKind.ConstructorType:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
export function isFunctionBlock(node: Node) {
|
||||
return node && node.kind === SyntaxKind.Block && isAnyFunction(node.parent);
|
||||
}
|
||||
|
||||
export function isObjectLiteralMethod(node: Node) {
|
||||
return node && node.kind === SyntaxKind.MethodDeclaration && node.parent.kind === SyntaxKind.ObjectLiteralExpression;
|
||||
}
|
||||
|
||||
export function getContainingFunction(node: Node): FunctionLikeDeclaration {
|
||||
while (true) {
|
||||
node = node.parent;
|
||||
if (!node || isAnyFunction(node)) {
|
||||
return <FunctionLikeDeclaration>node;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function getThisContainer(node: Node, includeArrowFunctions: boolean): Node {
|
||||
while (true) {
|
||||
node = node.parent;
|
||||
if (!node) {
|
||||
return undefined;
|
||||
}
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.ArrowFunction:
|
||||
if (!includeArrowFunctions) {
|
||||
continue;
|
||||
}
|
||||
// Fall through
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
case SyntaxKind.SourceFile:
|
||||
return node;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function getSuperContainer(node: Node): Node {
|
||||
while (true) {
|
||||
node = node.parent;
|
||||
if (!node) {
|
||||
return undefined;
|
||||
}
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
return node;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function getInvokedExpression(node: CallLikeExpression): Expression {
|
||||
if (node.kind === SyntaxKind.TaggedTemplateExpression) {
|
||||
return (<TaggedTemplateExpression>node).tag;
|
||||
function getCanonicalFileName(fileName: string): string {
|
||||
// if underlying system can distinguish between two files whose names differs only in cases then file name already in canonical form.
|
||||
// otherwise use toLowerCase as a canonical form.
|
||||
return sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase();
|
||||
}
|
||||
|
||||
// Will either be a CallExpression or NewExpression.
|
||||
return (<CallExpression>node).expression;
|
||||
}
|
||||
// returned by CScript sys environment
|
||||
var unsupportedFileEncodingErrorCode = -2147024809;
|
||||
|
||||
export function isExpression(node: Node): boolean {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.ThisKeyword:
|
||||
case SyntaxKind.SuperKeyword:
|
||||
case SyntaxKind.NullKeyword:
|
||||
case SyntaxKind.TrueKeyword:
|
||||
case SyntaxKind.FalseKeyword:
|
||||
case SyntaxKind.RegularExpressionLiteral:
|
||||
case SyntaxKind.ArrayLiteralExpression:
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
case SyntaxKind.PropertyAccessExpression:
|
||||
case SyntaxKind.ElementAccessExpression:
|
||||
case SyntaxKind.CallExpression:
|
||||
case SyntaxKind.NewExpression:
|
||||
case SyntaxKind.TaggedTemplateExpression:
|
||||
case SyntaxKind.TypeAssertionExpression:
|
||||
case SyntaxKind.ParenthesizedExpression:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
case SyntaxKind.VoidExpression:
|
||||
case SyntaxKind.DeleteExpression:
|
||||
case SyntaxKind.TypeOfExpression:
|
||||
case SyntaxKind.PrefixUnaryExpression:
|
||||
case SyntaxKind.PostfixUnaryExpression:
|
||||
case SyntaxKind.BinaryExpression:
|
||||
case SyntaxKind.ConditionalExpression:
|
||||
case SyntaxKind.TemplateExpression:
|
||||
case SyntaxKind.NoSubstitutionTemplateLiteral:
|
||||
case SyntaxKind.OmittedExpression:
|
||||
return true;
|
||||
case SyntaxKind.QualifiedName:
|
||||
while (node.parent.kind === SyntaxKind.QualifiedName) {
|
||||
node = node.parent;
|
||||
function getSourceFile(filename: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile {
|
||||
try {
|
||||
var text = sys.readFile(filename, options.charset);
|
||||
}
|
||||
catch (e) {
|
||||
if (onError) {
|
||||
onError(e.number === unsupportedFileEncodingErrorCode ?
|
||||
createCompilerDiagnostic(Diagnostics.Unsupported_file_encoding).messageText :
|
||||
e.message);
|
||||
}
|
||||
text = "";
|
||||
}
|
||||
|
||||
return node.parent.kind === SyntaxKind.TypeQuery;
|
||||
case SyntaxKind.Identifier:
|
||||
if (node.parent.kind === SyntaxKind.TypeQuery) {
|
||||
return text !== undefined ? createSourceFile(filename, text, languageVersion) : undefined;
|
||||
}
|
||||
|
||||
function writeFile(fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void) {
|
||||
function directoryExists(directoryPath: string): boolean {
|
||||
if (hasProperty(existingDirectories, directoryPath)) {
|
||||
return true;
|
||||
}
|
||||
// fall through
|
||||
case SyntaxKind.NumericLiteral:
|
||||
case SyntaxKind.StringLiteral:
|
||||
var parent = node.parent;
|
||||
switch (parent.kind) {
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
case SyntaxKind.Parameter:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
case SyntaxKind.EnumMember:
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
case SyntaxKind.BindingElement:
|
||||
return (<VariableLikeDeclaration>parent).initializer === node;
|
||||
case SyntaxKind.ExpressionStatement:
|
||||
case SyntaxKind.IfStatement:
|
||||
case SyntaxKind.DoStatement:
|
||||
case SyntaxKind.WhileStatement:
|
||||
case SyntaxKind.ReturnStatement:
|
||||
case SyntaxKind.WithStatement:
|
||||
case SyntaxKind.SwitchStatement:
|
||||
case SyntaxKind.CaseClause:
|
||||
case SyntaxKind.ThrowStatement:
|
||||
case SyntaxKind.SwitchStatement:
|
||||
return (<ExpressionStatement>parent).expression === node;
|
||||
case SyntaxKind.ForStatement:
|
||||
return (<ForStatement>parent).initializer === node ||
|
||||
(<ForStatement>parent).condition === node ||
|
||||
(<ForStatement>parent).iterator === node;
|
||||
case SyntaxKind.ForInStatement:
|
||||
return (<ForInStatement>parent).variable === node ||
|
||||
(<ForInStatement>parent).expression === node;
|
||||
case SyntaxKind.TypeAssertionExpression:
|
||||
return node === (<TypeAssertion>parent).expression;
|
||||
case SyntaxKind.TemplateSpan:
|
||||
return node === (<TemplateSpan>parent).expression;
|
||||
default:
|
||||
if (isExpression(parent)) {
|
||||
return true;
|
||||
}
|
||||
if (sys.directoryExists(directoryPath)) {
|
||||
existingDirectories[directoryPath] = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export function isExternalModuleImportDeclaration(node: Node) {
|
||||
return node.kind === SyntaxKind.ImportDeclaration && (<ImportDeclaration>node).moduleReference.kind === SyntaxKind.ExternalModuleReference;
|
||||
}
|
||||
|
||||
export function getExternalModuleImportDeclarationExpression(node: Node) {
|
||||
Debug.assert(isExternalModuleImportDeclaration(node));
|
||||
return (<ExternalModuleReference>(<ImportDeclaration>node).moduleReference).expression;
|
||||
}
|
||||
|
||||
export function isInternalModuleImportDeclaration(node: Node) {
|
||||
return node.kind === SyntaxKind.ImportDeclaration && (<ImportDeclaration>node).moduleReference.kind !== SyntaxKind.ExternalModuleReference;
|
||||
}
|
||||
|
||||
export function hasDotDotDotToken(node: Node) {
|
||||
return node && node.kind === SyntaxKind.Parameter && (<ParameterDeclaration>node).dotDotDotToken !== undefined;
|
||||
}
|
||||
|
||||
export function hasQuestionToken(node: Node) {
|
||||
if (node) {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.Parameter:
|
||||
return (<ParameterDeclaration>node).questionToken !== undefined;
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
return (<MethodDeclaration>node).questionToken !== undefined;
|
||||
case SyntaxKind.ShorthandPropertyAssignment:
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
return (<PropertyDeclaration>node).questionToken !== undefined;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
export function hasRestParameters(s: SignatureDeclaration): boolean {
|
||||
return s.parameters.length > 0 && s.parameters[s.parameters.length - 1].dotDotDotToken !== undefined;
|
||||
}
|
||||
|
||||
export function isLiteralKind(kind: SyntaxKind): boolean {
|
||||
return SyntaxKind.FirstLiteralToken <= kind && kind <= SyntaxKind.LastLiteralToken;
|
||||
}
|
||||
|
||||
export function isTextualLiteralKind(kind: SyntaxKind): boolean {
|
||||
return kind === SyntaxKind.StringLiteral || kind === SyntaxKind.NoSubstitutionTemplateLiteral;
|
||||
}
|
||||
|
||||
export function isTemplateLiteralKind(kind: SyntaxKind): boolean {
|
||||
return SyntaxKind.FirstTemplateToken <= kind && kind <= SyntaxKind.LastTemplateToken;
|
||||
}
|
||||
|
||||
export function isBindingPattern(node: Node) {
|
||||
return node.kind === SyntaxKind.ArrayBindingPattern || node.kind === SyntaxKind.ObjectBindingPattern;
|
||||
}
|
||||
|
||||
export function isInAmbientContext(node: Node): boolean {
|
||||
while (node) {
|
||||
if (node.flags & (NodeFlags.Ambient | NodeFlags.DeclarationFile)) return true;
|
||||
node = node.parent;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export function isDeclaration(node: Node): boolean {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.TypeParameter:
|
||||
case SyntaxKind.Parameter:
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
case SyntaxKind.BindingElement:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
case SyntaxKind.ShorthandPropertyAssignment:
|
||||
case SyntaxKind.EnumMember:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
case SyntaxKind.ImportDeclaration:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export function isStatement(n: Node): boolean {
|
||||
switch(n.kind) {
|
||||
case SyntaxKind.BreakStatement:
|
||||
case SyntaxKind.ContinueStatement:
|
||||
case SyntaxKind.DebuggerStatement:
|
||||
case SyntaxKind.DoStatement:
|
||||
case SyntaxKind.ExpressionStatement:
|
||||
case SyntaxKind.EmptyStatement:
|
||||
case SyntaxKind.ForInStatement:
|
||||
case SyntaxKind.ForStatement:
|
||||
case SyntaxKind.IfStatement:
|
||||
case SyntaxKind.LabeledStatement:
|
||||
case SyntaxKind.ReturnStatement:
|
||||
case SyntaxKind.SwitchStatement:
|
||||
case SyntaxKind.ThrowKeyword:
|
||||
case SyntaxKind.TryStatement:
|
||||
case SyntaxKind.VariableStatement:
|
||||
case SyntaxKind.WhileStatement:
|
||||
case SyntaxKind.WithStatement:
|
||||
case SyntaxKind.ExportAssignment:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// True if the given identifier, string literal, or number literal is the name of a declaration node
|
||||
export function isDeclarationOrFunctionExpressionOrCatchVariableName(name: Node): boolean {
|
||||
if (name.kind !== SyntaxKind.Identifier && name.kind !== SyntaxKind.StringLiteral && name.kind !== SyntaxKind.NumericLiteral) {
|
||||
return false;
|
||||
}
|
||||
function ensureDirectoriesExist(directoryPath: string) {
|
||||
if (directoryPath.length > getRootLength(directoryPath) && !directoryExists(directoryPath)) {
|
||||
var parentDirectory = getDirectoryPath(directoryPath);
|
||||
ensureDirectoriesExist(parentDirectory);
|
||||
sys.createDirectory(directoryPath);
|
||||
}
|
||||
}
|
||||
|
||||
var parent = name.parent;
|
||||
if (isDeclaration(parent) || parent.kind === SyntaxKind.FunctionExpression) {
|
||||
return (<Declaration>parent).name === name;
|
||||
}
|
||||
|
||||
if (parent.kind === SyntaxKind.CatchClause) {
|
||||
return (<CatchClause>parent).name === name;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
export function getClassBaseTypeNode(node: ClassDeclaration) {
|
||||
var heritageClause = getHeritageClause(node.heritageClauses, SyntaxKind.ExtendsKeyword);
|
||||
return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined;
|
||||
}
|
||||
|
||||
export function getClassImplementedTypeNodes(node: ClassDeclaration) {
|
||||
var heritageClause = getHeritageClause(node.heritageClauses, SyntaxKind.ImplementsKeyword);
|
||||
return heritageClause ? heritageClause.types : undefined;
|
||||
}
|
||||
|
||||
export function getInterfaceBaseTypeNodes(node: InterfaceDeclaration) {
|
||||
var heritageClause = getHeritageClause(node.heritageClauses, SyntaxKind.ExtendsKeyword);
|
||||
return heritageClause ? heritageClause.types : undefined;
|
||||
}
|
||||
|
||||
export function getHeritageClause(clauses: NodeArray<HeritageClause>, kind: SyntaxKind) {
|
||||
if (clauses) {
|
||||
for (var i = 0, n = clauses.length; i < n; i++) {
|
||||
if (clauses[i].token === kind) {
|
||||
return clauses[i];
|
||||
try {
|
||||
ensureDirectoriesExist(getDirectoryPath(normalizePath(fileName)));
|
||||
sys.writeFile(fileName, data, writeByteOrderMark);
|
||||
}
|
||||
catch (e) {
|
||||
if (onError) {
|
||||
onError(e.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
return {
|
||||
getSourceFile,
|
||||
getDefaultLibFilename: options => combinePaths(getDirectoryPath(normalizePath(sys.getExecutingFilePath())), options.target === ScriptTarget.ES6 ? "lib.es6.d.ts" : "lib.d.ts"),
|
||||
writeFile,
|
||||
getCurrentDirectory: () => currentDirectory || (currentDirectory = sys.getCurrentDirectory()),
|
||||
useCaseSensitiveFileNames: () => sys.useCaseSensitiveFileNames,
|
||||
getCanonicalFileName,
|
||||
getNewLine: () => sys.newLine
|
||||
};
|
||||
}
|
||||
|
||||
export function tryResolveScriptReference(program: Program, sourceFile: SourceFile, reference: FileReference) {
|
||||
if (!program.getCompilerOptions().noResolve) {
|
||||
var referenceFileName = isRootedDiskPath(reference.filename) ? reference.filename : combinePaths(getDirectoryPath(sourceFile.filename), reference.filename);
|
||||
referenceFileName = getNormalizedAbsolutePath(referenceFileName, program.getCompilerHost().getCurrentDirectory());
|
||||
return program.getSourceFile(referenceFileName);
|
||||
}
|
||||
}
|
||||
|
||||
export function getAncestor(node: Node, kind: SyntaxKind): Node {
|
||||
switch (kind) {
|
||||
// special-cases that can be come first
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
while (node) {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
return <ClassDeclaration>node;
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
case SyntaxKind.ImportDeclaration:
|
||||
// early exit cases - declarations cannot be nested in classes
|
||||
return undefined;
|
||||
default:
|
||||
node = node.parent;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
while (node) {
|
||||
if (node.kind === kind) {
|
||||
return node;
|
||||
}
|
||||
node = node.parent;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const enum ParsingContext {
|
||||
SourceElements, // Elements in source file
|
||||
@@ -940,70 +388,8 @@ module ts {
|
||||
case ParsingContext.HeritageClauses: return Diagnostics.Unexpected_token_expected;
|
||||
}
|
||||
};
|
||||
|
||||
export interface ReferencePathMatchResult {
|
||||
fileReference?: FileReference
|
||||
diagnosticMessage?: DiagnosticMessage
|
||||
isNoDefaultLib?: boolean
|
||||
}
|
||||
|
||||
export function getFileReferenceFromReferencePath(comment: string, commentRange: CommentRange): ReferencePathMatchResult {
|
||||
var simpleReferenceRegEx = /^\/\/\/\s*<reference\s+/gim;
|
||||
var isNoDefaultLibRegEx = /^(\/\/\/\s*<reference\s+no-default-lib\s*=\s*)('|")(.+?)\2\s*\/>/gim;
|
||||
if (simpleReferenceRegEx.exec(comment)) {
|
||||
if (isNoDefaultLibRegEx.exec(comment)) {
|
||||
return {
|
||||
isNoDefaultLib: true
|
||||
}
|
||||
}
|
||||
else {
|
||||
var matchResult = fullTripleSlashReferencePathRegEx.exec(comment);
|
||||
if (matchResult) {
|
||||
var start = commentRange.pos;
|
||||
var end = commentRange.end;
|
||||
return {
|
||||
fileReference: {
|
||||
pos: start,
|
||||
end: end,
|
||||
filename: matchResult[3]
|
||||
},
|
||||
isNoDefaultLib: false
|
||||
};
|
||||
}
|
||||
else {
|
||||
return {
|
||||
diagnosticMessage: Diagnostics.Invalid_reference_directive_syntax,
|
||||
isNoDefaultLib: false
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function isKeyword(token: SyntaxKind): boolean {
|
||||
return SyntaxKind.FirstKeyword <= token && token <= SyntaxKind.LastKeyword;
|
||||
}
|
||||
|
||||
export function isTrivia(token: SyntaxKind) {
|
||||
return SyntaxKind.FirstTriviaToken <= token && token <= SyntaxKind.LastTriviaToken;
|
||||
}
|
||||
|
||||
export function isModifier(token: SyntaxKind): boolean {
|
||||
switch (token) {
|
||||
case SyntaxKind.PublicKeyword:
|
||||
case SyntaxKind.PrivateKeyword:
|
||||
case SyntaxKind.ProtectedKeyword:
|
||||
case SyntaxKind.StaticKeyword:
|
||||
case SyntaxKind.ExportKeyword:
|
||||
case SyntaxKind.DeclareKeyword:
|
||||
case SyntaxKind.ConstKeyword:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export function modifierToFlag(token: SyntaxKind): NodeFlags {
|
||||
|
||||
export function modifierToFlag(token: SyntaxKind): NodeFlags {
|
||||
switch (token) {
|
||||
case SyntaxKind.StaticKeyword: return NodeFlags.Static;
|
||||
case SyntaxKind.PublicKeyword: return NodeFlags.Public;
|
||||
@@ -1016,7 +402,41 @@ module ts {
|
||||
return 0;
|
||||
}
|
||||
|
||||
export function createSourceFile(filename: string, sourceText: string, languageVersion: ScriptTarget, version: string, isOpen: boolean = false): SourceFile {
|
||||
function fixupParentReferences(sourceFile: SourceFile) {
|
||||
// normally parent references are set during binding.
|
||||
// however here SourceFile data is used only for syntactic features so running the whole binding process is an overhead.
|
||||
// walk over the nodes and set parent references
|
||||
var parent: Node = sourceFile;
|
||||
function walk(n: Node): void {
|
||||
// walk down setting parents that differ from the parent we think it should be. This
|
||||
// allows us to quickly bail out of setting parents for subtrees during incremental
|
||||
// parsing
|
||||
if (n.parent !== parent) {
|
||||
n.parent = parent;
|
||||
|
||||
var saveParent = parent;
|
||||
parent = n;
|
||||
forEachChild(n, walk);
|
||||
parent = saveParent;
|
||||
}
|
||||
}
|
||||
|
||||
forEachChild(sourceFile, walk);
|
||||
}
|
||||
|
||||
export function isEvalOrArgumentsIdentifier(node: Node): boolean {
|
||||
return node.kind === SyntaxKind.Identifier &&
|
||||
((<Identifier>node).text === "eval" || (<Identifier>node).text === "arguments");
|
||||
}
|
||||
|
||||
/// Should be called only on prologue directives (isPrologueDirective(node) should be true)
|
||||
function isUseStrictPrologueDirective(sourceFile: SourceFile, node: Node): boolean {
|
||||
Debug.assert(isPrologueDirective(node));
|
||||
var nodeText = getSourceTextOfNodeFromSourceFile(sourceFile,(<ExpressionStatement>node).expression);
|
||||
return nodeText === '"use strict"' || nodeText === "'use strict'";
|
||||
}
|
||||
|
||||
export function createSourceFile(filename: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes = false): SourceFile {
|
||||
var parsingContext: ParsingContext;
|
||||
var identifiers: Map<string> = {};
|
||||
var identifierCount = 0;
|
||||
@@ -1132,10 +552,13 @@ module ts {
|
||||
|
||||
sourceFile.nodeCount = nodeCount;
|
||||
sourceFile.identifierCount = identifierCount;
|
||||
sourceFile.version = version;
|
||||
sourceFile.isOpen = isOpen;
|
||||
sourceFile.languageVersion = languageVersion;
|
||||
sourceFile.identifiers = identifiers;
|
||||
|
||||
if (setParentNodes) {
|
||||
fixupParentReferences(sourceFile);
|
||||
}
|
||||
|
||||
return sourceFile;
|
||||
|
||||
function setContextFlag(val: Boolean, flag: ParserContextFlags) {
|
||||
@@ -1434,7 +857,7 @@ module ts {
|
||||
// flag so that we don't mark any subsequent nodes.
|
||||
if (parseErrorBeforeNextFinishedNode) {
|
||||
parseErrorBeforeNextFinishedNode = false;
|
||||
node.parserContextFlags |= ParserContextFlags.ContainsError;
|
||||
node.parserContextFlags |= ParserContextFlags.ThisNodeHasError;
|
||||
}
|
||||
|
||||
return node;
|
||||
@@ -1716,7 +1139,7 @@ module ts {
|
||||
// test elements only if we are not already in strict mode
|
||||
if (checkForStrictMode && !inStrictModeContext()) {
|
||||
if (isPrologueDirective(element)) {
|
||||
if (isUseStrictPrologueDirective(element)) {
|
||||
if (isUseStrictPrologueDirective(sourceFile, element)) {
|
||||
setStrictModeContext(true);
|
||||
checkForStrictMode = false;
|
||||
}
|
||||
@@ -3701,27 +3124,25 @@ module ts {
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
function isLabel(): boolean {
|
||||
return isIdentifier() && lookAhead(nextTokenIsColonToken);
|
||||
}
|
||||
function parseExpressionOrLabeledStatement(): ExpressionStatement | LabeledStatement {
|
||||
// Avoiding having to do the lookahead for a labeled statement by just trying to parse
|
||||
// out an expression, seeing if it is identifier and then seeing if it is followed by
|
||||
// a colon.
|
||||
var fullStart = scanner.getStartPos();
|
||||
var expression = allowInAnd(parseExpression);
|
||||
|
||||
function nextTokenIsColonToken() {
|
||||
return nextToken() === SyntaxKind.ColonToken;
|
||||
}
|
||||
|
||||
function parseLabeledStatement(): LabeledStatement {
|
||||
var node = <LabeledStatement>createNode(SyntaxKind.LabeledStatement);
|
||||
node.label = parseIdentifier();
|
||||
parseExpected(SyntaxKind.ColonToken);
|
||||
node.statement = parseStatement();
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
function parseExpressionStatement(): ExpressionStatement {
|
||||
var node = <ExpressionStatement>createNode(SyntaxKind.ExpressionStatement);
|
||||
node.expression = allowInAnd(parseExpression);
|
||||
parseSemicolon();
|
||||
return finishNode(node);
|
||||
if (expression.kind === SyntaxKind.Identifier && parseOptional(SyntaxKind.ColonToken)) {
|
||||
var labeledStatement = <LabeledStatement>createNode(SyntaxKind.LabeledStatement, fullStart);
|
||||
labeledStatement.label = <Identifier>expression;
|
||||
labeledStatement.statement = parseStatement();
|
||||
return finishNode(labeledStatement);
|
||||
}
|
||||
else {
|
||||
var expressionStatement = <ExpressionStatement>createNode(SyntaxKind.ExpressionStatement, fullStart);
|
||||
expressionStatement.expression = expression;
|
||||
parseSemicolon();
|
||||
return finishNode(expressionStatement);
|
||||
}
|
||||
}
|
||||
|
||||
function isStatement(inErrorRecovery: boolean): boolean {
|
||||
@@ -3842,9 +3263,7 @@ module ts {
|
||||
}
|
||||
// Else parse it like identifier - fall through
|
||||
default:
|
||||
return isLabel()
|
||||
? parseLabeledStatement()
|
||||
: parseExpressionStatement();
|
||||
return parseExpressionOrLabeledStatement();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3859,38 +3278,39 @@ module ts {
|
||||
|
||||
// DECLARATIONS
|
||||
|
||||
function parseBindingElement(context: ParsingContext): BindingElement {
|
||||
if (context === ParsingContext.ArrayBindingElements && token === SyntaxKind.CommaToken) {
|
||||
function parseArrayBindingElement(): BindingElement {
|
||||
if (token === SyntaxKind.CommaToken) {
|
||||
return <BindingElement>createNode(SyntaxKind.OmittedExpression);
|
||||
}
|
||||
|
||||
var node = <BindingElement>createNode(SyntaxKind.BindingElement);
|
||||
if (context === ParsingContext.ObjectBindingElements) {
|
||||
// TODO(andersh): Handle computed properties
|
||||
var id = parsePropertyName();
|
||||
if (id.kind === SyntaxKind.Identifier && token !== SyntaxKind.ColonToken) {
|
||||
node.name = <Identifier>id;
|
||||
}
|
||||
else {
|
||||
parseExpected(SyntaxKind.ColonToken);
|
||||
node.propertyName = <Identifier>id;
|
||||
node.name = parseIdentifierOrPattern();
|
||||
}
|
||||
}
|
||||
else {
|
||||
node.name = parseIdentifierOrPattern();
|
||||
}
|
||||
node.name = parseIdentifierOrPattern();
|
||||
node.initializer = parseInitializer(/*inParameter*/ false);
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
function parseBindingList(context: ParsingContext): NodeArray<BindingElement> {
|
||||
return parseDelimitedList(context, () => parseBindingElement(context));
|
||||
function parseObjectBindingElement(): BindingElement {
|
||||
var node = <BindingElement>createNode(SyntaxKind.BindingElement);
|
||||
|
||||
// TODO(andersh): Handle computed properties
|
||||
var id = parsePropertyName();
|
||||
if (id.kind === SyntaxKind.Identifier && token !== SyntaxKind.ColonToken) {
|
||||
node.name = <Identifier>id;
|
||||
}
|
||||
else {
|
||||
parseExpected(SyntaxKind.ColonToken);
|
||||
node.propertyName = <Identifier>id;
|
||||
node.name = parseIdentifierOrPattern();
|
||||
}
|
||||
|
||||
node.initializer = parseInitializer(/*inParameter*/ false);
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
function parseObjectBindingPattern(): BindingPattern {
|
||||
var node = <BindingPattern>createNode(SyntaxKind.ObjectBindingPattern);
|
||||
parseExpected(SyntaxKind.OpenBraceToken);
|
||||
node.elements = parseBindingList(ParsingContext.ObjectBindingElements);
|
||||
node.elements = parseDelimitedList(ParsingContext.ObjectBindingElements, parseObjectBindingElement);
|
||||
parseExpected(SyntaxKind.CloseBraceToken);
|
||||
return finishNode(node);
|
||||
}
|
||||
@@ -3898,7 +3318,7 @@ module ts {
|
||||
function parseArrayBindingPattern(): BindingPattern {
|
||||
var node = <BindingPattern>createNode(SyntaxKind.ArrayBindingPattern);
|
||||
parseExpected(SyntaxKind.OpenBracketToken);
|
||||
node.elements = parseBindingList(ParsingContext.ArrayBindingElements);
|
||||
node.elements = parseDelimitedList(ParsingContext.ArrayBindingElements, parseArrayBindingElement);
|
||||
parseExpected(SyntaxKind.CloseBracketToken);
|
||||
return finishNode(node);
|
||||
}
|
||||
@@ -5931,8 +5351,13 @@ module ts {
|
||||
|
||||
// We haven't looked for this file, do so now and cache result
|
||||
var file = filesByName[canonicalName] = host.getSourceFile(filename, options.target, hostErrorMessage => {
|
||||
errors.push(createFileDiagnostic(refFile, refStart, refLength,
|
||||
Diagnostics.Cannot_read_file_0_Colon_1, filename, hostErrorMessage));
|
||||
if (refFile) {
|
||||
errors.push(createFileDiagnostic(refFile, refStart, refLength,
|
||||
Diagnostics.Cannot_read_file_0_Colon_1, filename, hostErrorMessage));
|
||||
}
|
||||
else {
|
||||
errors.push(createCompilerDiagnostic(Diagnostics.Cannot_read_file_0_Colon_1, filename, hostErrorMessage));
|
||||
}
|
||||
});
|
||||
if (file) {
|
||||
seenNoDefaultLib = seenNoDefaultLib || file.hasNoDefaultLib;
|
||||
|
||||
+85
-5
@@ -333,10 +333,14 @@ module ts {
|
||||
var ch = text.charCodeAt(pos);
|
||||
switch (ch) {
|
||||
case CharacterCodes.carriageReturn:
|
||||
if (text.charCodeAt(pos + 1) === CharacterCodes.lineFeed) pos++;
|
||||
if (text.charCodeAt(pos + 1) === CharacterCodes.lineFeed) {
|
||||
pos++;
|
||||
}
|
||||
case CharacterCodes.lineFeed:
|
||||
pos++;
|
||||
if (stopAfterLineBreak) return pos;
|
||||
if (stopAfterLineBreak) {
|
||||
return pos;
|
||||
}
|
||||
continue;
|
||||
case CharacterCodes.tab:
|
||||
case CharacterCodes.verticalTab:
|
||||
@@ -367,6 +371,16 @@ module ts {
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
||||
case CharacterCodes.lessThan:
|
||||
case CharacterCodes.equals:
|
||||
case CharacterCodes.greaterThan:
|
||||
if (isConflictMarkerTrivia(text, pos)) {
|
||||
pos = scanConflictMarkerTrivia(text, pos);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if (ch > CharacterCodes.maxAsciiCharacter && (isWhiteSpace(ch) || isLineBreak(ch))) {
|
||||
pos++;
|
||||
@@ -378,6 +392,39 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function isConflictMarkerTrivia(text: string, pos: number) {
|
||||
// Conflict markers must be at the start of a line.
|
||||
if (pos > 0 && isLineBreak(text.charCodeAt(pos - 1))) {
|
||||
var ch = text.charCodeAt(pos);
|
||||
|
||||
// All conflict markers consist of the same character repeated seven times. If it is
|
||||
// a <<<<<<< or >>>>>>> marker then it is also followd by a space.
|
||||
var markerLength = "<<<<<<<".length;
|
||||
|
||||
if ((pos + markerLength) < text.length) {
|
||||
for (var i = 0, n = markerLength; i < n; i++) {
|
||||
if (text.charCodeAt(pos + i) !== ch) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return ch === CharacterCodes.equals ||
|
||||
text.charCodeAt(pos + markerLength) === CharacterCodes.space;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function scanConflictMarkerTrivia(text: string, pos: number) {
|
||||
var len = text.length;
|
||||
while (pos < len && !isLineBreak(text.charCodeAt(pos))) {
|
||||
pos++;
|
||||
}
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
||||
// Extract comments from the given source text starting at the given position. If trailing is false, whitespace is skipped until
|
||||
// the first line break and comments between that location and the next token are returned. If trailing is true, comments occurring
|
||||
// between the given position and the next line break are returned. The return value is an array containing a TextRange for each
|
||||
@@ -640,14 +687,14 @@ module ts {
|
||||
|
||||
// Speculated ECMAScript 6 Spec 11.8.6.1:
|
||||
// <CR><LF> and <CR> LineTerminatorSequences are normalized to <LF> for Template Values
|
||||
// An explicit EscapeSequence is needed to include a <CR> or <CR><LF> sequence.
|
||||
if (currChar === CharacterCodes.carriageReturn) {
|
||||
contents += text.substring(start, pos);
|
||||
pos++;
|
||||
|
||||
if (pos + 1 < len && text.charCodeAt(pos + 1) === CharacterCodes.lineFeed) {
|
||||
if (pos < len && text.charCodeAt(pos) === CharacterCodes.lineFeed) {
|
||||
pos++;
|
||||
}
|
||||
pos++;
|
||||
|
||||
contents += "\n";
|
||||
start = pos;
|
||||
continue;
|
||||
@@ -1010,6 +1057,17 @@ module ts {
|
||||
case CharacterCodes.semicolon:
|
||||
return pos++, token = SyntaxKind.SemicolonToken;
|
||||
case CharacterCodes.lessThan:
|
||||
if (isConflictMarkerTrivia(text, pos)) {
|
||||
error(Diagnostics.Merge_conflict_marker_encountered);
|
||||
pos = scanConflictMarkerTrivia(text, pos);
|
||||
if (skipTrivia) {
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
return token = SyntaxKind.ConflictMarkerTrivia;
|
||||
}
|
||||
}
|
||||
|
||||
if (text.charCodeAt(pos + 1) === CharacterCodes.lessThan) {
|
||||
if (text.charCodeAt(pos + 2) === CharacterCodes.equals) {
|
||||
return pos += 3, token = SyntaxKind.LessThanLessThanEqualsToken;
|
||||
@@ -1021,6 +1079,17 @@ module ts {
|
||||
}
|
||||
return pos++, token = SyntaxKind.LessThanToken;
|
||||
case CharacterCodes.equals:
|
||||
if (isConflictMarkerTrivia(text, pos)) {
|
||||
error(Diagnostics.Merge_conflict_marker_encountered);
|
||||
pos = scanConflictMarkerTrivia(text, pos);
|
||||
if (skipTrivia) {
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
return token = SyntaxKind.ConflictMarkerTrivia;
|
||||
}
|
||||
}
|
||||
|
||||
if (text.charCodeAt(pos + 1) === CharacterCodes.equals) {
|
||||
if (text.charCodeAt(pos + 2) === CharacterCodes.equals) {
|
||||
return pos += 3, token = SyntaxKind.EqualsEqualsEqualsToken;
|
||||
@@ -1032,6 +1101,17 @@ module ts {
|
||||
}
|
||||
return pos++, token = SyntaxKind.EqualsToken;
|
||||
case CharacterCodes.greaterThan:
|
||||
if (isConflictMarkerTrivia(text, pos)) {
|
||||
error(Diagnostics.Merge_conflict_marker_encountered);
|
||||
pos = scanConflictMarkerTrivia(text, pos);
|
||||
if (skipTrivia) {
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
return token = SyntaxKind.ConflictMarkerTrivia;
|
||||
}
|
||||
}
|
||||
|
||||
return pos++, token = SyntaxKind.GreaterThanToken;
|
||||
case CharacterCodes.question:
|
||||
return pos++, token = SyntaxKind.QuestionToken;
|
||||
|
||||
+234
-231
@@ -1,252 +1,255 @@
|
||||
|
||||
interface System {
|
||||
args: string[];
|
||||
newLine: string;
|
||||
useCaseSensitiveFileNames: boolean;
|
||||
write(s: string): void;
|
||||
readFile(fileName: string, encoding?: string): string;
|
||||
writeFile(fileName: string, data: string, writeByteOrderMark?: boolean): void;
|
||||
watchFile?(fileName: string, callback: (fileName: string) => void): FileWatcher;
|
||||
resolvePath(path: string): string;
|
||||
fileExists(path: string): boolean;
|
||||
directoryExists(path: string): boolean;
|
||||
createDirectory(directoryName: string): void;
|
||||
getExecutingFilePath(): string;
|
||||
getCurrentDirectory(): string;
|
||||
getMemoryUsage?(): number;
|
||||
exit(exitCode?: number): void;
|
||||
}
|
||||
module ts {
|
||||
export interface System {
|
||||
args: string[];
|
||||
newLine: string;
|
||||
useCaseSensitiveFileNames: boolean;
|
||||
write(s: string): void;
|
||||
readFile(fileName: string, encoding?: string): string;
|
||||
writeFile(fileName: string, data: string, writeByteOrderMark?: boolean): void;
|
||||
watchFile? (fileName: string, callback: (fileName: string) => void): FileWatcher;
|
||||
resolvePath(path: string): string;
|
||||
fileExists(path: string): boolean;
|
||||
directoryExists(path: string): boolean;
|
||||
createDirectory(directoryName: string): void;
|
||||
getExecutingFilePath(): string;
|
||||
getCurrentDirectory(): string;
|
||||
getMemoryUsage? (): number;
|
||||
exit(exitCode?: number): void;
|
||||
}
|
||||
|
||||
interface FileWatcher {
|
||||
close(): void;
|
||||
}
|
||||
export interface FileWatcher {
|
||||
close(): void;
|
||||
}
|
||||
|
||||
declare var require: any;
|
||||
declare var module: any;
|
||||
declare var process: any;
|
||||
declare var global: any;
|
||||
declare var require: any;
|
||||
declare var module: any;
|
||||
declare var process: any;
|
||||
declare var global: any;
|
||||
declare var __filename: string;
|
||||
|
||||
var sys: System = (function () {
|
||||
export var sys: System = (function () {
|
||||
|
||||
function getWScriptSystem(): System {
|
||||
function getWScriptSystem(): System {
|
||||
|
||||
var fso = new ActiveXObject("Scripting.FileSystemObject");
|
||||
var fso = new ActiveXObject("Scripting.FileSystemObject");
|
||||
|
||||
var fileStream = new ActiveXObject("ADODB.Stream");
|
||||
fileStream.Type = 2 /*text*/;
|
||||
var fileStream = new ActiveXObject("ADODB.Stream");
|
||||
fileStream.Type = 2 /*text*/;
|
||||
|
||||
var binaryStream = new ActiveXObject("ADODB.Stream");
|
||||
binaryStream.Type = 1 /*binary*/;
|
||||
var binaryStream = new ActiveXObject("ADODB.Stream");
|
||||
binaryStream.Type = 1 /*binary*/;
|
||||
|
||||
var args: string[] = [];
|
||||
for (var i = 0; i < WScript.Arguments.length; i++) {
|
||||
args[i] = WScript.Arguments.Item(i);
|
||||
}
|
||||
|
||||
function readFile(fileName: string, encoding?: string): string {
|
||||
if (!fso.FileExists(fileName)) {
|
||||
return undefined;
|
||||
var args: string[] = [];
|
||||
for (var i = 0; i < WScript.Arguments.length; i++) {
|
||||
args[i] = WScript.Arguments.Item(i);
|
||||
}
|
||||
fileStream.Open();
|
||||
try {
|
||||
if (encoding) {
|
||||
fileStream.Charset = encoding;
|
||||
fileStream.LoadFromFile(fileName);
|
||||
|
||||
function readFile(fileName: string, encoding?: string): string {
|
||||
if (!fso.FileExists(fileName)) {
|
||||
return undefined;
|
||||
}
|
||||
else {
|
||||
// Load file and read the first two bytes into a string with no interpretation
|
||||
fileStream.Charset = "x-ansi";
|
||||
fileStream.LoadFromFile(fileName);
|
||||
var bom = fileStream.ReadText(2) || "";
|
||||
// Position must be at 0 before encoding can be changed
|
||||
fileStream.Position = 0;
|
||||
// [0xFF,0xFE] and [0xFE,0xFF] mean utf-16 (little or big endian), otherwise default to utf-8
|
||||
fileStream.Charset = bom.length >= 2 && (bom.charCodeAt(0) === 0xFF && bom.charCodeAt(1) === 0xFE || bom.charCodeAt(0) === 0xFE && bom.charCodeAt(1) === 0xFF) ? "unicode" : "utf-8";
|
||||
}
|
||||
// ReadText method always strips byte order mark from resulting string
|
||||
return fileStream.ReadText();
|
||||
}
|
||||
catch (e) {
|
||||
throw e;
|
||||
}
|
||||
finally {
|
||||
fileStream.Close();
|
||||
}
|
||||
}
|
||||
|
||||
function writeFile(fileName: string, data: string, writeByteOrderMark?: boolean): void {
|
||||
fileStream.Open();
|
||||
binaryStream.Open();
|
||||
try {
|
||||
// Write characters in UTF-8 encoding
|
||||
fileStream.Charset = "utf-8";
|
||||
fileStream.WriteText(data);
|
||||
// If we don't want the BOM, then skip it by setting the starting location to 3 (size of BOM).
|
||||
// If not, start from position 0, as the BOM will be added automatically when charset==utf8.
|
||||
if (writeByteOrderMark) {
|
||||
fileStream.Position = 0;
|
||||
}
|
||||
else {
|
||||
fileStream.Position = 3;
|
||||
}
|
||||
fileStream.CopyTo(binaryStream);
|
||||
binaryStream.SaveToFile(fileName, 2 /*overwrite*/);
|
||||
}
|
||||
finally {
|
||||
binaryStream.Close();
|
||||
fileStream.Close();
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
args,
|
||||
newLine: "\r\n",
|
||||
useCaseSensitiveFileNames: false,
|
||||
write(s: string): void {
|
||||
WScript.StdOut.Write(s);
|
||||
},
|
||||
readFile,
|
||||
writeFile,
|
||||
resolvePath(path: string): string {
|
||||
return fso.GetAbsolutePathName(path);
|
||||
},
|
||||
fileExists(path: string): boolean {
|
||||
return fso.FileExists(path);
|
||||
},
|
||||
directoryExists(path: string) {
|
||||
return fso.FolderExists(path);
|
||||
},
|
||||
createDirectory(directoryName: string) {
|
||||
if (!this.directoryExists(directoryName)) {
|
||||
fso.CreateFolder(directoryName);
|
||||
}
|
||||
},
|
||||
getExecutingFilePath() {
|
||||
return WScript.ScriptFullName;
|
||||
},
|
||||
getCurrentDirectory() {
|
||||
return new ActiveXObject("WScript.Shell").CurrentDirectory;
|
||||
},
|
||||
exit(exitCode?: number): void {
|
||||
fileStream.Open();
|
||||
try {
|
||||
WScript.Quit(exitCode);
|
||||
if (encoding) {
|
||||
fileStream.Charset = encoding;
|
||||
fileStream.LoadFromFile(fileName);
|
||||
}
|
||||
else {
|
||||
// Load file and read the first two bytes into a string with no interpretation
|
||||
fileStream.Charset = "x-ansi";
|
||||
fileStream.LoadFromFile(fileName);
|
||||
var bom = fileStream.ReadText(2) || "";
|
||||
// Position must be at 0 before encoding can be changed
|
||||
fileStream.Position = 0;
|
||||
// [0xFF,0xFE] and [0xFE,0xFF] mean utf-16 (little or big endian), otherwise default to utf-8
|
||||
fileStream.Charset = bom.length >= 2 && (bom.charCodeAt(0) === 0xFF && bom.charCodeAt(1) === 0xFE || bom.charCodeAt(0) === 0xFE && bom.charCodeAt(1) === 0xFF) ? "unicode" : "utf-8";
|
||||
}
|
||||
// ReadText method always strips byte order mark from resulting string
|
||||
return fileStream.ReadText();
|
||||
}
|
||||
catch (e) {
|
||||
throw e;
|
||||
}
|
||||
finally {
|
||||
fileStream.Close();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
function getNodeSystem(): System {
|
||||
var _fs = require("fs");
|
||||
var _path = require("path");
|
||||
var _os = require('os');
|
||||
|
||||
var platform: string = _os.platform();
|
||||
// win32\win64 are case insensitive platforms, MacOS (darwin) by default is also case insensitive
|
||||
var useCaseSensitiveFileNames = platform !== "win32" && platform !== "win64" && platform !== "darwin";
|
||||
|
||||
function readFile(fileName: string, encoding?: string): string {
|
||||
if (!_fs.existsSync(fileName)) {
|
||||
return undefined;
|
||||
}
|
||||
var buffer = _fs.readFileSync(fileName);
|
||||
var len = buffer.length;
|
||||
if (len >= 2 && buffer[0] === 0xFE && buffer[1] === 0xFF) {
|
||||
// Big endian UTF-16 byte order mark detected. Since big endian is not supported by node.js,
|
||||
// flip all byte pairs and treat as little endian.
|
||||
len &= ~1;
|
||||
for (var i = 0; i < len; i += 2) {
|
||||
var temp = buffer[i];
|
||||
buffer[i] = buffer[i + 1];
|
||||
buffer[i + 1] = temp;
|
||||
}
|
||||
return buffer.toString("utf16le", 2);
|
||||
}
|
||||
if (len >= 2 && buffer[0] === 0xFF && buffer[1] === 0xFE) {
|
||||
// Little endian UTF-16 byte order mark detected
|
||||
return buffer.toString("utf16le", 2);
|
||||
}
|
||||
if (len >= 3 && buffer[0] === 0xEF && buffer[1] === 0xBB && buffer[2] === 0xBF) {
|
||||
// UTF-8 byte order mark detected
|
||||
return buffer.toString("utf8", 3);
|
||||
}
|
||||
// Default is UTF-8 with no byte order mark
|
||||
return buffer.toString("utf8");
|
||||
}
|
||||
|
||||
function writeFile(fileName: string, data: string, writeByteOrderMark?: boolean): void {
|
||||
// If a BOM is required, emit one
|
||||
if (writeByteOrderMark) {
|
||||
data = '\uFEFF' + data;
|
||||
}
|
||||
|
||||
_fs.writeFileSync(fileName, data, "utf8");
|
||||
}
|
||||
|
||||
return {
|
||||
args: process.argv.slice(2),
|
||||
newLine: _os.EOL,
|
||||
useCaseSensitiveFileNames: useCaseSensitiveFileNames,
|
||||
write(s: string): void {
|
||||
// 1 is a standard descriptor for stdout
|
||||
_fs.writeSync(1, s);
|
||||
},
|
||||
readFile,
|
||||
writeFile,
|
||||
watchFile: (fileName, callback) => {
|
||||
// watchFile polls a file every 250ms, picking up file notifications.
|
||||
_fs.watchFile(fileName, { persistent: true, interval: 250 }, fileChanged);
|
||||
|
||||
return {
|
||||
close() { _fs.unwatchFile(fileName, fileChanged); }
|
||||
};
|
||||
|
||||
function fileChanged(curr: any, prev: any) {
|
||||
if (+curr.mtime <= +prev.mtime) {
|
||||
return;
|
||||
function writeFile(fileName: string, data: string, writeByteOrderMark?: boolean): void {
|
||||
fileStream.Open();
|
||||
binaryStream.Open();
|
||||
try {
|
||||
// Write characters in UTF-8 encoding
|
||||
fileStream.Charset = "utf-8";
|
||||
fileStream.WriteText(data);
|
||||
// If we don't want the BOM, then skip it by setting the starting location to 3 (size of BOM).
|
||||
// If not, start from position 0, as the BOM will be added automatically when charset==utf8.
|
||||
if (writeByteOrderMark) {
|
||||
fileStream.Position = 0;
|
||||
}
|
||||
|
||||
callback(fileName);
|
||||
};
|
||||
},
|
||||
resolvePath: function (path: string): string {
|
||||
return _path.resolve(path);
|
||||
},
|
||||
fileExists(path: string): boolean {
|
||||
return _fs.existsSync(path);
|
||||
},
|
||||
directoryExists(path: string) {
|
||||
return _fs.existsSync(path) && _fs.statSync(path).isDirectory();
|
||||
},
|
||||
createDirectory(directoryName: string) {
|
||||
if (!this.directoryExists(directoryName)) {
|
||||
_fs.mkdirSync(directoryName);
|
||||
else {
|
||||
fileStream.Position = 3;
|
||||
}
|
||||
fileStream.CopyTo(binaryStream);
|
||||
binaryStream.SaveToFile(fileName, 2 /*overwrite*/);
|
||||
}
|
||||
},
|
||||
getExecutingFilePath() {
|
||||
return process.mainModule.filename;
|
||||
},
|
||||
getCurrentDirectory() {
|
||||
return (<any>process).cwd();
|
||||
},
|
||||
getMemoryUsage() {
|
||||
if (global.gc) {
|
||||
global.gc();
|
||||
finally {
|
||||
binaryStream.Close();
|
||||
fileStream.Close();
|
||||
}
|
||||
return process.memoryUsage().heapUsed;
|
||||
},
|
||||
exit(exitCode?: number): void {
|
||||
process.exit(exitCode);
|
||||
}
|
||||
};
|
||||
}
|
||||
if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") {
|
||||
return getWScriptSystem();
|
||||
}
|
||||
else if (typeof module !== "undefined" && module.exports) {
|
||||
return getNodeSystem();
|
||||
}
|
||||
else {
|
||||
return undefined; // Unsupported host
|
||||
}
|
||||
})();
|
||||
|
||||
return {
|
||||
args,
|
||||
newLine: "\r\n",
|
||||
useCaseSensitiveFileNames: false,
|
||||
write(s: string): void {
|
||||
WScript.StdOut.Write(s);
|
||||
},
|
||||
readFile,
|
||||
writeFile,
|
||||
resolvePath(path: string): string {
|
||||
return fso.GetAbsolutePathName(path);
|
||||
},
|
||||
fileExists(path: string): boolean {
|
||||
return fso.FileExists(path);
|
||||
},
|
||||
directoryExists(path: string) {
|
||||
return fso.FolderExists(path);
|
||||
},
|
||||
createDirectory(directoryName: string) {
|
||||
if (!this.directoryExists(directoryName)) {
|
||||
fso.CreateFolder(directoryName);
|
||||
}
|
||||
},
|
||||
getExecutingFilePath() {
|
||||
return WScript.ScriptFullName;
|
||||
},
|
||||
getCurrentDirectory() {
|
||||
return new ActiveXObject("WScript.Shell").CurrentDirectory;
|
||||
},
|
||||
exit(exitCode?: number): void {
|
||||
try {
|
||||
WScript.Quit(exitCode);
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
function getNodeSystem(): System {
|
||||
var _fs = require("fs");
|
||||
var _path = require("path");
|
||||
var _os = require('os');
|
||||
|
||||
var platform: string = _os.platform();
|
||||
// win32\win64 are case insensitive platforms, MacOS (darwin) by default is also case insensitive
|
||||
var useCaseSensitiveFileNames = platform !== "win32" && platform !== "win64" && platform !== "darwin";
|
||||
|
||||
function readFile(fileName: string, encoding?: string): string {
|
||||
if (!_fs.existsSync(fileName)) {
|
||||
return undefined;
|
||||
}
|
||||
var buffer = _fs.readFileSync(fileName);
|
||||
var len = buffer.length;
|
||||
if (len >= 2 && buffer[0] === 0xFE && buffer[1] === 0xFF) {
|
||||
// Big endian UTF-16 byte order mark detected. Since big endian is not supported by node.js,
|
||||
// flip all byte pairs and treat as little endian.
|
||||
len &= ~1;
|
||||
for (var i = 0; i < len; i += 2) {
|
||||
var temp = buffer[i];
|
||||
buffer[i] = buffer[i + 1];
|
||||
buffer[i + 1] = temp;
|
||||
}
|
||||
return buffer.toString("utf16le", 2);
|
||||
}
|
||||
if (len >= 2 && buffer[0] === 0xFF && buffer[1] === 0xFE) {
|
||||
// Little endian UTF-16 byte order mark detected
|
||||
return buffer.toString("utf16le", 2);
|
||||
}
|
||||
if (len >= 3 && buffer[0] === 0xEF && buffer[1] === 0xBB && buffer[2] === 0xBF) {
|
||||
// UTF-8 byte order mark detected
|
||||
return buffer.toString("utf8", 3);
|
||||
}
|
||||
// Default is UTF-8 with no byte order mark
|
||||
return buffer.toString("utf8");
|
||||
}
|
||||
|
||||
function writeFile(fileName: string, data: string, writeByteOrderMark?: boolean): void {
|
||||
// If a BOM is required, emit one
|
||||
if (writeByteOrderMark) {
|
||||
data = '\uFEFF' + data;
|
||||
}
|
||||
|
||||
_fs.writeFileSync(fileName, data, "utf8");
|
||||
}
|
||||
|
||||
return {
|
||||
args: process.argv.slice(2),
|
||||
newLine: _os.EOL,
|
||||
useCaseSensitiveFileNames: useCaseSensitiveFileNames,
|
||||
write(s: string): void {
|
||||
// 1 is a standard descriptor for stdout
|
||||
_fs.writeSync(1, s);
|
||||
},
|
||||
readFile,
|
||||
writeFile,
|
||||
watchFile: (fileName, callback) => {
|
||||
// watchFile polls a file every 250ms, picking up file notifications.
|
||||
_fs.watchFile(fileName, { persistent: true, interval: 250 }, fileChanged);
|
||||
|
||||
return {
|
||||
close() { _fs.unwatchFile(fileName, fileChanged); }
|
||||
};
|
||||
|
||||
function fileChanged(curr: any, prev: any) {
|
||||
if (+curr.mtime <= +prev.mtime) {
|
||||
return;
|
||||
}
|
||||
|
||||
callback(fileName);
|
||||
};
|
||||
},
|
||||
resolvePath: function (path: string): string {
|
||||
return _path.resolve(path);
|
||||
},
|
||||
fileExists(path: string): boolean {
|
||||
return _fs.existsSync(path);
|
||||
},
|
||||
directoryExists(path: string) {
|
||||
return _fs.existsSync(path) && _fs.statSync(path).isDirectory();
|
||||
},
|
||||
createDirectory(directoryName: string) {
|
||||
if (!this.directoryExists(directoryName)) {
|
||||
_fs.mkdirSync(directoryName);
|
||||
}
|
||||
},
|
||||
getExecutingFilePath() {
|
||||
return __filename;
|
||||
},
|
||||
getCurrentDirectory() {
|
||||
return process.cwd();
|
||||
},
|
||||
getMemoryUsage() {
|
||||
if (global.gc) {
|
||||
global.gc();
|
||||
}
|
||||
return process.memoryUsage().heapUsed;
|
||||
},
|
||||
exit(exitCode?: number): void {
|
||||
process.exit(exitCode);
|
||||
}
|
||||
};
|
||||
}
|
||||
if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") {
|
||||
return getWScriptSystem();
|
||||
}
|
||||
else if (typeof module !== "undefined" && module.exports) {
|
||||
return getNodeSystem();
|
||||
}
|
||||
else {
|
||||
return undefined; // Unsupported host
|
||||
}
|
||||
})();
|
||||
}
|
||||
+6
-75
@@ -133,75 +133,6 @@ module ts {
|
||||
reportStatisticalValue(name, (time / 1000).toFixed(2) + "s");
|
||||
}
|
||||
|
||||
function createCompilerHost(options: CompilerOptions): CompilerHost {
|
||||
var currentDirectory: string;
|
||||
var existingDirectories: Map<boolean> = {};
|
||||
|
||||
function getCanonicalFileName(fileName: string): string {
|
||||
// if underlying system can distinguish between two files whose names differs only in cases then file name already in canonical form.
|
||||
// otherwise use toLowerCase as a canonical form.
|
||||
return sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase();
|
||||
}
|
||||
|
||||
// returned by CScript sys environment
|
||||
var unsupportedFileEncodingErrorCode = -2147024809;
|
||||
|
||||
function getSourceFile(filename: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile {
|
||||
try {
|
||||
var text = sys.readFile(filename, options.charset);
|
||||
}
|
||||
catch (e) {
|
||||
if (onError) {
|
||||
onError(e.number === unsupportedFileEncodingErrorCode ?
|
||||
getDiagnosticText(Diagnostics.Unsupported_file_encoding) :
|
||||
e.message);
|
||||
}
|
||||
text = "";
|
||||
}
|
||||
return text !== undefined ? createSourceFile(filename, text, languageVersion, /*version:*/ "0") : undefined;
|
||||
}
|
||||
|
||||
function writeFile(fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void) {
|
||||
|
||||
function directoryExists(directoryPath: string): boolean {
|
||||
if (hasProperty(existingDirectories, directoryPath)) {
|
||||
return true;
|
||||
}
|
||||
if (sys.directoryExists(directoryPath)) {
|
||||
existingDirectories[directoryPath] = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function ensureDirectoriesExist(directoryPath: string) {
|
||||
if (directoryPath.length > getRootLength(directoryPath) && !directoryExists(directoryPath)) {
|
||||
var parentDirectory = getDirectoryPath(directoryPath);
|
||||
ensureDirectoriesExist(parentDirectory);
|
||||
sys.createDirectory(directoryPath);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
ensureDirectoriesExist(getDirectoryPath(normalizePath(fileName)));
|
||||
sys.writeFile(fileName, data, writeByteOrderMark);
|
||||
}
|
||||
catch (e) {
|
||||
if (onError) onError(e.message);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
getSourceFile,
|
||||
getDefaultLibFilename: options => combinePaths(getDirectoryPath(normalizePath(sys.getExecutingFilePath())), options.target === ScriptTarget.ES6 ? "lib.es6.d.ts" : "lib.d.ts"),
|
||||
writeFile,
|
||||
getCurrentDirectory: () => currentDirectory || (currentDirectory = sys.getCurrentDirectory()),
|
||||
useCaseSensitiveFileNames: () => sys.useCaseSensitiveFileNames,
|
||||
getCanonicalFileName,
|
||||
getNewLine: () => sys.newLine
|
||||
};
|
||||
}
|
||||
|
||||
export function executeCommandLine(args: string[]): void {
|
||||
var commandLine = parseCommandLine(args);
|
||||
var compilerOptions = commandLine.options;
|
||||
@@ -447,12 +378,12 @@ module ts {
|
||||
var usageText = " ";
|
||||
if (option.shortName) {
|
||||
usageText += "-" + option.shortName;
|
||||
usageText += getParamName(option);
|
||||
usageText += getParamType(option);
|
||||
usageText += ", ";
|
||||
}
|
||||
|
||||
usageText += "--" + option.name;
|
||||
usageText += getParamName(option);
|
||||
usageText += getParamType(option);
|
||||
|
||||
usageColumn.push(usageText);
|
||||
descriptionColumn.push(getDiagnosticText(option.description));
|
||||
@@ -477,9 +408,9 @@ module ts {
|
||||
sys.write(output);
|
||||
return;
|
||||
|
||||
function getParamName(option: CommandLineOption) {
|
||||
if (option.paramName !== undefined) {
|
||||
return " " + getDiagnosticText(option.paramName);
|
||||
function getParamType(option: CommandLineOption) {
|
||||
if (option.paramType !== undefined) {
|
||||
return " " + getDiagnosticText(option.paramType);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
@@ -490,4 +421,4 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
ts.executeCommandLine(sys.args);
|
||||
ts.executeCommandLine(ts.sys.args);
|
||||
|
||||
+32
-23
@@ -1,6 +1,9 @@
|
||||
/// <reference path="core.ts"/>
|
||||
|
||||
module ts {
|
||||
export interface Map<T> {
|
||||
[index: string]: T;
|
||||
}
|
||||
|
||||
export interface TextRange {
|
||||
pos: number;
|
||||
@@ -15,6 +18,7 @@ module ts {
|
||||
MultiLineCommentTrivia,
|
||||
NewLineTrivia,
|
||||
WhitespaceTrivia,
|
||||
ConflictMarkerTrivia,
|
||||
// Literals
|
||||
NumericLiteral,
|
||||
StringLiteral,
|
||||
@@ -266,7 +270,7 @@ module ts {
|
||||
FirstToken = Unknown,
|
||||
LastToken = TypeKeyword,
|
||||
FirstTriviaToken = SingleLineCommentTrivia,
|
||||
LastTriviaToken = WhitespaceTrivia,
|
||||
LastTriviaToken = ConflictMarkerTrivia,
|
||||
FirstLiteralToken = NumericLiteral,
|
||||
LastLiteralToken = NoSubstitutionTemplateLiteral,
|
||||
FirstTemplateToken = NoSubstitutionTemplateLiteral,
|
||||
@@ -313,14 +317,20 @@ module ts {
|
||||
|
||||
// If the parser encountered an error when parsing the code that created this node. Note
|
||||
// the parser only sets this directly on the node it creates right after encountering the
|
||||
// error. We then propagate that flag upwards to parent nodes during incremental parsing.
|
||||
ContainsError = 1 << 4,
|
||||
// error.
|
||||
ThisNodeHasError = 1 << 4,
|
||||
|
||||
// Used during incremental parsing to determine if we need to visit this node to see if
|
||||
// any of its children had an error. Once we compute that once, we can set this bit on the
|
||||
// node to know that we never have to do it again. From that point on, we can just check
|
||||
// the node directly for 'ContainsError'.
|
||||
HasPropagatedChildContainsErrorFlag = 1 << 5
|
||||
// Context flags set directly by the parser.
|
||||
ParserGeneratedFlags = StrictMode | DisallowIn | Yield | GeneratorParameter | ThisNodeHasError,
|
||||
|
||||
// Context flags computed by aggregating child flags upwards.
|
||||
|
||||
// Used during incremental parsing to determine if this node or any of its children had an
|
||||
// error. Computed only once and then cached.
|
||||
ThisNodeOrAnySubNodesHasError = 1 << 5,
|
||||
|
||||
// Used to know if we've computed data from children and cached it in this node.
|
||||
HasAggregatedChildData = 1 << 6
|
||||
}
|
||||
|
||||
export interface Node extends TextRange {
|
||||
@@ -895,8 +905,6 @@ module ts {
|
||||
nodeCount: number;
|
||||
identifierCount: number;
|
||||
symbolCount: number;
|
||||
isOpen: boolean;
|
||||
version: string;
|
||||
languageVersion: ScriptTarget;
|
||||
identifiers: Map<string>;
|
||||
}
|
||||
@@ -1213,8 +1221,9 @@ module ts {
|
||||
isIllegalTypeReferenceInConstraint?: boolean; // Is type reference in constraint refers to the type parameter from the same list
|
||||
isVisible?: boolean; // Is this node visible
|
||||
localModuleName?: string; // Local name for module instance
|
||||
assignmentChecks?: Map<boolean>; // Cache of assignment checks
|
||||
hasReportedStatementInAmbientContext?: boolean; // Cache boolean if we report statements in ambient context
|
||||
assignmentChecks?: Map<boolean>; // Cache of assignment checks
|
||||
hasReportedStatementInAmbientContext?: boolean; // Cache boolean if we report statements in ambient context
|
||||
importOnRightSide?: Symbol; // for import declarations - import that appear on the right side
|
||||
}
|
||||
|
||||
export const enum TypeFlags {
|
||||
@@ -1241,7 +1250,6 @@ module ts {
|
||||
StringLike = String | StringLiteral,
|
||||
NumberLike = Number | Enum,
|
||||
ObjectType = Class | Interface | Reference | Tuple | Anonymous,
|
||||
Structured = Any | ObjectType | Union | TypeParameter
|
||||
}
|
||||
|
||||
// Properties common to all types
|
||||
@@ -1396,6 +1404,7 @@ module ts {
|
||||
}
|
||||
|
||||
export interface CompilerOptions {
|
||||
allowNonTsExtensions?: boolean;
|
||||
charset?: string;
|
||||
codepage?: number;
|
||||
declaration?: boolean;
|
||||
@@ -1413,21 +1422,21 @@ module ts {
|
||||
noResolve?: boolean;
|
||||
out?: string;
|
||||
outDir?: string;
|
||||
preserveConstEnums?: boolean;
|
||||
removeComments?: boolean;
|
||||
sourceMap?: boolean;
|
||||
sourceRoot?: string;
|
||||
suppressImplicitAnyIndexErrors?: boolean;
|
||||
target?: ScriptTarget;
|
||||
version?: boolean;
|
||||
watch?: boolean;
|
||||
preserveConstEnums?: boolean;
|
||||
allowNonTsExtensions?: boolean;
|
||||
[option: string]: string | number | boolean;
|
||||
}
|
||||
|
||||
export const enum ModuleKind {
|
||||
None,
|
||||
CommonJS,
|
||||
AMD,
|
||||
None = 0,
|
||||
CommonJS = 1,
|
||||
AMD = 2,
|
||||
}
|
||||
|
||||
export interface LineAndCharacter {
|
||||
@@ -1440,9 +1449,9 @@ module ts {
|
||||
|
||||
|
||||
export const enum ScriptTarget {
|
||||
ES3,
|
||||
ES5,
|
||||
ES6,
|
||||
ES3 = 0,
|
||||
ES5 = 1,
|
||||
ES6 = 2,
|
||||
Latest = ES6,
|
||||
}
|
||||
|
||||
@@ -1457,7 +1466,7 @@ module ts {
|
||||
type: string | Map<number>; // "string", "number", "boolean", or an object literal mapping named values to actual values
|
||||
shortName?: string; // A short mnemonic for convenience - for instance, 'h' can be used in place of 'help'.
|
||||
description?: DiagnosticMessage; // The message describing what the command line switch does
|
||||
paramName?: DiagnosticMessage; // The name to be used for a non-boolean option's parameter.
|
||||
paramType?: DiagnosticMessage; // The name to be used for a non-boolean option's parameter.
|
||||
error?: DiagnosticMessage; // The error given when the argument does not fit a customized 'type'.
|
||||
}
|
||||
|
||||
@@ -1595,7 +1604,7 @@ module ts {
|
||||
tab = 0x09, // \t
|
||||
verticalTab = 0x0B, // \v
|
||||
}
|
||||
|
||||
|
||||
export interface CancellationToken {
|
||||
isCancellationRequested(): boolean;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,737 @@
|
||||
/// <reference path="types.ts" />
|
||||
|
||||
module ts {
|
||||
export interface ReferencePathMatchResult {
|
||||
fileReference?: FileReference
|
||||
diagnosticMessage?: DiagnosticMessage
|
||||
isNoDefaultLib?: boolean
|
||||
}
|
||||
|
||||
export function getDeclarationOfKind(symbol: Symbol, kind: SyntaxKind): Declaration {
|
||||
var declarations = symbol.declarations;
|
||||
for (var i = 0; i < declarations.length; i++) {
|
||||
var declaration = declarations[i];
|
||||
if (declaration.kind === kind) {
|
||||
return declaration;
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export interface StringSymbolWriter extends SymbolWriter {
|
||||
string(): string;
|
||||
}
|
||||
|
||||
// Pool writers to avoid needing to allocate them for every symbol we write.
|
||||
var stringWriters: StringSymbolWriter[] = [];
|
||||
export function getSingleLineStringWriter(): StringSymbolWriter {
|
||||
if (stringWriters.length == 0) {
|
||||
var str = "";
|
||||
|
||||
var writeText: (text: string) => void = text => str += text;
|
||||
return {
|
||||
string: () => str,
|
||||
writeKeyword: writeText,
|
||||
writeOperator: writeText,
|
||||
writePunctuation: writeText,
|
||||
writeSpace: writeText,
|
||||
writeStringLiteral: writeText,
|
||||
writeParameter: writeText,
|
||||
writeSymbol: writeText,
|
||||
|
||||
// Completely ignore indentation for string writers. And map newlines to
|
||||
// a single space.
|
||||
writeLine: () => str += " ",
|
||||
increaseIndent: () => { },
|
||||
decreaseIndent: () => { },
|
||||
clear: () => str = "",
|
||||
trackSymbol: () => { }
|
||||
};
|
||||
}
|
||||
|
||||
return stringWriters.pop();
|
||||
}
|
||||
|
||||
export function releaseStringWriter(writer: StringSymbolWriter) {
|
||||
writer.clear()
|
||||
stringWriters.push(writer);
|
||||
}
|
||||
|
||||
export function getFullWidth(node: Node) {
|
||||
return node.end - node.pos;
|
||||
}
|
||||
|
||||
function hasFlag(val: number, flag: number): boolean {
|
||||
return (val & flag) !== 0;
|
||||
}
|
||||
|
||||
// Returns true if this node contains a parse error anywhere underneath it.
|
||||
export function containsParseError(node: Node): boolean {
|
||||
aggregateChildData(node);
|
||||
return hasFlag(node.parserContextFlags, ParserContextFlags.ThisNodeOrAnySubNodesHasError);
|
||||
}
|
||||
|
||||
function aggregateChildData(node: Node): void {
|
||||
if (!hasFlag(node.parserContextFlags, ParserContextFlags.HasAggregatedChildData)) {
|
||||
// A node is considered to contain a parse error if:
|
||||
// a) the parser explicitly marked that it had an error
|
||||
// b) any of it's children reported that it had an error.
|
||||
var thisNodeOrAnySubNodesHasError = hasFlag(node.parserContextFlags, ParserContextFlags.ThisNodeHasError) ||
|
||||
forEachChild(node, containsParseError);
|
||||
|
||||
// If so, mark ourselves accordingly.
|
||||
if (thisNodeOrAnySubNodesHasError) {
|
||||
node.parserContextFlags |= ParserContextFlags.ThisNodeOrAnySubNodesHasError;
|
||||
}
|
||||
|
||||
// Also mark that we've propogated the child information to this node. This way we can
|
||||
// always consult the bit directly on this node without needing to check its children
|
||||
// again.
|
||||
node.parserContextFlags |= ParserContextFlags.HasAggregatedChildData;
|
||||
}
|
||||
}
|
||||
|
||||
export function getSourceFileOfNode(node: Node): SourceFile {
|
||||
while (node && node.kind !== SyntaxKind.SourceFile) {
|
||||
node = node.parent;
|
||||
}
|
||||
return <SourceFile>node;
|
||||
}
|
||||
|
||||
// This is a useful function for debugging purposes.
|
||||
export function nodePosToString(node: Node): string {
|
||||
var file = getSourceFileOfNode(node);
|
||||
var loc = file.getLineAndCharacterFromPosition(node.pos);
|
||||
return file.filename + "(" + loc.line + "," + loc.character + ")";
|
||||
}
|
||||
|
||||
export function getStartPosOfNode(node: Node): number {
|
||||
return node.pos;
|
||||
}
|
||||
|
||||
export function isMissingNode(node: Node) {
|
||||
return node.pos === node.end && node.kind !== SyntaxKind.EndOfFileToken;
|
||||
}
|
||||
|
||||
export function getTokenPosOfNode(node: Node, sourceFile?: SourceFile): number {
|
||||
// With nodes that have no width (i.e. 'Missing' nodes), we actually *don't*
|
||||
// want to skip trivia because this will launch us forward to the next token.
|
||||
if (isMissingNode(node)) {
|
||||
return node.pos;
|
||||
}
|
||||
|
||||
return skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos);
|
||||
}
|
||||
|
||||
export function getSourceTextOfNodeFromSourceFile(sourceFile: SourceFile, node: Node): string {
|
||||
if (isMissingNode(node)) {
|
||||
return "";
|
||||
}
|
||||
|
||||
var text = sourceFile.text;
|
||||
return text.substring(skipTrivia(text, node.pos), node.end);
|
||||
}
|
||||
|
||||
export function getTextOfNodeFromSourceText(sourceText: string, node: Node): string {
|
||||
if (isMissingNode(node)) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return sourceText.substring(skipTrivia(sourceText, node.pos), node.end);
|
||||
}
|
||||
|
||||
export function getTextOfNode(node: Node): string {
|
||||
return getSourceTextOfNodeFromSourceFile(getSourceFileOfNode(node), node);
|
||||
}
|
||||
|
||||
// Add an extra underscore to identifiers that start with two underscores to avoid issues with magic names like '__proto__'
|
||||
export function escapeIdentifier(identifier: string): string {
|
||||
return identifier.length >= 2 && identifier.charCodeAt(0) === CharacterCodes._ && identifier.charCodeAt(1) === CharacterCodes._ ? "_" + identifier : identifier;
|
||||
}
|
||||
|
||||
// Remove extra underscore from escaped identifier
|
||||
export function unescapeIdentifier(identifier: string): string {
|
||||
return identifier.length >= 3 && identifier.charCodeAt(0) === CharacterCodes._ && identifier.charCodeAt(1) === CharacterCodes._ && identifier.charCodeAt(2) === CharacterCodes._ ? identifier.substr(1) : identifier;
|
||||
}
|
||||
|
||||
// Return display name of an identifier
|
||||
// Computed property names will just be emitted as "[<expr>]", where <expr> is the source
|
||||
// text of the expression in the computed property.
|
||||
export function declarationNameToString(name: DeclarationName) {
|
||||
return getFullWidth(name) === 0 ? "(Missing)" : getTextOfNode(name);
|
||||
}
|
||||
|
||||
export function createDiagnosticForNode(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): Diagnostic {
|
||||
node = getErrorSpanForNode(node);
|
||||
var file = getSourceFileOfNode(node);
|
||||
|
||||
var start = getTokenPosOfNode(node, file);
|
||||
var length = node.end - start;
|
||||
|
||||
return createFileDiagnostic(file, start, length, message, arg0, arg1, arg2);
|
||||
}
|
||||
|
||||
export function createDiagnosticForNodeFromMessageChain(node: Node, messageChain: DiagnosticMessageChain, newLine: string): Diagnostic {
|
||||
node = getErrorSpanForNode(node);
|
||||
var file = getSourceFileOfNode(node);
|
||||
var start = skipTrivia(file.text, node.pos);
|
||||
var length = node.end - start;
|
||||
return flattenDiagnosticChain(file, start, length, messageChain, newLine);
|
||||
}
|
||||
|
||||
export function getErrorSpanForNode(node: Node): Node {
|
||||
var errorSpan: Node;
|
||||
switch (node.kind) {
|
||||
// This list is a work in progress. Add missing node kinds to improve their error
|
||||
// spans.
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
case SyntaxKind.BindingElement:
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
case SyntaxKind.EnumMember:
|
||||
errorSpan = (<Declaration>node).name;
|
||||
break;
|
||||
}
|
||||
|
||||
// We now have the ideal error span, but it may be a node that is optional and absent
|
||||
// (e.g. the name of a function expression), in which case errorSpan will be undefined.
|
||||
// Alternatively, it might be required and missing (e.g. the name of a module), in which
|
||||
// case its pos will equal its end (length 0). In either of these cases, we should fall
|
||||
// back to the original node that the error was issued on.
|
||||
return errorSpan && errorSpan.pos < errorSpan.end ? errorSpan : node;
|
||||
}
|
||||
|
||||
export function isExternalModule(file: SourceFile): boolean {
|
||||
return file.externalModuleIndicator !== undefined;
|
||||
}
|
||||
|
||||
export function isDeclarationFile(file: SourceFile): boolean {
|
||||
return (file.flags & NodeFlags.DeclarationFile) !== 0;
|
||||
}
|
||||
|
||||
export function isConstEnumDeclaration(node: Node): boolean {
|
||||
return node.kind === SyntaxKind.EnumDeclaration && isConst(node);
|
||||
}
|
||||
|
||||
export function isConst(node: Node): boolean {
|
||||
return !!(node.flags & NodeFlags.Const);
|
||||
}
|
||||
|
||||
export function isLet(node: Node): boolean {
|
||||
return !!(node.flags & NodeFlags.Let);
|
||||
}
|
||||
|
||||
export function isPrologueDirective(node: Node): boolean {
|
||||
return node.kind === SyntaxKind.ExpressionStatement && (<ExpressionStatement>node).expression.kind === SyntaxKind.StringLiteral;
|
||||
}
|
||||
|
||||
export function getLeadingCommentRangesOfNode(node: Node, sourceFileOfNode?: SourceFile) {
|
||||
sourceFileOfNode = sourceFileOfNode || getSourceFileOfNode(node);
|
||||
|
||||
// If parameter/type parameter, the prev token trailing comments are part of this node too
|
||||
if (node.kind === SyntaxKind.Parameter || node.kind === SyntaxKind.TypeParameter) {
|
||||
// e.g. (/** blah */ a, /** blah */ b);
|
||||
return concatenate(getTrailingCommentRanges(sourceFileOfNode.text, node.pos),
|
||||
// e.g.: (
|
||||
// /** blah */ a,
|
||||
// /** blah */ b);
|
||||
getLeadingCommentRanges(sourceFileOfNode.text, node.pos));
|
||||
}
|
||||
else {
|
||||
return getLeadingCommentRanges(sourceFileOfNode.text, node.pos);
|
||||
}
|
||||
}
|
||||
|
||||
export function getJsDocComments(node: Node, sourceFileOfNode: SourceFile) {
|
||||
return filter(getLeadingCommentRangesOfNode(node, sourceFileOfNode), isJsDocComment);
|
||||
|
||||
function isJsDocComment(comment: CommentRange) {
|
||||
// True if the comment starts with '/**' but not if it is '/**/'
|
||||
return sourceFileOfNode.text.charCodeAt(comment.pos + 1) === CharacterCodes.asterisk &&
|
||||
sourceFileOfNode.text.charCodeAt(comment.pos + 2) === CharacterCodes.asterisk &&
|
||||
sourceFileOfNode.text.charCodeAt(comment.pos + 3) !== CharacterCodes.slash;
|
||||
}
|
||||
}
|
||||
|
||||
export var fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*<reference\s+path\s*=\s*)('|")(.+?)\2.*?\/>/
|
||||
|
||||
|
||||
// Warning: This has the same semantics as the forEach family of functions,
|
||||
// in that traversal terminates in the event that 'visitor' supplies a truthy value.
|
||||
export function forEachReturnStatement<T>(body: Block, visitor: (stmt: ReturnStatement) => T): T {
|
||||
|
||||
return traverse(body);
|
||||
|
||||
function traverse(node: Node): T {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.ReturnStatement:
|
||||
return visitor(<ReturnStatement>node);
|
||||
case SyntaxKind.Block:
|
||||
case SyntaxKind.IfStatement:
|
||||
case SyntaxKind.DoStatement:
|
||||
case SyntaxKind.WhileStatement:
|
||||
case SyntaxKind.ForStatement:
|
||||
case SyntaxKind.ForInStatement:
|
||||
case SyntaxKind.WithStatement:
|
||||
case SyntaxKind.SwitchStatement:
|
||||
case SyntaxKind.CaseClause:
|
||||
case SyntaxKind.DefaultClause:
|
||||
case SyntaxKind.LabeledStatement:
|
||||
case SyntaxKind.TryStatement:
|
||||
case SyntaxKind.TryBlock:
|
||||
case SyntaxKind.CatchClause:
|
||||
case SyntaxKind.FinallyBlock:
|
||||
return forEachChild(node, traverse);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function isAnyFunction(node: Node): boolean {
|
||||
if (node) {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
case SyntaxKind.CallSignature:
|
||||
case SyntaxKind.ConstructSignature:
|
||||
case SyntaxKind.IndexSignature:
|
||||
case SyntaxKind.FunctionType:
|
||||
case SyntaxKind.ConstructorType:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
export function isFunctionBlock(node: Node) {
|
||||
return node && node.kind === SyntaxKind.Block && isAnyFunction(node.parent);
|
||||
}
|
||||
|
||||
export function isObjectLiteralMethod(node: Node) {
|
||||
return node && node.kind === SyntaxKind.MethodDeclaration && node.parent.kind === SyntaxKind.ObjectLiteralExpression;
|
||||
}
|
||||
|
||||
export function getContainingFunction(node: Node): FunctionLikeDeclaration {
|
||||
while (true) {
|
||||
node = node.parent;
|
||||
if (!node || isAnyFunction(node)) {
|
||||
return <FunctionLikeDeclaration>node;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function getThisContainer(node: Node, includeArrowFunctions: boolean): Node {
|
||||
while (true) {
|
||||
node = node.parent;
|
||||
if (!node) {
|
||||
return undefined;
|
||||
}
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.ArrowFunction:
|
||||
if (!includeArrowFunctions) {
|
||||
continue;
|
||||
}
|
||||
// Fall through
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
case SyntaxKind.SourceFile:
|
||||
return node;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function getSuperContainer(node: Node): Node {
|
||||
while (true) {
|
||||
node = node.parent;
|
||||
if (!node) {
|
||||
return undefined;
|
||||
}
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
return node;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function getInvokedExpression(node: CallLikeExpression): Expression {
|
||||
if (node.kind === SyntaxKind.TaggedTemplateExpression) {
|
||||
return (<TaggedTemplateExpression>node).tag;
|
||||
}
|
||||
|
||||
// Will either be a CallExpression or NewExpression.
|
||||
return (<CallExpression>node).expression;
|
||||
}
|
||||
|
||||
export function isExpression(node: Node): boolean {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.ThisKeyword:
|
||||
case SyntaxKind.SuperKeyword:
|
||||
case SyntaxKind.NullKeyword:
|
||||
case SyntaxKind.TrueKeyword:
|
||||
case SyntaxKind.FalseKeyword:
|
||||
case SyntaxKind.RegularExpressionLiteral:
|
||||
case SyntaxKind.ArrayLiteralExpression:
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
case SyntaxKind.PropertyAccessExpression:
|
||||
case SyntaxKind.ElementAccessExpression:
|
||||
case SyntaxKind.CallExpression:
|
||||
case SyntaxKind.NewExpression:
|
||||
case SyntaxKind.TaggedTemplateExpression:
|
||||
case SyntaxKind.TypeAssertionExpression:
|
||||
case SyntaxKind.ParenthesizedExpression:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
case SyntaxKind.VoidExpression:
|
||||
case SyntaxKind.DeleteExpression:
|
||||
case SyntaxKind.TypeOfExpression:
|
||||
case SyntaxKind.PrefixUnaryExpression:
|
||||
case SyntaxKind.PostfixUnaryExpression:
|
||||
case SyntaxKind.BinaryExpression:
|
||||
case SyntaxKind.ConditionalExpression:
|
||||
case SyntaxKind.TemplateExpression:
|
||||
case SyntaxKind.NoSubstitutionTemplateLiteral:
|
||||
case SyntaxKind.OmittedExpression:
|
||||
return true;
|
||||
case SyntaxKind.QualifiedName:
|
||||
while (node.parent.kind === SyntaxKind.QualifiedName) {
|
||||
node = node.parent;
|
||||
}
|
||||
|
||||
return node.parent.kind === SyntaxKind.TypeQuery;
|
||||
case SyntaxKind.Identifier:
|
||||
if (node.parent.kind === SyntaxKind.TypeQuery) {
|
||||
return true;
|
||||
}
|
||||
// fall through
|
||||
case SyntaxKind.NumericLiteral:
|
||||
case SyntaxKind.StringLiteral:
|
||||
var parent = node.parent;
|
||||
switch (parent.kind) {
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
case SyntaxKind.Parameter:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
case SyntaxKind.EnumMember:
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
case SyntaxKind.BindingElement:
|
||||
return (<VariableLikeDeclaration>parent).initializer === node;
|
||||
case SyntaxKind.ExpressionStatement:
|
||||
case SyntaxKind.IfStatement:
|
||||
case SyntaxKind.DoStatement:
|
||||
case SyntaxKind.WhileStatement:
|
||||
case SyntaxKind.ReturnStatement:
|
||||
case SyntaxKind.WithStatement:
|
||||
case SyntaxKind.SwitchStatement:
|
||||
case SyntaxKind.CaseClause:
|
||||
case SyntaxKind.ThrowStatement:
|
||||
case SyntaxKind.SwitchStatement:
|
||||
return (<ExpressionStatement>parent).expression === node;
|
||||
case SyntaxKind.ForStatement:
|
||||
return (<ForStatement>parent).initializer === node ||
|
||||
(<ForStatement>parent).condition === node ||
|
||||
(<ForStatement>parent).iterator === node;
|
||||
case SyntaxKind.ForInStatement:
|
||||
return (<ForInStatement>parent).variable === node ||
|
||||
(<ForInStatement>parent).expression === node;
|
||||
case SyntaxKind.TypeAssertionExpression:
|
||||
return node === (<TypeAssertion>parent).expression;
|
||||
case SyntaxKind.TemplateSpan:
|
||||
return node === (<TemplateSpan>parent).expression;
|
||||
default:
|
||||
if (isExpression(parent)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export function isExternalModuleImportDeclaration(node: Node) {
|
||||
return node.kind === SyntaxKind.ImportDeclaration && (<ImportDeclaration>node).moduleReference.kind === SyntaxKind.ExternalModuleReference;
|
||||
}
|
||||
|
||||
export function getExternalModuleImportDeclarationExpression(node: Node) {
|
||||
Debug.assert(isExternalModuleImportDeclaration(node));
|
||||
return (<ExternalModuleReference>(<ImportDeclaration>node).moduleReference).expression;
|
||||
}
|
||||
|
||||
export function isInternalModuleImportDeclaration(node: Node) {
|
||||
return node.kind === SyntaxKind.ImportDeclaration && (<ImportDeclaration>node).moduleReference.kind !== SyntaxKind.ExternalModuleReference;
|
||||
}
|
||||
|
||||
export function hasDotDotDotToken(node: Node) {
|
||||
return node && node.kind === SyntaxKind.Parameter && (<ParameterDeclaration>node).dotDotDotToken !== undefined;
|
||||
}
|
||||
|
||||
export function hasQuestionToken(node: Node) {
|
||||
if (node) {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.Parameter:
|
||||
return (<ParameterDeclaration>node).questionToken !== undefined;
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
return (<MethodDeclaration>node).questionToken !== undefined;
|
||||
case SyntaxKind.ShorthandPropertyAssignment:
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
return (<PropertyDeclaration>node).questionToken !== undefined;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
export function hasRestParameters(s: SignatureDeclaration): boolean {
|
||||
return s.parameters.length > 0 && s.parameters[s.parameters.length - 1].dotDotDotToken !== undefined;
|
||||
}
|
||||
|
||||
export function isLiteralKind(kind: SyntaxKind): boolean {
|
||||
return SyntaxKind.FirstLiteralToken <= kind && kind <= SyntaxKind.LastLiteralToken;
|
||||
}
|
||||
|
||||
export function isTextualLiteralKind(kind: SyntaxKind): boolean {
|
||||
return kind === SyntaxKind.StringLiteral || kind === SyntaxKind.NoSubstitutionTemplateLiteral;
|
||||
}
|
||||
|
||||
export function isTemplateLiteralKind(kind: SyntaxKind): boolean {
|
||||
return SyntaxKind.FirstTemplateToken <= kind && kind <= SyntaxKind.LastTemplateToken;
|
||||
}
|
||||
|
||||
export function isBindingPattern(node: Node) {
|
||||
return node.kind === SyntaxKind.ArrayBindingPattern || node.kind === SyntaxKind.ObjectBindingPattern;
|
||||
}
|
||||
|
||||
export function isInAmbientContext(node: Node): boolean {
|
||||
while (node) {
|
||||
if (node.flags & (NodeFlags.Ambient | NodeFlags.DeclarationFile)) return true;
|
||||
node = node.parent;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export function isDeclaration(node: Node): boolean {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.TypeParameter:
|
||||
case SyntaxKind.Parameter:
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
case SyntaxKind.BindingElement:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
case SyntaxKind.ShorthandPropertyAssignment:
|
||||
case SyntaxKind.EnumMember:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
case SyntaxKind.ImportDeclaration:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export function isStatement(n: Node): boolean {
|
||||
switch (n.kind) {
|
||||
case SyntaxKind.BreakStatement:
|
||||
case SyntaxKind.ContinueStatement:
|
||||
case SyntaxKind.DebuggerStatement:
|
||||
case SyntaxKind.DoStatement:
|
||||
case SyntaxKind.ExpressionStatement:
|
||||
case SyntaxKind.EmptyStatement:
|
||||
case SyntaxKind.ForInStatement:
|
||||
case SyntaxKind.ForStatement:
|
||||
case SyntaxKind.IfStatement:
|
||||
case SyntaxKind.LabeledStatement:
|
||||
case SyntaxKind.ReturnStatement:
|
||||
case SyntaxKind.SwitchStatement:
|
||||
case SyntaxKind.ThrowKeyword:
|
||||
case SyntaxKind.TryStatement:
|
||||
case SyntaxKind.VariableStatement:
|
||||
case SyntaxKind.WhileStatement:
|
||||
case SyntaxKind.WithStatement:
|
||||
case SyntaxKind.ExportAssignment:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// True if the given identifier, string literal, or number literal is the name of a declaration node
|
||||
export function isDeclarationOrFunctionExpressionOrCatchVariableName(name: Node): boolean {
|
||||
if (name.kind !== SyntaxKind.Identifier && name.kind !== SyntaxKind.StringLiteral && name.kind !== SyntaxKind.NumericLiteral) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var parent = name.parent;
|
||||
if (isDeclaration(parent) || parent.kind === SyntaxKind.FunctionExpression) {
|
||||
return (<Declaration>parent).name === name;
|
||||
}
|
||||
|
||||
if (parent.kind === SyntaxKind.CatchClause) {
|
||||
return (<CatchClause>parent).name === name;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
export function getClassBaseTypeNode(node: ClassDeclaration) {
|
||||
var heritageClause = getHeritageClause(node.heritageClauses, SyntaxKind.ExtendsKeyword);
|
||||
return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined;
|
||||
}
|
||||
|
||||
export function getClassImplementedTypeNodes(node: ClassDeclaration) {
|
||||
var heritageClause = getHeritageClause(node.heritageClauses, SyntaxKind.ImplementsKeyword);
|
||||
return heritageClause ? heritageClause.types : undefined;
|
||||
}
|
||||
|
||||
export function getInterfaceBaseTypeNodes(node: InterfaceDeclaration) {
|
||||
var heritageClause = getHeritageClause(node.heritageClauses, SyntaxKind.ExtendsKeyword);
|
||||
return heritageClause ? heritageClause.types : undefined;
|
||||
}
|
||||
|
||||
export function getHeritageClause(clauses: NodeArray<HeritageClause>, kind: SyntaxKind) {
|
||||
if (clauses) {
|
||||
for (var i = 0, n = clauses.length; i < n; i++) {
|
||||
if (clauses[i].token === kind) {
|
||||
return clauses[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function tryResolveScriptReference(program: Program, sourceFile: SourceFile, reference: FileReference) {
|
||||
if (!program.getCompilerOptions().noResolve) {
|
||||
var referenceFileName = isRootedDiskPath(reference.filename) ? reference.filename : combinePaths(getDirectoryPath(sourceFile.filename), reference.filename);
|
||||
referenceFileName = getNormalizedAbsolutePath(referenceFileName, program.getCompilerHost().getCurrentDirectory());
|
||||
return program.getSourceFile(referenceFileName);
|
||||
}
|
||||
}
|
||||
|
||||
export function getAncestor(node: Node, kind: SyntaxKind): Node {
|
||||
switch (kind) {
|
||||
// special-cases that can be come first
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
while (node) {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
return <ClassDeclaration>node;
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
case SyntaxKind.ImportDeclaration:
|
||||
// early exit cases - declarations cannot be nested in classes
|
||||
return undefined;
|
||||
default:
|
||||
node = node.parent;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
while (node) {
|
||||
if (node.kind === kind) {
|
||||
return node;
|
||||
}
|
||||
node = node.parent;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function getFileReferenceFromReferencePath(comment: string, commentRange: CommentRange): ReferencePathMatchResult {
|
||||
var simpleReferenceRegEx = /^\/\/\/\s*<reference\s+/gim;
|
||||
var isNoDefaultLibRegEx = /^(\/\/\/\s*<reference\s+no-default-lib\s*=\s*)('|")(.+?)\2\s*\/>/gim;
|
||||
if (simpleReferenceRegEx.exec(comment)) {
|
||||
if (isNoDefaultLibRegEx.exec(comment)) {
|
||||
return {
|
||||
isNoDefaultLib: true
|
||||
}
|
||||
}
|
||||
else {
|
||||
var matchResult = fullTripleSlashReferencePathRegEx.exec(comment);
|
||||
if (matchResult) {
|
||||
var start = commentRange.pos;
|
||||
var end = commentRange.end;
|
||||
return {
|
||||
fileReference: {
|
||||
pos: start,
|
||||
end: end,
|
||||
filename: matchResult[3]
|
||||
},
|
||||
isNoDefaultLib: false
|
||||
};
|
||||
}
|
||||
else {
|
||||
return {
|
||||
diagnosticMessage: Diagnostics.Invalid_reference_directive_syntax,
|
||||
isNoDefaultLib: false
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function isKeyword(token: SyntaxKind): boolean {
|
||||
return SyntaxKind.FirstKeyword <= token && token <= SyntaxKind.LastKeyword;
|
||||
}
|
||||
|
||||
export function isTrivia(token: SyntaxKind) {
|
||||
return SyntaxKind.FirstTriviaToken <= token && token <= SyntaxKind.LastTriviaToken;
|
||||
}
|
||||
|
||||
export function isModifier(token: SyntaxKind): boolean {
|
||||
switch (token) {
|
||||
case SyntaxKind.PublicKeyword:
|
||||
case SyntaxKind.PrivateKeyword:
|
||||
case SyntaxKind.ProtectedKeyword:
|
||||
case SyntaxKind.StaticKeyword:
|
||||
case SyntaxKind.ExportKeyword:
|
||||
case SyntaxKind.DeclareKeyword:
|
||||
case SyntaxKind.ConstKeyword:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
+90
-143
@@ -96,19 +96,6 @@ module FourSlash {
|
||||
end: number;
|
||||
}
|
||||
|
||||
export enum IncrementalEditValidation {
|
||||
None,
|
||||
SyntacticOnly,
|
||||
Complete
|
||||
}
|
||||
|
||||
export enum TypingFidelity {
|
||||
/// Performs typing and formatting (if formatting is enabled)
|
||||
Low,
|
||||
/// Performs typing, checks completion lists, signature help, and formatting (if enabled)
|
||||
High
|
||||
}
|
||||
|
||||
var entityMap: ts.Map<string> = {
|
||||
'&': '&',
|
||||
'"': '"',
|
||||
@@ -126,33 +113,33 @@ module FourSlash {
|
||||
// To add additional option, add property into the testOptMetadataNames, refer the property in either globalMetadataNames or fileMetadataNames
|
||||
// Add cases into convertGlobalOptionsToCompilationsSettings function for the compiler to acknowledge such option from meta data
|
||||
var testOptMetadataNames = {
|
||||
baselineFile: 'BaselineFile',
|
||||
declaration: 'declaration',
|
||||
emitThisFile: 'emitThisFile', // This flag is used for testing getEmitOutput feature. It allows test-cases to indicate what file to be output in multiple files project
|
||||
filename: 'Filename',
|
||||
mapRoot: 'mapRoot',
|
||||
module: 'module',
|
||||
out: 'out',
|
||||
outDir: 'outDir',
|
||||
sourceMap: 'sourceMap',
|
||||
sourceRoot: 'sourceRoot',
|
||||
resolveReference: 'ResolveReference', // This flag is used to specify entry file for resolve file references. The flag is only allow once per test file
|
||||
baselineFile: 'BaselineFile',
|
||||
declaration: 'declaration',
|
||||
emitThisFile: 'emitThisFile', // This flag is used for testing getEmitOutput feature. It allows test-cases to indicate what file to be output in multiple files project
|
||||
filename: 'Filename',
|
||||
mapRoot: 'mapRoot',
|
||||
module: 'module',
|
||||
out: 'out',
|
||||
outDir: 'outDir',
|
||||
sourceMap: 'sourceMap',
|
||||
sourceRoot: 'sourceRoot',
|
||||
resolveReference: 'ResolveReference', // This flag is used to specify entry file for resolve file references. The flag is only allow once per test file
|
||||
};
|
||||
|
||||
// List of allowed metadata names
|
||||
var fileMetadataNames = [testOptMetadataNames.filename, testOptMetadataNames.emitThisFile, testOptMetadataNames.resolveReference];
|
||||
var globalMetadataNames = [testOptMetadataNames.baselineFile, testOptMetadataNames.declaration,
|
||||
var globalMetadataNames = [testOptMetadataNames.baselineFile, testOptMetadataNames.declaration,
|
||||
testOptMetadataNames.mapRoot, testOptMetadataNames.module, testOptMetadataNames.out,
|
||||
testOptMetadataNames.outDir, testOptMetadataNames.sourceMap, testOptMetadataNames.sourceRoot]
|
||||
|
||||
function convertGlobalOptionsToCompilationSettings(globalOptions: { [idx: string]: string }): ts.CompilationSettings {
|
||||
var settings: ts.CompilationSettings = {};
|
||||
function convertGlobalOptionsToCompilerOptions(globalOptions: { [idx: string]: string }): ts.CompilerOptions {
|
||||
var settings: ts.CompilerOptions = {};
|
||||
// Convert all property in globalOptions into ts.CompilationSettings
|
||||
for (var prop in globalOptions) {
|
||||
if (globalOptions.hasOwnProperty(prop)) {
|
||||
switch (prop) {
|
||||
case testOptMetadataNames.declaration:
|
||||
settings.generateDeclarationFiles = true;
|
||||
settings.declaration = true;
|
||||
break;
|
||||
case testOptMetadataNames.mapRoot:
|
||||
settings.mapRoot = globalOptions[prop];
|
||||
@@ -160,25 +147,26 @@ module FourSlash {
|
||||
case testOptMetadataNames.module:
|
||||
// create appropriate external module target for CompilationSettings
|
||||
switch (globalOptions[prop]) {
|
||||
case "AMD":
|
||||
settings.moduleGenTarget = ts.ModuleGenTarget.Asynchronous;
|
||||
break;
|
||||
case "CommonJS":
|
||||
settings.moduleGenTarget = ts.ModuleGenTarget.Synchronous;
|
||||
break;
|
||||
default:
|
||||
settings.moduleGenTarget = ts.ModuleGenTarget.Unspecified;
|
||||
break;
|
||||
case "AMD":
|
||||
settings.module = ts.ModuleKind.AMD;
|
||||
break;
|
||||
case "CommonJS":
|
||||
settings.module = ts.ModuleKind.CommonJS;
|
||||
break;
|
||||
default:
|
||||
ts.Debug.assert(globalOptions[prop] === undefined || globalOptions[prop] === "None");
|
||||
settings.module = ts.ModuleKind.None;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case testOptMetadataNames.out:
|
||||
settings.outFileOption = globalOptions[prop];
|
||||
settings.out = globalOptions[prop];
|
||||
break;
|
||||
case testOptMetadataNames.outDir:
|
||||
settings.outDirOption = globalOptions[prop];
|
||||
settings.outDir = globalOptions[prop];
|
||||
break;
|
||||
case testOptMetadataNames.sourceMap:
|
||||
settings.mapSourceFiles = true;
|
||||
settings.sourceMap = true;
|
||||
break;
|
||||
case testOptMetadataNames.sourceRoot:
|
||||
settings.sourceRoot = globalOptions[prop];
|
||||
@@ -278,9 +266,6 @@ module FourSlash {
|
||||
|
||||
public cancellationToken: TestCancellationToken;
|
||||
|
||||
public editValidation = IncrementalEditValidation.Complete;
|
||||
public typingFidelity = TypingFidelity.Low;
|
||||
|
||||
private scenarioActions: string[] = [];
|
||||
private taoInvalidReason: string = null;
|
||||
|
||||
@@ -300,7 +285,7 @@ module FourSlash {
|
||||
this.cancellationToken = new TestCancellationToken();
|
||||
this.languageServiceShimHost = new Harness.LanguageService.TypeScriptLS(this.cancellationToken);
|
||||
|
||||
var compilationSettings = convertGlobalOptionsToCompilationSettings(this.testData.globalOptions);
|
||||
var compilationSettings = convertGlobalOptionsToCompilerOptions(this.testData.globalOptions);
|
||||
this.languageServiceShimHost.setCompilationSettings(compilationSettings);
|
||||
|
||||
var startResolveFileRef: FourSlashFile = undefined;
|
||||
@@ -363,7 +348,7 @@ module FourSlash {
|
||||
this.formatCodeOptions = {
|
||||
IndentSize: 4,
|
||||
TabSize: 4,
|
||||
NewLineCharacter: sys.newLine,
|
||||
NewLineCharacter: ts.sys.newLine,
|
||||
ConvertTabsToSpaces: true,
|
||||
InsertSpaceAfterCommaDelimiter: true,
|
||||
InsertSpaceAfterSemicolonInForStatements: true,
|
||||
@@ -750,11 +735,11 @@ module FourSlash {
|
||||
}
|
||||
|
||||
private getMemberListAtCaret() {
|
||||
return this.languageService.getCompletionsAtPosition(this.activeFile.fileName, this.currentCaretPosition, true);
|
||||
return this.languageService.getCompletionsAtPosition(this.activeFile.fileName, this.currentCaretPosition);
|
||||
}
|
||||
|
||||
private getCompletionListAtCaret() {
|
||||
return this.languageService.getCompletionsAtPosition(this.activeFile.fileName, this.currentCaretPosition, false);
|
||||
return this.languageService.getCompletionsAtPosition(this.activeFile.fileName, this.currentCaretPosition);
|
||||
}
|
||||
|
||||
private getCompletionEntryDetails(entryName: string) {
|
||||
@@ -770,7 +755,7 @@ module FourSlash {
|
||||
}
|
||||
|
||||
public verifyQuickInfoString(negative: boolean, expectedText?: string, expectedDocumentation?: string) {
|
||||
[expectedText, expectedDocumentation].forEach(str => {
|
||||
[expectedText, expectedDocumentation].forEach(str => {
|
||||
if (str) {
|
||||
this.scenarioActions.push('<ShowQuickInfo />');
|
||||
this.scenarioActions.push('<VerifyQuickInfoTextContains IgnoreSpacing="true" Text="' + escapeXmlAttributeValue(str) + '" ' + (negative ? 'ExpectsFailure="true"' : '') + ' />');
|
||||
@@ -815,7 +800,7 @@ module FourSlash {
|
||||
result = "[\n ";
|
||||
}
|
||||
result += JSON.stringify(part);
|
||||
});
|
||||
});
|
||||
if (result) {
|
||||
result += "\n]";
|
||||
}
|
||||
@@ -884,8 +869,8 @@ module FourSlash {
|
||||
|
||||
var help = this.getActiveSignatureHelpItem();
|
||||
assert.equal(
|
||||
ts.displayPartsToString(help.prefixDisplayParts) +
|
||||
help.parameters.map(p => ts.displayPartsToString(p.displayParts)).join(ts.displayPartsToString(help.separatorDisplayParts)) +
|
||||
ts.displayPartsToString(help.prefixDisplayParts) +
|
||||
help.parameters.map(p => ts.displayPartsToString(p.displayParts)).join(ts.displayPartsToString(help.separatorDisplayParts)) +
|
||||
ts.displayPartsToString(help.suffixDisplayParts), expected);
|
||||
}
|
||||
|
||||
@@ -1232,11 +1217,6 @@ module FourSlash {
|
||||
ts.forEach(fileNames, Harness.IO.log);
|
||||
}
|
||||
|
||||
private editCheckpoint(filename: string) {
|
||||
// TODO: What's this for? It is being called by deleteChar
|
||||
// this.languageService.getScriptLexicalStructure(filename);
|
||||
}
|
||||
|
||||
public deleteChar(count = 1) {
|
||||
this.scenarioActions.push('<DeleteCharNext Count="' + count + '" />');
|
||||
|
||||
@@ -1247,7 +1227,7 @@ module FourSlash {
|
||||
// Make the edit
|
||||
this.languageServiceShimHost.editScript(this.activeFile.fileName, offset, offset + 1, ch);
|
||||
this.updateMarkersForEdit(this.activeFile.fileName, offset, offset + 1, ch);
|
||||
this.editCheckpoint(this.activeFile.fileName);
|
||||
this.checkPostEditInvariants();
|
||||
|
||||
// Handle post-keystroke formatting
|
||||
if (this.enableFormatting) {
|
||||
@@ -1268,7 +1248,7 @@ module FourSlash {
|
||||
|
||||
this.languageServiceShimHost.editScript(this.activeFile.fileName, start, start + length, text);
|
||||
this.updateMarkersForEdit(this.activeFile.fileName, start, start + length, text);
|
||||
this.editCheckpoint(this.activeFile.fileName);
|
||||
this.checkPostEditInvariants();
|
||||
|
||||
this.checkPostEditInvariants();
|
||||
}
|
||||
@@ -1284,13 +1264,13 @@ module FourSlash {
|
||||
// Make the edit
|
||||
this.languageServiceShimHost.editScript(this.activeFile.fileName, offset, offset + 1, ch);
|
||||
this.updateMarkersForEdit(this.activeFile.fileName, offset, offset + 1, ch);
|
||||
this.editCheckpoint(this.activeFile.fileName);
|
||||
this.checkPostEditInvariants();
|
||||
|
||||
// Handle post-keystroke formatting
|
||||
if (this.enableFormatting) {
|
||||
var edits = this.languageService.getFormattingEditsAfterKeystroke(this.activeFile.fileName, offset, ch, this.formatCodeOptions);
|
||||
offset += this.applyEdits(this.activeFile.fileName, edits, true);
|
||||
this.editCheckpoint(this.activeFile.fileName);
|
||||
this.checkPostEditInvariants();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1298,7 +1278,6 @@ module FourSlash {
|
||||
this.currentCaretPosition = offset;
|
||||
|
||||
this.fixCaretPosition();
|
||||
|
||||
this.checkPostEditInvariants();
|
||||
}
|
||||
|
||||
@@ -1310,37 +1289,7 @@ module FourSlash {
|
||||
this.scenarioActions.push('<InsertText><![CDATA[' + text + ']]></InsertText>');
|
||||
}
|
||||
|
||||
if (this.typingFidelity === TypingFidelity.Low) {
|
||||
return this.typeLowFidelity(text);
|
||||
} else {
|
||||
return this.typeHighFidelity(text);
|
||||
}
|
||||
}
|
||||
|
||||
private typeLowFidelity(text: string) {
|
||||
var offset = this.currentCaretPosition;
|
||||
for (var i = 0; i < text.length; i++) {
|
||||
// Make the edit
|
||||
var ch = text.charAt(i);
|
||||
this.languageServiceShimHost.editScript(this.activeFile.fileName, offset, offset, ch);
|
||||
this.updateMarkersForEdit(this.activeFile.fileName, offset, offset, ch);
|
||||
this.editCheckpoint(this.activeFile.fileName);
|
||||
offset++;
|
||||
|
||||
// Handle post-keystroke formatting
|
||||
if (this.enableFormatting) {
|
||||
var edits = this.languageService.getFormattingEditsAfterKeystroke(this.activeFile.fileName, offset, ch, this.formatCodeOptions);
|
||||
offset += this.applyEdits(this.activeFile.fileName, edits, true);
|
||||
this.editCheckpoint(this.activeFile.fileName);
|
||||
}
|
||||
}
|
||||
|
||||
// Move the caret to wherever we ended up
|
||||
this.currentCaretPosition = offset;
|
||||
|
||||
this.fixCaretPosition();
|
||||
|
||||
this.checkPostEditInvariants();
|
||||
return this.typeHighFidelity(text);
|
||||
}
|
||||
|
||||
// Enters lines of text at the current caret position, invoking
|
||||
@@ -1356,7 +1305,7 @@ module FourSlash {
|
||||
this.languageService.getBraceMatchingAtPosition(this.activeFile.fileName, offset);
|
||||
|
||||
this.updateMarkersForEdit(this.activeFile.fileName, offset, offset, ch);
|
||||
this.editCheckpoint(this.activeFile.fileName);
|
||||
this.checkPostEditInvariants();
|
||||
offset++;
|
||||
|
||||
if (ch === '(' || ch === ',') {
|
||||
@@ -1364,7 +1313,7 @@ module FourSlash {
|
||||
this.languageService.getSignatureHelpItems(this.activeFile.fileName, offset);
|
||||
} else if (prevChar === ' ' && /A-Za-z_/.test(ch)) {
|
||||
/* Completions */
|
||||
this.languageService.getCompletionsAtPosition(this.activeFile.fileName, offset, false);
|
||||
this.languageService.getCompletionsAtPosition(this.activeFile.fileName, offset);
|
||||
}
|
||||
|
||||
if (i % errorCadence === 0) {
|
||||
@@ -1376,7 +1325,7 @@ module FourSlash {
|
||||
if (this.enableFormatting) {
|
||||
var edits = this.languageService.getFormattingEditsAfterKeystroke(this.activeFile.fileName, offset, ch, this.formatCodeOptions);
|
||||
offset += this.applyEdits(this.activeFile.fileName, edits, true);
|
||||
this.editCheckpoint(this.activeFile.fileName);
|
||||
this.checkPostEditInvariants();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1384,7 +1333,6 @@ module FourSlash {
|
||||
this.currentCaretPosition = offset;
|
||||
|
||||
this.fixCaretPosition();
|
||||
|
||||
this.checkPostEditInvariants();
|
||||
}
|
||||
|
||||
@@ -1396,14 +1344,14 @@ module FourSlash {
|
||||
var offset = this.currentCaretPosition;
|
||||
this.languageServiceShimHost.editScript(this.activeFile.fileName, offset, offset, text);
|
||||
this.updateMarkersForEdit(this.activeFile.fileName, offset, offset, text);
|
||||
this.editCheckpoint(this.activeFile.fileName);
|
||||
this.checkPostEditInvariants();
|
||||
offset += text.length;
|
||||
|
||||
// Handle formatting
|
||||
if (this.enableFormatting) {
|
||||
var edits = this.languageService.getFormattingEditsForRange(this.activeFile.fileName, start, offset, this.formatCodeOptions);
|
||||
offset += this.applyEdits(this.activeFile.fileName, edits, true);
|
||||
this.editCheckpoint(this.activeFile.fileName);
|
||||
this.checkPostEditInvariants();
|
||||
}
|
||||
|
||||
// Move the caret to wherever we ended up
|
||||
@@ -1414,44 +1362,43 @@ module FourSlash {
|
||||
}
|
||||
|
||||
private checkPostEditInvariants() {
|
||||
return;
|
||||
var incrementalSourceFile = this.languageService.getSourceFile(this.activeFile.fileName);
|
||||
Utils.assertInvariants(incrementalSourceFile, /*parent:*/ undefined);
|
||||
|
||||
/// TODO: reimplement this section
|
||||
//if (this.editValidation === IncrementalEditValidation.None) {
|
||||
// return;
|
||||
var incrementalSyntaxDiagnostics = JSON.stringify(Utils.convertDiagnostics(incrementalSourceFile.getSyntacticDiagnostics()));
|
||||
|
||||
// Check syntactic structure
|
||||
var snapshot = this.languageServiceShimHost.getScriptSnapshot(this.activeFile.fileName);
|
||||
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);
|
||||
var referenceSyntaxDiagnostics = JSON.stringify(Utils.convertDiagnostics(referenceSourceFile.getSyntacticDiagnostics()));
|
||||
|
||||
if (incrementalSyntaxDiagnostics !== referenceSyntaxDiagnostics) {
|
||||
this.raiseError('Mismatched incremental/reference syntactic diagnostics for file ' + this.activeFile.fileName + '.\n=== Incremental diagnostics ===\n' + incrementalSyntaxDiagnostics + '\n=== Reference Diagnostics ===\n' + referenceSyntaxDiagnostics);
|
||||
}
|
||||
|
||||
Utils.assertStructuralEquals(incrementalSourceFile, referenceSourceFile);
|
||||
|
||||
//if (this.editValidation !== IncrementalEditValidation.SyntacticOnly) {
|
||||
// var compiler = new TypeScript.TypeScriptCompiler();
|
||||
// for (var i = 0; i < this.testData.files.length; i++) {
|
||||
// snapshot = this.languageServiceShimHost.getScriptSnapshot(this.testData.files[i].fileName);
|
||||
// compiler.addFile(this.testData.files[i].fileName, TypeScript.ScriptSnapshot.fromString(snapshot.getText(0, snapshot.getLength())), ts.ByteOrderMark.None, 0, true);
|
||||
// }
|
||||
|
||||
// compiler.addFile('lib.d.ts', TypeScript.ScriptSnapshot.fromString(Harness.Compiler.libTextMinimal), ts.ByteOrderMark.None, 0, true);
|
||||
|
||||
// for (var i = 0; i < this.testData.files.length; i++) {
|
||||
// var refSemanticErrs = JSON.stringify(compiler.getSemanticDiagnostics(this.testData.files[i].fileName));
|
||||
// var incrSemanticErrs = JSON.stringify(this.languageService.getSemanticDiagnostics(this.testData.files[i].fileName));
|
||||
|
||||
// if (incrSemanticErrs !== refSemanticErrs) {
|
||||
// this.raiseError('Mismatched incremental/full semantic errors for file ' + this.testData.files[i].fileName + '\n=== Incremental errors ===\n' + incrSemanticErrs + '\n=== Full Errors ===\n' + refSemanticErrs);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
//// Get syntactic errors (to force a refresh)
|
||||
//var incrSyntaxErrs = JSON.stringify(this.languageService.getSyntacticDiagnostics(this.activeFile.fileName));
|
||||
|
||||
//// Check syntactic structure
|
||||
//var snapshot = this.languageServiceShimHost.getScriptSnapshot(this.activeFile.fileName);
|
||||
//var content = snapshot.getText(0, snapshot.getLength());
|
||||
//var refSyntaxTree = TypeScript.Parser.parse(this.activeFile.fileName, TypeScript.SimpleText.fromString(content), ts.ScriptTarget.ES5, TypeScript.isDTSFile(this.activeFile.fileName));
|
||||
//var fullSyntaxErrs = JSON.stringify(refSyntaxTree.diagnostics());
|
||||
|
||||
//if (incrSyntaxErrs !== fullSyntaxErrs) {
|
||||
// this.raiseError('Mismatched incremental/full syntactic errors for file ' + this.activeFile.fileName + '.\n=== Incremental errors ===\n' + incrSyntaxErrs + '\n=== Full Errors ===\n' + fullSyntaxErrs);
|
||||
//}
|
||||
|
||||
// if (this.editValidation !== IncrementalEditValidation.SyntacticOnly) {
|
||||
// var compiler = new TypeScript.TypeScriptCompiler();
|
||||
// for (var i = 0; i < this.testData.files.length; i++) {
|
||||
// snapshot = this.languageServiceShimHost.getScriptSnapshot(this.testData.files[i].fileName);
|
||||
// compiler.addFile(this.testData.files[i].fileName, TypeScript.ScriptSnapshot.fromString(snapshot.getText(0, snapshot.getLength())), ts.ByteOrderMark.None, 0, true);
|
||||
// }
|
||||
|
||||
// compiler.addFile('lib.d.ts', TypeScript.ScriptSnapshot.fromString(Harness.Compiler.libTextMinimal), ts.ByteOrderMark.None, 0, true);
|
||||
|
||||
// for (var i = 0; i < this.testData.files.length; i++) {
|
||||
// var refSemanticErrs = JSON.stringify(compiler.getSemanticDiagnostics(this.testData.files[i].fileName));
|
||||
// var incrSemanticErrs = JSON.stringify(this.languageService.getSemanticDiagnostics(this.testData.files[i].fileName));
|
||||
|
||||
// if (incrSemanticErrs !== refSemanticErrs) {
|
||||
// this.raiseError('Mismatched incremental/full semantic errors for file ' + this.testData.files[i].fileName + '\n=== Incremental errors ===\n' + incrSemanticErrs + '\n=== Full Errors ===\n' + refSemanticErrs);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
private fixCaretPosition() {
|
||||
@@ -1707,8 +1654,8 @@ module FourSlash {
|
||||
private verifyClassifications(expected: { classificationType: string; text: string; textSpan?: TextSpan }[], actual: ts.ClassifiedSpan[]) {
|
||||
if (actual.length !== expected.length) {
|
||||
this.raiseError('verifyClassifications failed - expected total classifications to be ' + expected.length +
|
||||
', but was ' + actual.length +
|
||||
jsonMismatchString());
|
||||
', but was ' + actual.length +
|
||||
jsonMismatchString());
|
||||
}
|
||||
|
||||
for (var i = 0; i < expected.length; i++) {
|
||||
@@ -1747,9 +1694,9 @@ module FourSlash {
|
||||
}
|
||||
|
||||
function jsonMismatchString() {
|
||||
return sys.newLine +
|
||||
"expected: '" + sys.newLine + JSON.stringify(expected, (k,v) => v, 2) + "'" + sys.newLine +
|
||||
"actual: '" + sys.newLine + JSON.stringify(actual, (k, v) => v, 2) + "'";
|
||||
return ts.sys.newLine +
|
||||
"expected: '" + ts.sys.newLine + JSON.stringify(expected,(k, v) => v, 2) + "'" + ts.sys.newLine +
|
||||
"actual: '" + ts.sys.newLine + JSON.stringify(actual,(k, v) => v, 2) + "'";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1761,7 +1708,7 @@ module FourSlash {
|
||||
}
|
||||
|
||||
public verifySyntacticClassifications(expected: { classificationType: string; text: string }[]) {
|
||||
var actual = this.languageService.getSyntacticClassifications(this.activeFile.fileName,
|
||||
var actual = this.languageService.getSyntacticClassifications(this.activeFile.fileName,
|
||||
new ts.TextSpan(0, this.activeFile.content.length));
|
||||
|
||||
this.verifyClassifications(expected, actual);
|
||||
@@ -2246,9 +2193,9 @@ module FourSlash {
|
||||
{ unitName: fileName, content: content }],
|
||||
(fn, contents) => result = contents,
|
||||
ts.ScriptTarget.Latest,
|
||||
sys.useCaseSensitiveFileNames);
|
||||
ts.sys.useCaseSensitiveFileNames);
|
||||
// TODO (drosen): We need to enforce checking on these tests.
|
||||
var program = ts.createProgram([Harness.Compiler.fourslashFilename, fileName], { out: "fourslashTestOutput.js", noResolve: true }, host);
|
||||
var program = ts.createProgram([Harness.Compiler.fourslashFilename, fileName], { out: "fourslashTestOutput.js", noResolve: true, target: ts.ScriptTarget.ES3 }, host);
|
||||
var checker = ts.createTypeChecker(program, /*fullTypeCheckMode*/ true);
|
||||
|
||||
var errors = program.getDiagnostics().concat(checker.getDiagnostics());
|
||||
@@ -2643,4 +2590,4 @@ module FourSlash {
|
||||
fileName: fileName
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
+289
-29
@@ -22,10 +22,13 @@
|
||||
/// <reference path='external\chai.d.ts'/>
|
||||
/// <reference path='sourceMapRecorder.ts'/>
|
||||
|
||||
declare var require: any;
|
||||
declare var process: any;
|
||||
|
||||
// this will work in the browser via browserify
|
||||
var _chai: typeof chai = require('chai');
|
||||
var assert: typeof _chai.assert = _chai.assert;
|
||||
declare var __dirname: any; // Node-specific
|
||||
declare var __dirname: string; // Node-specific
|
||||
var global = <any>Function("return this").call(null);
|
||||
|
||||
module Utils {
|
||||
@@ -41,7 +44,7 @@ module Utils {
|
||||
export function getExecutionEnvironment() {
|
||||
if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") {
|
||||
return ExecutionEnvironment.CScript;
|
||||
} else if (process && (<any>process).execPath && (<any>process).execPath.indexOf("node") !== -1) {
|
||||
} else if (process && process.execPath && process.execPath.indexOf("node") !== -1) {
|
||||
return ExecutionEnvironment.Node;
|
||||
} else {
|
||||
return ExecutionEnvironment.Browser;
|
||||
@@ -70,14 +73,18 @@ module Utils {
|
||||
}
|
||||
}
|
||||
|
||||
/** Splits the given string on \r\n or on only \n if that fails */
|
||||
/** Splits the given string on \r\n, or on only \n if that fails, or on only \r if *that* fails. */
|
||||
export function splitContentByNewlines(content: string) {
|
||||
// Split up the input file by line
|
||||
// Note: IE JS engine incorrectly handles consecutive delimiters here when using RegExp split, so
|
||||
// we have to string-based splitting instead and try to figure out the delimiting chars
|
||||
// we have to use string-based splitting instead and try to figure out the delimiting chars
|
||||
var lines = content.split('\r\n');
|
||||
if (lines.length === 1) {
|
||||
lines = content.split('\n');
|
||||
|
||||
if (lines.length === 1) {
|
||||
lines = content.split("\r");
|
||||
}
|
||||
}
|
||||
return lines;
|
||||
}
|
||||
@@ -89,7 +96,7 @@ module Utils {
|
||||
}
|
||||
|
||||
try {
|
||||
var content = sys.readFile(Harness.userSpecifiedroot + path);
|
||||
var content = ts.sys.readFile(Harness.userSpecifiedroot + path);
|
||||
}
|
||||
catch (err) {
|
||||
return undefined;
|
||||
@@ -111,6 +118,236 @@ module Utils {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export function assertInvariants(node: ts.Node, parent: ts.Node): void {
|
||||
if (node) {
|
||||
assert.isFalse(node.pos < 0, "node.pos < 0");
|
||||
assert.isFalse(node.end < 0, "node.end < 0");
|
||||
assert.isFalse(node.end < node.pos, "node.end < node.pos");
|
||||
assert.equal(node.parent, parent, "node.parent !== parent");
|
||||
|
||||
if (parent) {
|
||||
// Make sure each child is contained within the parent.
|
||||
assert.isFalse(node.pos < parent.pos, "node.pos < parent.pos");
|
||||
assert.isFalse(node.end > parent.end, "node.end > parent.end");
|
||||
}
|
||||
|
||||
ts.forEachChild(node, child => {
|
||||
assertInvariants(child, node);
|
||||
});
|
||||
|
||||
// Make sure each of the children is in order.
|
||||
var currentPos = 0;
|
||||
ts.forEachChild(node,
|
||||
child => {
|
||||
assert.isFalse(child.pos < currentPos, "child.pos < currentPos");
|
||||
currentPos = child.end;
|
||||
},
|
||||
(array: ts.NodeArray<ts.Node>) => {
|
||||
assert.isFalse(array.pos < node.pos, "array.pos < node.pos");
|
||||
assert.isFalse(array.end > node.end, "array.end > node.end");
|
||||
assert.isFalse(array.pos < currentPos, "array.pos < currentPos");
|
||||
|
||||
for (var i = 0, n = array.length; i < n; i++) {
|
||||
assert.isFalse(array[i].pos < currentPos, "array[i].pos < currentPos");
|
||||
currentPos = array[i].end
|
||||
}
|
||||
|
||||
currentPos = array.end;
|
||||
});
|
||||
|
||||
var childNodesAndArrays: any[] = [];
|
||||
ts.forEachChild(node, child => { childNodesAndArrays.push(child) }, array => { childNodesAndArrays.push(array) });
|
||||
|
||||
for (var childName in node) {
|
||||
if (childName === "parent" || childName === "nextContainer" || childName === "modifiers" || childName === "externalModuleIndicator") {
|
||||
continue;
|
||||
}
|
||||
var child = (<any>node)[childName];
|
||||
if (isNodeOrArray(child)) {
|
||||
assert.isFalse(childNodesAndArrays.indexOf(child) < 0,
|
||||
"Missing child when forEach'ing over node: " + (<any>ts).SyntaxKind[node.kind] + "-" + childName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function isNodeOrArray(a: any): boolean {
|
||||
return a !== undefined && typeof a.pos === "number";
|
||||
}
|
||||
|
||||
export function convertDiagnostics(diagnostics: ts.Diagnostic[]) {
|
||||
return diagnostics.map(convertDiagnostic);
|
||||
}
|
||||
|
||||
function convertDiagnostic(diagnostic: ts.Diagnostic) {
|
||||
return {
|
||||
start: diagnostic.start,
|
||||
length: diagnostic.length,
|
||||
messageText: diagnostic.messageText,
|
||||
category: (<any>ts).DiagnosticCategory[diagnostic.category],
|
||||
code: diagnostic.code
|
||||
};
|
||||
}
|
||||
|
||||
export function sourceFileToJSON(file: ts.SourceFile): string {
|
||||
return JSON.stringify(file,(k, v) => {
|
||||
return isNodeOrArray(v) ? serializeNode(v) : v;
|
||||
}, " ");
|
||||
|
||||
function getKindName(k: number): string {
|
||||
return (<any>ts).SyntaxKind[k]
|
||||
}
|
||||
|
||||
function getFlagName(flags: any, f: number): any {
|
||||
if (f === 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
var result = "";
|
||||
ts.forEach(Object.getOwnPropertyNames(flags),(v: any) => {
|
||||
if (isFinite(v)) {
|
||||
v = +v;
|
||||
if (f === +v) {
|
||||
result = flags[v];
|
||||
return true;
|
||||
}
|
||||
else if ((f & v) > 0) {
|
||||
if (result.length)
|
||||
result += " | ";
|
||||
result += flags[v];
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
function getNodeFlagName(f: number) { return getFlagName((<any>ts).NodeFlags, f); }
|
||||
function getParserContextFlagName(f: number) { return getFlagName((<any>ts).ParserContextFlags, f); }
|
||||
|
||||
function serializeNode(n: ts.Node): any {
|
||||
var o: any = { kind: getKindName(n.kind) };
|
||||
o.containsParseError = ts.containsParseError(n);
|
||||
|
||||
ts.forEach(Object.getOwnPropertyNames(n), propertyName => {
|
||||
switch (propertyName) {
|
||||
case "parent":
|
||||
case "symbol":
|
||||
case "locals":
|
||||
case "localSymbol":
|
||||
case "kind":
|
||||
case "semanticDiagnostics":
|
||||
case "id":
|
||||
case "nodeCount":
|
||||
case "symbolCount":
|
||||
case "identifierCount":
|
||||
case "scriptSnapshot":
|
||||
// Blacklist of items we never put in the baseline file.
|
||||
break;
|
||||
|
||||
case "flags":
|
||||
// Print out flags with their enum names.
|
||||
o[propertyName] = getNodeFlagName(n.flags);
|
||||
break;
|
||||
|
||||
case "parserContextFlags":
|
||||
// Clear the flag that are produced by aggregating child values.. That is ephemeral
|
||||
// data we don't care about in the dump. We only care what the parser set directly
|
||||
// on the ast.
|
||||
var value = n.parserContextFlags & ts.ParserContextFlags.ParserGeneratedFlags;
|
||||
if (value) {
|
||||
o[propertyName] = getParserContextFlagName(value);
|
||||
}
|
||||
break;
|
||||
|
||||
case "referenceDiagnostics":
|
||||
case "parseDiagnostics":
|
||||
case "grammarDiagnostics":
|
||||
o[propertyName] = Utils.convertDiagnostics((<any>n)[propertyName]);
|
||||
break;
|
||||
|
||||
case "nextContainer":
|
||||
if (n.nextContainer) {
|
||||
o[propertyName] = { kind: n.nextContainer.kind, pos: n.nextContainer.pos, end: n.nextContainer.end };
|
||||
}
|
||||
break;
|
||||
|
||||
case "text":
|
||||
// Include 'text' field for identifiers/literals, but not for source files.
|
||||
if (n.kind !== ts.SyntaxKind.SourceFile) {
|
||||
o[propertyName] = (<any>n)[propertyName];
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
o[propertyName] = (<any>n)[propertyName];
|
||||
}
|
||||
|
||||
return undefined;
|
||||
});
|
||||
|
||||
return o;
|
||||
}
|
||||
}
|
||||
|
||||
export function assertStructuralEquals(node1: ts.Node, node2: ts.Node) {
|
||||
if (node1 === node2) {
|
||||
return;
|
||||
}
|
||||
|
||||
assert(node1, "node1");
|
||||
assert(node2, "node2");
|
||||
assert.equal(node1.pos, node2.pos, "node1.pos !== node2.pos");
|
||||
assert.equal(node1.end, node2.end, "node1.end !== node2.end");
|
||||
assert.equal(node1.kind, node2.kind, "node1.kind !== node2.kind");
|
||||
assert.equal(node1.flags, node2.flags, "node1.flags !== node2.flags");
|
||||
|
||||
// call this on both nodes to ensure all propagated flags have been set (and thus can be
|
||||
// compared).
|
||||
assert.equal(ts.containsParseError(node1), ts.containsParseError(node2));
|
||||
assert.equal(node1.parserContextFlags, node2.parserContextFlags, "node1.parserContextFlags !== node2.parserContextFlags");
|
||||
|
||||
ts.forEachChild(node1,
|
||||
child1 => {
|
||||
var childName = findChildName(node1, child1);
|
||||
var child2: ts.Node = (<any>node2)[childName];
|
||||
|
||||
assertStructuralEquals(child1, child2);
|
||||
},
|
||||
(array1: ts.NodeArray<ts.Node>) => {
|
||||
var childName = findChildName(node1, array1);
|
||||
var array2: ts.NodeArray<ts.Node> = (<any>node2)[childName];
|
||||
|
||||
assertArrayStructuralEquals(array1, array2);
|
||||
});
|
||||
}
|
||||
|
||||
function assertArrayStructuralEquals(array1: ts.NodeArray<ts.Node>, array2: ts.NodeArray<ts.Node>) {
|
||||
if (array1 === array2) {
|
||||
return;
|
||||
}
|
||||
|
||||
assert(array1, "array1");
|
||||
assert(array2, "array2");
|
||||
assert.equal(array1.pos, array2.pos, "array1.pos !== array2.pos");
|
||||
assert.equal(array1.end, array2.end, "array1.end !== array2.end");
|
||||
assert.equal(array1.length, array2.length, "array1.length !== array2.length");
|
||||
|
||||
for (var i = 0, n = array1.length; i < n; i++) {
|
||||
assertStructuralEquals(array1[i], array2[i]);
|
||||
}
|
||||
}
|
||||
|
||||
function findChildName(parent: any, child: any) {
|
||||
for (var name in parent) {
|
||||
if (parent.hasOwnProperty(name) && parent[name] === child) {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
throw new Error("Could not find child in parent");
|
||||
}
|
||||
}
|
||||
|
||||
module Harness.Path {
|
||||
@@ -156,8 +393,8 @@ module Harness {
|
||||
fso = {};
|
||||
}
|
||||
|
||||
export var readFile: typeof IO.readFile = sys.readFile;
|
||||
export var writeFile: typeof IO.writeFile = sys.writeFile;
|
||||
export var readFile: typeof IO.readFile = ts.sys.readFile;
|
||||
export var writeFile: typeof IO.writeFile = ts.sys.writeFile;
|
||||
export var directoryName: typeof IO.directoryName = fso.GetParentFolderName;
|
||||
export var directoryExists: typeof IO.directoryExists = fso.FolderExists;
|
||||
export var fileExists: typeof IO.fileExists = fso.FileExists;
|
||||
@@ -218,8 +455,8 @@ module Harness {
|
||||
fs = pathModule = {};
|
||||
}
|
||||
|
||||
export var readFile: typeof IO.readFile = sys.readFile;
|
||||
export var writeFile: typeof IO.writeFile = sys.writeFile;
|
||||
export var readFile: typeof IO.readFile = ts.sys.readFile;
|
||||
export var writeFile: typeof IO.writeFile = ts.sys.writeFile;
|
||||
export var fileExists: typeof IO.fileExists = fs.existsSync;
|
||||
export var log: typeof IO.log = console.log;
|
||||
|
||||
@@ -538,8 +775,8 @@ module Harness {
|
||||
}
|
||||
|
||||
export var defaultLibFileName = 'lib.d.ts';
|
||||
export var defaultLibSourceFile = ts.createSourceFile(defaultLibFileName, IO.readFile(libFolder + 'lib.core.d.ts'), /*languageVersion*/ ts.ScriptTarget.Latest, /*version:*/ "0");
|
||||
export var defaultES6LibSourceFile = ts.createSourceFile(defaultLibFileName, IO.readFile(libFolder + 'lib.core.es6.d.ts'), /*languageVersion*/ ts.ScriptTarget.Latest, /*version:*/ "0");
|
||||
export var defaultLibSourceFile = ts.createSourceFile(defaultLibFileName, IO.readFile(libFolder + 'lib.core.d.ts'), /*languageVersion*/ ts.ScriptTarget.Latest);
|
||||
export var defaultES6LibSourceFile = ts.createSourceFile(defaultLibFileName, IO.readFile(libFolder + 'lib.core.es6.d.ts'), /*languageVersion*/ ts.ScriptTarget.Latest);
|
||||
|
||||
|
||||
// Cache these between executions so we don't have to re-parse them for every test
|
||||
@@ -547,7 +784,7 @@ module Harness {
|
||||
export var fourslashSourceFile: ts.SourceFile;
|
||||
|
||||
export function getCanonicalFileName(fileName: string): string {
|
||||
return sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase();
|
||||
return ts.sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase();
|
||||
}
|
||||
|
||||
export function createCompilerHost(inputFiles: { unitName: string; content: string; }[],
|
||||
@@ -565,21 +802,20 @@ module Harness {
|
||||
function register(file: { unitName: string; content: string; }) {
|
||||
if (file.content !== undefined) {
|
||||
var filename = ts.normalizeSlashes(file.unitName);
|
||||
filemap[getCanonicalFileName(filename)] = ts.createSourceFile(filename, file.content, scriptTarget, /*version:*/ "0");
|
||||
filemap[getCanonicalFileName(filename)] = ts.createSourceFile(filename, file.content, scriptTarget);
|
||||
}
|
||||
};
|
||||
inputFiles.forEach(register);
|
||||
|
||||
return {
|
||||
getCurrentDirectory: sys.getCurrentDirectory,
|
||||
getCancellationToken: (): any => undefined,
|
||||
getCurrentDirectory: ts.sys.getCurrentDirectory,
|
||||
getSourceFile: (fn, languageVersion) => {
|
||||
if (Object.prototype.hasOwnProperty.call(filemap, getCanonicalFileName(fn))) {
|
||||
return filemap[getCanonicalFileName(fn)];
|
||||
}
|
||||
else if (fn === fourslashFilename) {
|
||||
var tsFn = 'tests/cases/fourslash/' + fourslashFilename;
|
||||
fourslashSourceFile = fourslashSourceFile || ts.createSourceFile(tsFn, Harness.IO.readFile(tsFn), scriptTarget, /*version*/ "0", /*isOpen*/ false);
|
||||
fourslashSourceFile = fourslashSourceFile || ts.createSourceFile(tsFn, Harness.IO.readFile(tsFn), scriptTarget);
|
||||
return fourslashSourceFile;
|
||||
}
|
||||
else {
|
||||
@@ -594,7 +830,7 @@ module Harness {
|
||||
writeFile,
|
||||
getCanonicalFileName,
|
||||
useCaseSensitiveFileNames: () => useCaseSensitiveFileNames,
|
||||
getNewLine: ()=> sys.newLine
|
||||
getNewLine: () => ts.sys.newLine
|
||||
};
|
||||
}
|
||||
|
||||
@@ -636,7 +872,7 @@ module Harness {
|
||||
}
|
||||
|
||||
public emitAll(ioHost?: IEmitterIOHost) {
|
||||
this.compileFiles(this.inputFiles, [], (result) => {
|
||||
this.compileFiles(this.inputFiles, [],(result) => {
|
||||
result.files.forEach(file => {
|
||||
ioHost.writeFile(file.fileName, file.code, false);
|
||||
});
|
||||
@@ -646,7 +882,7 @@ module Harness {
|
||||
result.sourceMaps.forEach(file => {
|
||||
ioHost.writeFile(file.fileName, file.code, false);
|
||||
});
|
||||
}, () => { }, this.compileOptions);
|
||||
},() => { }, this.compileOptions);
|
||||
}
|
||||
|
||||
public compileFiles(inputFiles: { unitName: string; content: string }[],
|
||||
@@ -664,7 +900,7 @@ module Harness {
|
||||
settingsCallback(null);
|
||||
}
|
||||
|
||||
var useCaseSensitiveFileNames = sys.useCaseSensitiveFileNames;
|
||||
var useCaseSensitiveFileNames = ts.sys.useCaseSensitiveFileNames;
|
||||
this.settings.forEach(setting => {
|
||||
switch (setting.flag.toLowerCase()) {
|
||||
// "filename", "comments", "declaration", "module", "nolib", "sourcemap", "target", "out", "outdir", "noimplicitany", "noresolve"
|
||||
@@ -742,7 +978,7 @@ module Harness {
|
||||
|
||||
case 'newline':
|
||||
case 'newlines':
|
||||
sys.newLine = setting.value;
|
||||
ts.sys.newLine = setting.value;
|
||||
break;
|
||||
|
||||
case 'comments':
|
||||
@@ -774,9 +1010,19 @@ module Harness {
|
||||
case 'errortruncation':
|
||||
options.noErrorTruncation = setting.value === 'false';
|
||||
break;
|
||||
|
||||
case 'preserveconstenums':
|
||||
options.preserveConstEnums = setting.value === 'true';
|
||||
break;
|
||||
|
||||
case 'suppressimplicitanyindexerrors':
|
||||
options.suppressImplicitAnyIndexErrors = setting.value === 'true';
|
||||
break;
|
||||
|
||||
case 'includebuiltfile':
|
||||
inputFiles.push({ unitName: setting.value, content: IO.readFile(libFolder + setting.value) });
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Error('Unsupported compiler setting ' + setting.flag);
|
||||
}
|
||||
@@ -786,7 +1032,7 @@ module Harness {
|
||||
var register = (file: { unitName: string; content: string; }) => {
|
||||
if (file.content !== undefined) {
|
||||
var filename = ts.normalizeSlashes(file.unitName);
|
||||
filemap[getCanonicalFileName(filename)] = ts.createSourceFile(filename, file.content, options.target, /*version:*/ "0");
|
||||
filemap[getCanonicalFileName(filename)] = ts.createSourceFile(filename, file.content, options.target);
|
||||
}
|
||||
};
|
||||
inputFiles.forEach(register);
|
||||
@@ -817,11 +1063,11 @@ module Harness {
|
||||
});
|
||||
this.lastErrors = errors;
|
||||
|
||||
var result = new CompilerResult(fileOutputs, errors, program, sys.getCurrentDirectory(), emitResult ? emitResult.sourceMaps : undefined);
|
||||
var result = new CompilerResult(fileOutputs, errors, program, ts.sys.getCurrentDirectory(), emitResult ? emitResult.sourceMaps : undefined);
|
||||
onComplete(result, checker);
|
||||
|
||||
// reset what newline means in case the last test changed it
|
||||
sys.newLine = '\r\n';
|
||||
ts.sys.newLine = '\r\n';
|
||||
return options;
|
||||
}
|
||||
|
||||
@@ -883,7 +1129,7 @@ module Harness {
|
||||
return ts.removeFileExtension(sourceFileName) + ".d.ts";
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return ts.forEach(result.declFilesCode, declFile => declFile.fileName === dTsFileName ? declFile : undefined);
|
||||
}
|
||||
|
||||
@@ -916,13 +1162,23 @@ module Harness {
|
||||
errorOutput += diagnotic.filename + "(" + diagnotic.line + "," + diagnotic.character + "): ";
|
||||
}
|
||||
|
||||
errorOutput += diagnotic.category + " TS" + diagnotic.code + ": " + diagnotic.message + sys.newLine;
|
||||
errorOutput += diagnotic.category + " TS" + diagnotic.code + ": " + diagnotic.message + ts.sys.newLine;
|
||||
});
|
||||
|
||||
return errorOutput;
|
||||
}
|
||||
|
||||
function compareDiagnostics(d1: HarnessDiagnostic, d2: HarnessDiagnostic) {
|
||||
return ts.compareValues(d1.filename, d2.filename) ||
|
||||
ts.compareValues(d1.start, d2.start) ||
|
||||
ts.compareValues(d1.end, d2.end) ||
|
||||
ts.compareValues(d1.code, d2.code) ||
|
||||
ts.compareValues(d1.message, d2.message) ||
|
||||
0;
|
||||
}
|
||||
|
||||
export function getErrorBaseline(inputFiles: { unitName: string; content: string }[], diagnostics: HarnessDiagnostic[]) {
|
||||
diagnostics.sort(compareDiagnostics);
|
||||
|
||||
var outputLines: string[] = [];
|
||||
// Count up all the errors we find so we don't miss any
|
||||
@@ -963,6 +1219,10 @@ module Harness {
|
||||
|
||||
var lineStarts = ts.computeLineStarts(inputFile.content);
|
||||
var lines = inputFile.content.split('\n');
|
||||
if (lines.length === 1) {
|
||||
lines = lines[0].split("\r");
|
||||
}
|
||||
|
||||
lines.forEach((line, lineIndex) => {
|
||||
if (line.length > 0 && line.charAt(line.length - 1) === '\r') {
|
||||
line = line.substr(0, line.length - 1);
|
||||
@@ -1014,7 +1274,7 @@ module Harness {
|
||||
assert.equal(totalErrorsReported + numLibraryDiagnostics, diagnostics.length, 'total number of errors');
|
||||
|
||||
return minimalDiagnosticsToString(diagnostics) +
|
||||
sys.newLine + sys.newLine + outputLines.join('\r\n');
|
||||
ts.sys.newLine + ts.sys.newLine + outputLines.join('\r\n');
|
||||
}
|
||||
|
||||
export function collateOutputs(outputFiles: Harness.Compiler.GeneratedFile[], clean?: (s: string) => string) {
|
||||
@@ -1162,7 +1422,7 @@ module Harness {
|
||||
var optionRegex = /^[\/]{2}\s*@(\w+)\s*:\s*(\S*)/gm; // multiple matches on multiple lines
|
||||
|
||||
// List of allowed metadata names
|
||||
var fileMetadataNames = ["filename", "comments", "declaration", "module", "nolib", "sourcemap", "target", "out", "outdir", "noemitonerror","noimplicitany", "noresolve", "newline", "newlines", "emitbom", "errortruncation", "usecasesensitivefilenames", "preserveconstenums"];
|
||||
var fileMetadataNames = ["filename", "comments", "declaration", "module", "nolib", "sourcemap", "target", "out", "outdir", "noemitonerror", "noimplicitany", "noresolve", "newline", "newlines", "emitbom", "errortruncation", "usecasesensitivefilenames", "preserveconstenums", "includebuiltfile", "suppressimplicitanyindexerrors"];
|
||||
|
||||
function extractCompilerSettings(content: string): CompilerSetting[] {
|
||||
|
||||
@@ -1392,4 +1652,4 @@ module Harness {
|
||||
}
|
||||
|
||||
// TODO: not sure why Utils.evalFile isn't working with this, eventually will concat it like old compiler instead of eval
|
||||
eval(Harness.tcServicesFile);
|
||||
eval(Harness.tcServicesFile);
|
||||
@@ -111,7 +111,10 @@ module Harness.LanguageService {
|
||||
scriptSnapshot: ts.IScriptSnapshot,
|
||||
version: string,
|
||||
isOpen: boolean): ts.SourceFile {
|
||||
return ts.createSourceFile(fileName, scriptSnapshot.getText(0, scriptSnapshot.getLength()), compilationSettings.target, version, isOpen);
|
||||
var sourceFile = ts.createSourceFile(fileName, scriptSnapshot.getText(0, scriptSnapshot.getLength()), compilationSettings.target);
|
||||
sourceFile.version = version;
|
||||
sourceFile.isOpen = isOpen;
|
||||
return sourceFile;
|
||||
}
|
||||
|
||||
public updateDocument(
|
||||
@@ -134,11 +137,14 @@ module Harness.LanguageService {
|
||||
private ls: ts.LanguageServiceShim = null;
|
||||
|
||||
private fileNameToScript: ts.Map<ScriptInfo> = {};
|
||||
private settings: ts.CompilationSettings = {};
|
||||
private settings: ts.CompilerOptions = {};
|
||||
|
||||
constructor(private cancellationToken: ts.CancellationToken = CancellationToken.None) {
|
||||
}
|
||||
|
||||
public trace(s: string) {
|
||||
}
|
||||
|
||||
public addDefaultLibrary() {
|
||||
this.addScript(Harness.Compiler.defaultLibFileName, Harness.Compiler.defaultLibSourceFile.text);
|
||||
}
|
||||
@@ -245,7 +251,7 @@ module Harness.LanguageService {
|
||||
return this.ls;
|
||||
}
|
||||
|
||||
public setCompilationSettings(settings: ts.CompilationSettings) {
|
||||
public setCompilationSettings(settings: ts.CompilerOptions) {
|
||||
for (var key in settings) {
|
||||
if (settings.hasOwnProperty(key)) {
|
||||
this.settings[key] = settings[key];
|
||||
@@ -264,7 +270,10 @@ module Harness.LanguageService {
|
||||
|
||||
/** Parse file given its source text */
|
||||
public parseSourceText(fileName: string, sourceText: ts.IScriptSnapshot): ts.SourceFile {
|
||||
return ts.createSourceFile(fileName, sourceText.getText(0, sourceText.getLength()), ts.ScriptTarget.Latest, "1", true);
|
||||
var result = ts.createSourceFile(fileName, sourceText.getText(0, sourceText.getLength()), ts.ScriptTarget.Latest);
|
||||
result.version = "1";
|
||||
result.isOpen = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
/** Parse a file on disk given its fileName */
|
||||
|
||||
@@ -91,7 +91,7 @@ module Playback {
|
||||
return run;
|
||||
}
|
||||
|
||||
export interface PlaybackSystem extends System, PlaybackControl { }
|
||||
export interface PlaybackSystem extends ts.System, PlaybackControl { }
|
||||
|
||||
function createEmptyLog(): IOLog {
|
||||
return {
|
||||
@@ -221,7 +221,7 @@ module Playback {
|
||||
//console.log("Swallowed write operation during replay: " + name);
|
||||
}
|
||||
|
||||
export function wrapSystem(underlying: System): PlaybackSystem {
|
||||
export function wrapSystem(underlying: ts.System): PlaybackSystem {
|
||||
var wrapper: PlaybackSystem = <any>{};
|
||||
initWrapper(wrapper, underlying);
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ class ProjectRunner extends RunnerBase {
|
||||
var testCase: ProjectRunnerTestCase;
|
||||
|
||||
try {
|
||||
var testFileText = sys.readFile(testCaseFileName);
|
||||
var testFileText = ts.sys.readFile(testCaseFileName);
|
||||
}
|
||||
catch (e) {
|
||||
assert(false, "Unable to open testcase file: " + testCaseFileName + ": " + e.message);
|
||||
@@ -96,7 +96,7 @@ class ProjectRunner extends RunnerBase {
|
||||
}
|
||||
|
||||
function cleanProjectUrl(url: string) {
|
||||
var diskProjectPath = ts.normalizeSlashes(sys.resolvePath(testCase.projectRoot));
|
||||
var diskProjectPath = ts.normalizeSlashes(ts.sys.resolvePath(testCase.projectRoot));
|
||||
var projectRootUrl = "file:///" + diskProjectPath;
|
||||
var normalizedProjectRoot = ts.normalizeSlashes(testCase.projectRoot);
|
||||
diskProjectPath = diskProjectPath.substr(0, diskProjectPath.lastIndexOf(normalizedProjectRoot));
|
||||
@@ -119,7 +119,7 @@ class ProjectRunner extends RunnerBase {
|
||||
}
|
||||
|
||||
function getCurrentDirectory() {
|
||||
return sys.resolvePath(testCase.projectRoot);
|
||||
return ts.sys.resolvePath(testCase.projectRoot);
|
||||
}
|
||||
|
||||
function compileProjectFiles(moduleKind: ts.ModuleKind, getInputFiles: ()=> string[],
|
||||
@@ -161,8 +161,8 @@ class ProjectRunner extends RunnerBase {
|
||||
sourceMap: !!testCase.sourceMap,
|
||||
out: testCase.out,
|
||||
outDir: testCase.outDir,
|
||||
mapRoot: testCase.resolveMapRoot && testCase.mapRoot ? sys.resolvePath(testCase.mapRoot) : testCase.mapRoot,
|
||||
sourceRoot: testCase.resolveSourceRoot && testCase.sourceRoot ? sys.resolvePath(testCase.sourceRoot) : testCase.sourceRoot,
|
||||
mapRoot: testCase.resolveMapRoot && testCase.mapRoot ? ts.sys.resolvePath(testCase.mapRoot) : testCase.mapRoot,
|
||||
sourceRoot: testCase.resolveSourceRoot && testCase.sourceRoot ? ts.sys.resolvePath(testCase.sourceRoot) : testCase.sourceRoot,
|
||||
module: moduleKind,
|
||||
noResolve: testCase.noResolve
|
||||
};
|
||||
@@ -176,7 +176,7 @@ class ProjectRunner extends RunnerBase {
|
||||
else {
|
||||
var text = getSourceFileText(filename);
|
||||
if (text !== undefined) {
|
||||
sourceFile = ts.createSourceFile(filename, text, languageVersion, /*version:*/ "0");
|
||||
sourceFile = ts.createSourceFile(filename, text, languageVersion);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,8 +190,8 @@ class ProjectRunner extends RunnerBase {
|
||||
writeFile,
|
||||
getCurrentDirectory,
|
||||
getCanonicalFileName: Harness.Compiler.getCanonicalFileName,
|
||||
useCaseSensitiveFileNames: () => sys.useCaseSensitiveFileNames,
|
||||
getNewLine: () => sys.newLine
|
||||
useCaseSensitiveFileNames: () => ts.sys.useCaseSensitiveFileNames,
|
||||
getNewLine: () => ts.sys.newLine
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -213,7 +213,7 @@ class ProjectRunner extends RunnerBase {
|
||||
|
||||
function getSourceFileText(filename: string): string {
|
||||
try {
|
||||
var text = sys.readFile(ts.isRootedDiskPath(filename)
|
||||
var text = ts.sys.readFile(ts.isRootedDiskPath(filename)
|
||||
? filename
|
||||
: ts.normalizeSlashes(testCase.projectRoot) + "/" + ts.normalizeSlashes(filename));
|
||||
}
|
||||
@@ -260,14 +260,14 @@ class ProjectRunner extends RunnerBase {
|
||||
// Actual writing of file as in tc.ts
|
||||
function ensureDirectoryStructure(directoryname: string) {
|
||||
if (directoryname) {
|
||||
if (!sys.directoryExists(directoryname)) {
|
||||
if (!ts.sys.directoryExists(directoryname)) {
|
||||
ensureDirectoryStructure(ts.getDirectoryPath(directoryname));
|
||||
sys.createDirectory(directoryname);
|
||||
ts.sys.createDirectory(directoryname);
|
||||
}
|
||||
}
|
||||
}
|
||||
ensureDirectoryStructure(ts.getDirectoryPath(ts.normalizePath(outputFilePath)));
|
||||
sys.writeFile(outputFilePath, data, writeByteOrderMark);
|
||||
ts.sys.writeFile(outputFilePath, data, writeByteOrderMark);
|
||||
|
||||
outputFiles.push({ emittedFileName: filename, code: data, fileName: diskRelativeName, writeByteOrderMark: writeByteOrderMark });
|
||||
}
|
||||
@@ -374,7 +374,7 @@ class ProjectRunner extends RunnerBase {
|
||||
it('Baseline of emitted result (' + moduleNameToString(compilerResult.moduleKind) + '): ' + testCaseFileName, () => {
|
||||
Harness.Baseline.runBaseline('Baseline of emitted result (' + moduleNameToString(compilerResult.moduleKind) + '): ' + testCaseFileName, getBaselineFolder(compilerResult.moduleKind) + outputFile.fileName, () => {
|
||||
try {
|
||||
return sys.readFile(getProjectOutputFolder(outputFile.fileName, compilerResult.moduleKind));
|
||||
return ts.sys.readFile(getProjectOutputFolder(outputFile.fileName, compilerResult.moduleKind));
|
||||
}
|
||||
catch (e) {
|
||||
return undefined;
|
||||
|
||||
@@ -94,6 +94,6 @@ if (runners.length === 0) {
|
||||
//runners.push(new GeneratedFourslashRunner());
|
||||
}
|
||||
|
||||
sys.newLine = '\r\n';
|
||||
ts.sys.newLine = '\r\n';
|
||||
|
||||
runTests(runners);
|
||||
|
||||
@@ -6,17 +6,17 @@
|
||||
|
||||
module RWC {
|
||||
function runWithIOLog(ioLog: IOLog, fn: () => void) {
|
||||
var oldSys = sys;
|
||||
var oldSys = ts.sys;
|
||||
|
||||
var wrappedSys = Playback.wrapSystem(sys);
|
||||
var wrappedSys = Playback.wrapSystem(ts.sys);
|
||||
wrappedSys.startReplayFromData(ioLog);
|
||||
sys = wrappedSys;
|
||||
ts.sys = wrappedSys;
|
||||
|
||||
try {
|
||||
fn();
|
||||
} finally {
|
||||
wrappedSys.endReplay();
|
||||
sys = oldSys;
|
||||
ts.sys = oldSys;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ module RWC {
|
||||
}
|
||||
|
||||
ts.forEach(ioLog.filesRead, fileRead => {
|
||||
var resolvedPath = ts.normalizeSlashes(sys.resolvePath(fileRead.path));
|
||||
var resolvedPath = ts.normalizeSlashes(ts.sys.resolvePath(fileRead.path));
|
||||
var inInputList = ts.forEach(inputFiles, inputFile=> inputFile.unitName === resolvedPath);
|
||||
if (!inInputList) {
|
||||
// Add the file to other files
|
||||
@@ -92,9 +92,9 @@ module RWC {
|
||||
});
|
||||
|
||||
function getHarnessCompilerInputUnit(fileName: string) {
|
||||
var unitName = ts.normalizeSlashes(sys.resolvePath(fileName));
|
||||
var unitName = ts.normalizeSlashes(ts.sys.resolvePath(fileName));
|
||||
try {
|
||||
var content = sys.readFile(unitName);
|
||||
var content = ts.sys.readFile(unitName);
|
||||
}
|
||||
catch (e) {
|
||||
// Leave content undefined.
|
||||
@@ -160,7 +160,7 @@ module RWC {
|
||||
}
|
||||
|
||||
return Harness.Compiler.minimalDiagnosticsToString(declFileCompilationResult.declResult.errors) +
|
||||
sys.newLine + sys.newLine +
|
||||
ts.sys.newLine + ts.sys.newLine +
|
||||
Harness.Compiler.getErrorBaseline(declFileCompilationResult.declInputFiles.concat(declFileCompilationResult.declOtherFiles), declFileCompilationResult.declResult.errors);
|
||||
}, false, baselineOpts);
|
||||
}
|
||||
|
||||
@@ -21,191 +21,6 @@ class Test262BaselineRunner extends RunnerBase {
|
||||
return Test262BaselineRunner.basePath + "/" + filename;
|
||||
}
|
||||
|
||||
private static checkInvariants(node: ts.Node, parent: ts.Node): void {
|
||||
if (node) {
|
||||
if (node.pos < 0) {
|
||||
throw new Error("node.pos < 0");
|
||||
}
|
||||
if (node.end < 0) {
|
||||
throw new Error("node.end < 0");
|
||||
}
|
||||
if (node.end < node.pos) {
|
||||
throw new Error("node.end < node.pos");
|
||||
}
|
||||
if (node.parent !== parent) {
|
||||
throw new Error("node.parent !== parent");
|
||||
}
|
||||
if (parent) {
|
||||
// Make sure each child is contained within the parent.
|
||||
if (node.pos < parent.pos) {
|
||||
throw new Error("node.pos < parent.pos");
|
||||
}
|
||||
if (node.end > parent.end) {
|
||||
throw new Error("node.end > parent.end");
|
||||
}
|
||||
}
|
||||
|
||||
ts.forEachChild(node, child => {
|
||||
Test262BaselineRunner.checkInvariants(child, node);
|
||||
});
|
||||
|
||||
// Make sure each of the children is in order.
|
||||
var currentPos = 0;
|
||||
ts.forEachChild(node,
|
||||
child => {
|
||||
if (child.pos < currentPos) {
|
||||
throw new Error("child.pos < currentPos");
|
||||
}
|
||||
currentPos = child.end;
|
||||
},
|
||||
(array: ts.NodeArray<ts.Node>) => {
|
||||
if (array.pos < node.pos) {
|
||||
throw new Error("array.pos < node.pos");
|
||||
}
|
||||
if (array.end > node.end) {
|
||||
throw new Error("array.end > node.end");
|
||||
}
|
||||
|
||||
if (array.pos < currentPos) {
|
||||
throw new Error("array.pos < currentPos");
|
||||
}
|
||||
for (var i = 0, n = array.length; i < n; i++) {
|
||||
if (array[i].pos < currentPos) {
|
||||
throw new Error("array[i].pos < currentPos");
|
||||
}
|
||||
currentPos = array[i].end
|
||||
}
|
||||
|
||||
currentPos = array.end;
|
||||
});
|
||||
|
||||
var childNodesAndArrays: any[] = [];
|
||||
ts.forEachChild(node, child => { childNodesAndArrays.push(child) }, array => { childNodesAndArrays.push(array) });
|
||||
|
||||
for (var childName in node) {
|
||||
if (childName === "parent" || childName === "nextContainer" || childName === "modifiers" || childName === "externalModuleIndicator") {
|
||||
continue;
|
||||
}
|
||||
var child = (<any>node)[childName];
|
||||
if (Test262BaselineRunner.isNodeOrArray(child)) {
|
||||
if (childNodesAndArrays.indexOf(child) < 0) {
|
||||
throw new Error("Child when forEach'ing over node. " + (<any>ts).SyntaxKind[node.kind] + "-" + childName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static serializeSourceFile(file: ts.SourceFile): string {
|
||||
function getKindName(k: number): string {
|
||||
return (<any>ts).SyntaxKind[k]
|
||||
}
|
||||
|
||||
function getFlagName(flags: any, f: number): any {
|
||||
if (f === 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
var result = "";
|
||||
ts.forEach(Object.getOwnPropertyNames(flags), (v: any) => {
|
||||
if (isFinite(v)) {
|
||||
v = +v;
|
||||
if (f === +v) {
|
||||
result = flags[v];
|
||||
return true;
|
||||
}
|
||||
else if ((f & v) > 0) {
|
||||
if (result.length)
|
||||
result += " | ";
|
||||
result += flags[v];
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
function getNodeFlagName(f: number) { return getFlagName((<any>ts).NodeFlags, f); }
|
||||
function getParserContextFlagName(f: number) { return getFlagName((<any>ts).ParserContextFlags, f); }
|
||||
function convertDiagnostics(diagnostics: ts.Diagnostic[]) {
|
||||
return diagnostics.map(convertDiagnostic);
|
||||
}
|
||||
|
||||
function convertDiagnostic(diagnostic: ts.Diagnostic): any {
|
||||
return {
|
||||
start: diagnostic.start,
|
||||
length: diagnostic.length,
|
||||
messageText: diagnostic.messageText,
|
||||
category: (<any>ts).DiagnosticCategory[diagnostic.category],
|
||||
code: diagnostic.code
|
||||
};
|
||||
}
|
||||
|
||||
function serializeNode(n: ts.Node): any {
|
||||
var o: any = { kind: getKindName(n.kind) };
|
||||
|
||||
ts.forEach(Object.getOwnPropertyNames(n), propertyName => {
|
||||
switch (propertyName) {
|
||||
case "parent":
|
||||
case "symbol":
|
||||
case "locals":
|
||||
case "localSymbol":
|
||||
case "kind":
|
||||
case "semanticDiagnostics":
|
||||
case "id":
|
||||
case "nodeCount":
|
||||
case "symbolCount":
|
||||
case "identifierCount":
|
||||
// Blacklist of items we never put in the baseline file.
|
||||
break;
|
||||
|
||||
case "flags":
|
||||
// Print out flags with their enum names.
|
||||
o[propertyName] = getNodeFlagName(n.flags);
|
||||
break;
|
||||
|
||||
case "parserContextFlags":
|
||||
o[propertyName] = getParserContextFlagName(n.parserContextFlags);
|
||||
break;
|
||||
|
||||
case "referenceDiagnostics":
|
||||
case "parseDiagnostics":
|
||||
case "grammarDiagnostics":
|
||||
o[propertyName] = convertDiagnostics((<any>n)[propertyName]);
|
||||
break;
|
||||
|
||||
case "nextContainer":
|
||||
if (n.nextContainer) {
|
||||
o[propertyName] = { kind: n.nextContainer.kind, pos: n.nextContainer.pos, end: n.nextContainer.end };
|
||||
}
|
||||
break;
|
||||
|
||||
case "text":
|
||||
// Include 'text' field for identifiers/literals, but not for source files.
|
||||
if (n.kind !== ts.SyntaxKind.SourceFile) {
|
||||
o[propertyName] = (<any>n)[propertyName];
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
o[propertyName] = (<any>n)[propertyName];
|
||||
}
|
||||
|
||||
return undefined;
|
||||
});
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
return JSON.stringify(file, (k, v) => {
|
||||
return Test262BaselineRunner.isNodeOrArray(v) ? serializeNode(v) : v;
|
||||
}, " ");
|
||||
}
|
||||
|
||||
private static isNodeOrArray(a: any): boolean {
|
||||
return a !== undefined && typeof a.pos === "number";
|
||||
}
|
||||
|
||||
private runTest(filePath: string) {
|
||||
describe('test262 test for ' + filePath, () => {
|
||||
// Mocha holds onto the closure environment of the describe callback even after the test is done.
|
||||
@@ -264,13 +79,13 @@ class Test262BaselineRunner extends RunnerBase {
|
||||
|
||||
it('satisfies invariants', () => {
|
||||
var sourceFile = testState.checker.getProgram().getSourceFile(Test262BaselineRunner.getTestFilePath(testState.filename));
|
||||
Test262BaselineRunner.checkInvariants(sourceFile, /*parent:*/ undefined);
|
||||
Utils.assertInvariants(sourceFile, /*parent:*/ undefined);
|
||||
});
|
||||
|
||||
it('has the expected AST',() => {
|
||||
Harness.Baseline.runBaseline('has the expected AST', testState.filename + '.AST.txt',() => {
|
||||
var sourceFile = testState.checker.getProgram().getSourceFile(Test262BaselineRunner.getTestFilePath(testState.filename));
|
||||
return Test262BaselineRunner.serializeSourceFile(sourceFile);
|
||||
return Utils.sourceFileToJSON(sourceFile);
|
||||
}, false, Test262BaselineRunner.baselineOptions);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,152 +0,0 @@
|
||||
// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0.
|
||||
// See LICENSE.txt in the project root for complete license information.
|
||||
|
||||
///<reference path='references.ts' />
|
||||
|
||||
module TypeScript.Services {
|
||||
export class FindReferenceHelpers {
|
||||
public static compareSymbolsForLexicalIdentity(firstSymbol: TypeScript.PullSymbol, secondSymbol: TypeScript.PullSymbol): boolean {
|
||||
// Unwrap modules so that we're always referring to the variable.
|
||||
if (!firstSymbol.isAlias() && firstSymbol.isContainer()) {
|
||||
var containerForFirstSymbol = (<TypeScript.PullContainerSymbol>firstSymbol);
|
||||
if (containerForFirstSymbol.getInstanceSymbol()) {
|
||||
firstSymbol = containerForFirstSymbol.getInstanceSymbol();
|
||||
}
|
||||
}
|
||||
|
||||
if (!secondSymbol.isAlias() && secondSymbol.isContainer()) {
|
||||
var containerForSecondSymbol = (<TypeScript.PullContainerSymbol>secondSymbol);
|
||||
if (containerForSecondSymbol.getInstanceSymbol()) {
|
||||
secondSymbol = containerForSecondSymbol.getInstanceSymbol();
|
||||
}
|
||||
}
|
||||
|
||||
if (firstSymbol.kind === secondSymbol.kind) {
|
||||
if (firstSymbol === secondSymbol) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// If we have two variables and they have the same name and the same parent, then
|
||||
// they are the same symbol.
|
||||
if (firstSymbol.kind === TypeScript.PullElementKind.Variable &&
|
||||
firstSymbol.name === secondSymbol.name &&
|
||||
firstSymbol.getDeclarations() && firstSymbol.getDeclarations().length >= 1 &&
|
||||
secondSymbol.getDeclarations() && secondSymbol.getDeclarations().length >= 1) {
|
||||
|
||||
var firstSymbolDecl = firstSymbol.getDeclarations()[0];
|
||||
var secondSymbolDecl = secondSymbol.getDeclarations()[0];
|
||||
|
||||
return firstSymbolDecl.getParentDecl() === secondSymbolDecl.getParentDecl();
|
||||
}
|
||||
|
||||
// If we have two properties that belong to an object literal, then we need ot see
|
||||
// if they came from teh same object literal ast.
|
||||
if (firstSymbol.kind === TypeScript.PullElementKind.Property &&
|
||||
firstSymbol.name === secondSymbol.name &&
|
||||
firstSymbol.getDeclarations() && firstSymbol.getDeclarations().length >= 1 &&
|
||||
secondSymbol.getDeclarations() && secondSymbol.getDeclarations().length >= 1) {
|
||||
|
||||
var firstSymbolDecl = firstSymbol.getDeclarations()[0];
|
||||
var secondSymbolDecl = secondSymbol.getDeclarations()[0];
|
||||
|
||||
var firstParentDecl = firstSymbolDecl.getParentDecl();
|
||||
var secondParentDecl = secondSymbolDecl.getParentDecl();
|
||||
|
||||
if (firstParentDecl.kind === TypeScript.PullElementKind.ObjectLiteral &&
|
||||
secondParentDecl.kind === TypeScript.PullElementKind.ObjectLiteral) {
|
||||
|
||||
return firstParentDecl.ast() === secondParentDecl.ast();
|
||||
}
|
||||
}
|
||||
|
||||
// check if we are dealing with the implementation of interface method or a method override
|
||||
if (firstSymbol.name === secondSymbol.name) {
|
||||
// at this point firstSymbol.kind === secondSymbol.kind so we can pick any of those
|
||||
switch (firstSymbol.kind) {
|
||||
case PullElementKind.Property:
|
||||
case PullElementKind.Method:
|
||||
case PullElementKind.GetAccessor:
|
||||
case PullElementKind.SetAccessor:
|
||||
// these kinds can only be defined in types
|
||||
var t1 = <PullTypeSymbol>firstSymbol.getContainer();
|
||||
var t2 = <PullTypeSymbol>secondSymbol.getContainer();
|
||||
t1._resolveDeclaredSymbol();
|
||||
t2._resolveDeclaredSymbol();
|
||||
|
||||
return t1.hasBase(t2) || t2.hasBase(t1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
switch (firstSymbol.kind) {
|
||||
case TypeScript.PullElementKind.Class: {
|
||||
return this.checkSymbolsForDeclarationEquality(firstSymbol, secondSymbol);
|
||||
}
|
||||
case TypeScript.PullElementKind.Property: {
|
||||
if (firstSymbol.isAccessor()) {
|
||||
var getterSymbol = (<TypeScript.PullAccessorSymbol>firstSymbol).getGetter();
|
||||
var setterSymbol = (<TypeScript.PullAccessorSymbol>firstSymbol).getSetter();
|
||||
|
||||
if (getterSymbol && getterSymbol === secondSymbol) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (setterSymbol && setterSymbol === secondSymbol) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
case TypeScript.PullElementKind.Function: {
|
||||
if (secondSymbol.isAccessor()) {
|
||||
var getterSymbol = (<TypeScript.PullAccessorSymbol>secondSymbol).getGetter();
|
||||
var setterSymbol = (<TypeScript.PullAccessorSymbol>secondSymbol).getSetter();
|
||||
|
||||
if (getterSymbol && getterSymbol === firstSymbol) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (setterSymbol && setterSymbol === firstSymbol) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
case TypeScript.PullElementKind.ConstructorMethod: {
|
||||
return this.checkSymbolsForDeclarationEquality(firstSymbol, secondSymbol);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return firstSymbol === secondSymbol;
|
||||
}
|
||||
|
||||
private static checkSymbolsForDeclarationEquality(firstSymbol: TypeScript.PullSymbol, secondSymbol: TypeScript.PullSymbol): boolean {
|
||||
var firstSymbolDeclarations: TypeScript.PullDecl[] = firstSymbol.getDeclarations();
|
||||
var secondSymbolDeclarations: TypeScript.PullDecl[] = secondSymbol.getDeclarations();
|
||||
for (var i = 0, iLen = firstSymbolDeclarations.length; i < iLen; i++) {
|
||||
for (var j = 0, jLen = secondSymbolDeclarations.length; j < jLen; j++) {
|
||||
if (this.declarationsAreSameOrParents(firstSymbolDeclarations[i], secondSymbolDeclarations[j])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static declarationsAreSameOrParents(firstDecl: TypeScript.PullDecl, secondDecl: TypeScript.PullDecl): boolean {
|
||||
var firstParent: TypeScript.PullDecl = firstDecl.getParentDecl();
|
||||
var secondParent: TypeScript.PullDecl = secondDecl.getParentDecl();
|
||||
if (firstDecl === secondDecl ||
|
||||
firstDecl === secondParent ||
|
||||
firstParent === secondDecl ||
|
||||
firstParent === secondParent) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
///<reference path='services.ts' />
|
||||
///<reference path='formatting\indentation.ts' />
|
||||
///<reference path='formatting\formattingScanner.ts' />
|
||||
///<reference path='formatting\rulesProvider.ts' />
|
||||
///<reference path='..\services.ts' />
|
||||
///<reference path='formattingScanner.ts' />
|
||||
///<reference path='rulesProvider.ts' />
|
||||
///<reference path='references.ts' />
|
||||
|
||||
module ts.formatting {
|
||||
|
||||
@@ -622,14 +622,21 @@ module ts.formatting {
|
||||
|
||||
var tokenStart = sourceFile.getLineAndCharacterFromPosition(currentTokenInfo.token.pos);
|
||||
if (isTokenInRange) {
|
||||
var rangeHasError = rangeContainsError(currentTokenInfo.token);
|
||||
// save prevStartLine since processRange will overwrite this value with current ones
|
||||
var prevStartLine = previousRangeStartLine;
|
||||
lineAdded = processRange(currentTokenInfo.token, tokenStart, parent, childContextNode, dynamicIndentation);
|
||||
if (lineAdded !== undefined) {
|
||||
indentToken = lineAdded;
|
||||
if (rangeHasError) {
|
||||
// do not indent comments\token if token range overlaps with some error
|
||||
indentToken = false;
|
||||
}
|
||||
else {
|
||||
indentToken = lastTriviaWasNewLine && tokenStart.line !== prevStartLine;
|
||||
if (lineAdded !== undefined) {
|
||||
indentToken = lineAdded;
|
||||
}
|
||||
else {
|
||||
indentToken = lastTriviaWasNewLine && tokenStart.line !== prevStartLine;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -984,4 +991,56 @@ module ts.formatting {
|
||||
|
||||
return SyntaxKind.Unknown;
|
||||
}
|
||||
|
||||
var internedTabsIndentation: string[];
|
||||
var internedSpacesIndentation: string[];
|
||||
|
||||
export function getIndentationString(indentation: number, options: FormatCodeOptions): string {
|
||||
if (!options.ConvertTabsToSpaces) {
|
||||
var tabs = Math.floor(indentation / options.TabSize);
|
||||
var spaces = indentation - tabs * options.TabSize;
|
||||
|
||||
var tabString: string;
|
||||
if (!internedTabsIndentation) {
|
||||
internedTabsIndentation = [];
|
||||
}
|
||||
|
||||
if (internedTabsIndentation[tabs] === undefined) {
|
||||
internedTabsIndentation[tabs] = tabString = repeat('\t', tabs);
|
||||
}
|
||||
else {
|
||||
tabString = internedTabsIndentation[tabs];
|
||||
}
|
||||
|
||||
return spaces ? tabString + repeat(" ", spaces) : tabString;
|
||||
}
|
||||
else {
|
||||
var spacesString: string;
|
||||
var quotient = Math.floor(indentation / options.IndentSize);
|
||||
var remainder = indentation % options.IndentSize;
|
||||
if (!internedSpacesIndentation) {
|
||||
internedSpacesIndentation = [];
|
||||
}
|
||||
|
||||
if (internedSpacesIndentation[quotient] === undefined) {
|
||||
spacesString = repeat(" ", options.IndentSize * quotient);
|
||||
internedSpacesIndentation[quotient] = spacesString;
|
||||
}
|
||||
else {
|
||||
spacesString = internedSpacesIndentation[quotient];
|
||||
}
|
||||
|
||||
|
||||
return remainder ? spacesString + repeat(" ", remainder) : spacesString;
|
||||
}
|
||||
|
||||
function repeat(value: string, count: number): string {
|
||||
var s = "";
|
||||
for (var i = 0; i < count; ++i) {
|
||||
s += value;
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
/// <reference path="..\formatting.ts"/>
|
||||
/// <reference path="formatting.ts"/>
|
||||
/// <reference path="..\..\compiler\scanner.ts"/>
|
||||
|
||||
module ts.formatting {
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
///<reference path='..\text.ts' />
|
||||
///<reference path='..\services.ts' />
|
||||
///<reference path='formattingContext.ts' />
|
||||
///<reference path='formattingRequestKind.ts' />
|
||||
@@ -25,5 +24,4 @@
|
||||
///<reference path='ruleOperationContext.ts' />
|
||||
///<reference path='rules.ts' />
|
||||
///<reference path='rulesMap.ts' />
|
||||
///<reference path='tokenRange.ts' />
|
||||
///<reference path='tokenSpan.ts' />
|
||||
///<reference path='tokenRange.ts' />
|
||||
@@ -1,4 +1,4 @@
|
||||
///<reference path='services.ts' />
|
||||
///<reference path='..\services.ts' />
|
||||
|
||||
module ts.formatting {
|
||||
export module SmartIndenter {
|
||||
@@ -342,6 +342,7 @@ module ts.formatting {
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
case SyntaxKind.ExportAssignment:
|
||||
case SyntaxKind.ReturnStatement:
|
||||
case SyntaxKind.ConditionalExpression:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -1,24 +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 ts.formatting {
|
||||
export class TokenSpan extends TextSpan {
|
||||
constructor(public kind: SyntaxKind, start: number, length: number) {
|
||||
super(start, length);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,22 +14,6 @@
|
||||
//
|
||||
|
||||
module ts {
|
||||
|
||||
export interface OutliningSpan {
|
||||
/**
|
||||
* @param textSpan The span of the document to actually collapse.
|
||||
* @param hintSpan The span of the document to display when the user hovers over the
|
||||
* collapsed span.
|
||||
* @param bannerText The text to display in the editor for the collapsed region.
|
||||
* @param autoCollapse Whether or not this region should be automatically collapsed when
|
||||
* the 'Collapse to Definitions' command is invoked.
|
||||
*/
|
||||
textSpan: TextSpan;
|
||||
hintSpan: TextSpan;
|
||||
bannerText: string;
|
||||
autoCollapse: boolean;
|
||||
}
|
||||
|
||||
export module OutliningElementsCollector {
|
||||
export function collectElements(sourceFile: SourceFile): OutliningSpan[] {
|
||||
var elements: OutliningSpan[] = [];
|
||||
|
||||
+345
-212
@@ -4,16 +4,18 @@
|
||||
/// <reference path="..\compiler\parser.ts"/>
|
||||
/// <reference path="..\compiler\checker.ts"/>
|
||||
|
||||
/// <reference path='text.ts' />
|
||||
/// <reference path='breakpoints.ts' />
|
||||
/// <reference path='outliningElementsCollector.ts' />
|
||||
/// <reference path='navigationBar.ts' />
|
||||
/// <reference path='breakpoints.ts' />
|
||||
/// <reference path='signatureHelp.ts' />
|
||||
/// <reference path='utilities.ts' />
|
||||
/// <reference path='smartIndenter.ts' />
|
||||
/// <reference path='formatting.ts' />
|
||||
/// <reference path='formatting\formatting.ts' />
|
||||
/// <reference path='formatting\smartIndenter.ts' />
|
||||
|
||||
module ts {
|
||||
|
||||
export var servicesVersion = "0.4"
|
||||
|
||||
export interface Node {
|
||||
getSourceFile(): SourceFile;
|
||||
getChildCount(sourceFile?: SourceFile): number;
|
||||
@@ -59,6 +61,9 @@ module ts {
|
||||
}
|
||||
|
||||
export interface SourceFile {
|
||||
isOpen: boolean;
|
||||
version: string;
|
||||
|
||||
getScriptSnapshot(): IScriptSnapshot;
|
||||
getNamedDeclarations(): Declaration[];
|
||||
update(scriptSnapshot: IScriptSnapshot, version: string, isOpen: boolean, textChangeRange: TextChangeRange): SourceFile;
|
||||
@@ -862,11 +867,13 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
return SourceFileObject.createSourceFileObject(this.filename, scriptSnapshot, this.languageVersion, version, isOpen);
|
||||
return createLanguageServiceSourceFile(this.filename, scriptSnapshot, this.languageVersion, version, isOpen, /*setNodeParents:*/ true);
|
||||
}
|
||||
|
||||
public static createSourceFileObject(filename: string, scriptSnapshot: IScriptSnapshot, languageVersion: ScriptTarget, version: string, isOpen: boolean) {
|
||||
var newSourceFile = <SourceFileObject><any>createSourceFile(filename, scriptSnapshot.getText(0, scriptSnapshot.getLength()), languageVersion, version, isOpen);
|
||||
public static createSourceFileObject(filename: string, scriptSnapshot: IScriptSnapshot, languageVersion: ScriptTarget, version: string, isOpen: boolean, setParentNodes: boolean) {
|
||||
var newSourceFile = <SourceFileObject><any>createSourceFile(filename, scriptSnapshot.getText(0, scriptSnapshot.getLength()), languageVersion, setParentNodes);
|
||||
newSourceFile.version = version;
|
||||
newSourceFile.isOpen = isOpen;
|
||||
newSourceFile.scriptSnapshot = scriptSnapshot;
|
||||
return newSourceFile;
|
||||
}
|
||||
@@ -874,6 +881,8 @@ module ts {
|
||||
|
||||
export interface Logger {
|
||||
log(s: string): void;
|
||||
trace(s: string): void;
|
||||
error(s: string): void;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -885,8 +894,8 @@ module ts {
|
||||
getScriptVersion(fileName: string): string;
|
||||
getScriptIsOpen(fileName: string): boolean;
|
||||
getScriptSnapshot(fileName: string): IScriptSnapshot;
|
||||
getLocalizedDiagnosticMessages(): any;
|
||||
getCancellationToken(): CancellationToken;
|
||||
getLocalizedDiagnosticMessages?(): any;
|
||||
getCancellationToken?(): CancellationToken;
|
||||
getCurrentDirectory(): string;
|
||||
getDefaultLibFilename(options: CompilerOptions): string;
|
||||
}
|
||||
@@ -905,7 +914,7 @@ module ts {
|
||||
getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[];
|
||||
getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[];
|
||||
|
||||
getCompletionsAtPosition(fileName: string, position: number, isMemberCompletion: boolean): CompletionInfo;
|
||||
getCompletionsAtPosition(fileName: string, position: number): CompletionInfo;
|
||||
getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails;
|
||||
|
||||
getQuickInfoAtPosition(fileName: string, position: number): QuickInfo;
|
||||
@@ -942,6 +951,301 @@ module ts {
|
||||
dispose(): void;
|
||||
}
|
||||
|
||||
export class TextSpan {
|
||||
private _start: number;
|
||||
private _length: number;
|
||||
|
||||
/**
|
||||
* Creates a TextSpan instance beginning with the position Start and having the Length
|
||||
* specified with length.
|
||||
*/
|
||||
constructor(start: number, length: number) {
|
||||
Debug.assert(start >= 0, "start");
|
||||
Debug.assert(length >= 0, "length");
|
||||
|
||||
this._start = start;
|
||||
this._length = length;
|
||||
}
|
||||
|
||||
public toJSON(key: any): any {
|
||||
return { start: this._start, length: this._length };
|
||||
}
|
||||
|
||||
public start(): number {
|
||||
return this._start;
|
||||
}
|
||||
|
||||
public length(): number {
|
||||
return this._length;
|
||||
}
|
||||
|
||||
public end(): number {
|
||||
return this._start + this._length;
|
||||
}
|
||||
|
||||
public isEmpty(): boolean {
|
||||
return this._length === 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether the position lies within the span. Returns true if the position is greater than or equal to Start and strictly less
|
||||
* than End, otherwise false.
|
||||
* @param position The position to check.
|
||||
*/
|
||||
public containsPosition(position: number): boolean {
|
||||
return position >= this._start && position < this.end();
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether span falls completely within this span. Returns true if the specified span falls completely within this span, otherwise false.
|
||||
* @param span The span to check.
|
||||
*/
|
||||
public containsTextSpan(span: TextSpan): boolean {
|
||||
return span._start >= this._start && span.end() <= this.end();
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether the given span overlaps this span. Two spans are considered to overlap
|
||||
* if they have positions in common and neither is empty. Empty spans do not overlap with any
|
||||
* other span. Returns true if the spans overlap, false otherwise.
|
||||
* @param span The span to check.
|
||||
*/
|
||||
public overlapsWith(span: TextSpan): boolean {
|
||||
var overlapStart = Math.max(this._start, span._start);
|
||||
var overlapEnd = Math.min(this.end(), span.end());
|
||||
|
||||
return overlapStart < overlapEnd;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the overlap with the given span, or undefined if there is no overlap.
|
||||
* @param span The span to check.
|
||||
*/
|
||||
public overlap(span: TextSpan): TextSpan {
|
||||
var overlapStart = Math.max(this._start, span._start);
|
||||
var overlapEnd = Math.min(this.end(), span.end());
|
||||
|
||||
if (overlapStart < overlapEnd) {
|
||||
return TextSpan.fromBounds(overlapStart, overlapEnd);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether span intersects this span. Two spans are considered to
|
||||
* intersect if they have positions in common or the end of one span
|
||||
* coincides with the start of the other span. Returns true if the spans intersect, false otherwise.
|
||||
* @param The span to check.
|
||||
*/
|
||||
public intersectsWithTextSpan(span: TextSpan): boolean {
|
||||
return span._start <= this.end() && span.end() >= this._start;
|
||||
}
|
||||
|
||||
public intersectsWith(start: number, length: number): boolean {
|
||||
var end = start + length;
|
||||
return start <= this.end() && end >= this._start;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether the given position intersects this span.
|
||||
* A position is considered to intersect if it is between the start and
|
||||
* end positions (inclusive) of this span. Returns true if the position intersects, false otherwise.
|
||||
* @param position The position to check.
|
||||
*/
|
||||
public intersectsWithPosition(position: number): boolean {
|
||||
return position <= this.end() && position >= this._start;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the intersection with the given span, or undefined if there is no intersection.
|
||||
* @param span The span to check.
|
||||
*/
|
||||
public intersection(span: TextSpan): TextSpan {
|
||||
var intersectStart = Math.max(this._start, span._start);
|
||||
var intersectEnd = Math.min(this.end(), span.end());
|
||||
|
||||
if (intersectStart <= intersectEnd) {
|
||||
return TextSpan.fromBounds(intersectStart, intersectEnd);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new TextSpan from the given start and end positions
|
||||
* as opposed to a position and length.
|
||||
*/
|
||||
public static fromBounds(start: number, end: number): TextSpan {
|
||||
Debug.assert(start >= 0);
|
||||
Debug.assert(end - start >= 0);
|
||||
return new TextSpan(start, end - start);
|
||||
}
|
||||
}
|
||||
|
||||
export class TextChangeRange {
|
||||
public static unchanged = new TextChangeRange(new TextSpan(0, 0), 0);
|
||||
|
||||
private _span: TextSpan;
|
||||
private _newLength: number;
|
||||
|
||||
/**
|
||||
* Initializes a new instance of TextChangeRange.
|
||||
*/
|
||||
constructor(span: TextSpan, newLength: number) {
|
||||
Debug.assert(newLength >= 0, "newLength");
|
||||
|
||||
this._span = span;
|
||||
this._newLength = newLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* The span of text before the edit which is being changed
|
||||
*/
|
||||
public span(): TextSpan {
|
||||
return this._span;
|
||||
}
|
||||
|
||||
/**
|
||||
* Width of the span after the edit. A 0 here would represent a delete
|
||||
*/
|
||||
public newLength(): number {
|
||||
return this._newLength;
|
||||
}
|
||||
|
||||
public newSpan(): TextSpan {
|
||||
return new TextSpan(this.span().start(), this.newLength());
|
||||
}
|
||||
|
||||
public isUnchanged(): boolean {
|
||||
return this.span().isEmpty() && this.newLength() === 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to merge all the changes that occurred across several versions of a script snapshot
|
||||
* into a single change. i.e. if a user keeps making successive edits to a script we will
|
||||
* have a text change from V1 to V2, V2 to V3, ..., Vn.
|
||||
*
|
||||
* This function will then merge those changes into a single change range valid between V1 and
|
||||
* Vn.
|
||||
*/
|
||||
public static collapseChangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange {
|
||||
if (changes.length === 0) {
|
||||
return TextChangeRange.unchanged;
|
||||
}
|
||||
|
||||
if (changes.length === 1) {
|
||||
return changes[0];
|
||||
}
|
||||
|
||||
// We change from talking about { { oldStart, oldLength }, newLength } to { oldStart, oldEnd, newEnd }
|
||||
// as it makes things much easier to reason about.
|
||||
var change0 = changes[0];
|
||||
|
||||
var oldStartN = change0.span().start();
|
||||
var oldEndN = change0.span().end();
|
||||
var newEndN = oldStartN + change0.newLength();
|
||||
|
||||
for (var i = 1; i < changes.length; i++) {
|
||||
var nextChange = changes[i];
|
||||
|
||||
// Consider the following case:
|
||||
// i.e. two edits. The first represents the text change range { { 10, 50 }, 30 }. i.e. The span starting
|
||||
// at 10, with length 50 is reduced to length 30. The second represents the text change range { { 30, 30 }, 40 }.
|
||||
// i.e. the span starting at 30 with length 30 is increased to length 40.
|
||||
//
|
||||
// 0 10 20 30 40 50 60 70 80 90 100
|
||||
// -------------------------------------------------------------------------------------------------------
|
||||
// | /
|
||||
// | /----
|
||||
// T1 | /----
|
||||
// | /----
|
||||
// | /----
|
||||
// -------------------------------------------------------------------------------------------------------
|
||||
// | \
|
||||
// | \
|
||||
// T2 | \
|
||||
// | \
|
||||
// | \
|
||||
// -------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Merging these turns out to not be too difficult. First, determining the new start of the change is trivial
|
||||
// it's just the min of the old and new starts. i.e.:
|
||||
//
|
||||
// 0 10 20 30 40 50 60 70 80 90 100
|
||||
// ------------------------------------------------------------*------------------------------------------
|
||||
// | /
|
||||
// | /----
|
||||
// T1 | /----
|
||||
// | /----
|
||||
// | /----
|
||||
// ----------------------------------------$-------------------$------------------------------------------
|
||||
// . | \
|
||||
// . | \
|
||||
// T2 . | \
|
||||
// . | \
|
||||
// . | \
|
||||
// ----------------------------------------------------------------------*--------------------------------
|
||||
//
|
||||
// (Note the dots represent the newly inferrred start.
|
||||
// Determining the new and old end is also pretty simple. Basically it boils down to paying attention to the
|
||||
// absolute positions at the asterixes, and the relative change between the dollar signs. Basically, we see
|
||||
// which if the two $'s precedes the other, and we move that one forward until they line up. in this case that
|
||||
// means:
|
||||
//
|
||||
// 0 10 20 30 40 50 60 70 80 90 100
|
||||
// --------------------------------------------------------------------------------*----------------------
|
||||
// | /
|
||||
// | /----
|
||||
// T1 | /----
|
||||
// | /----
|
||||
// | /----
|
||||
// ------------------------------------------------------------$------------------------------------------
|
||||
// . | \
|
||||
// . | \
|
||||
// T2 . | \
|
||||
// . | \
|
||||
// . | \
|
||||
// ----------------------------------------------------------------------*--------------------------------
|
||||
//
|
||||
// In other words (in this case), we're recognizing that the second edit happened after where the first edit
|
||||
// ended with a delta of 20 characters (60 - 40). Thus, if we go back in time to where the first edit started
|
||||
// that's the same as if we started at char 80 instead of 60.
|
||||
//
|
||||
// As it so happens, the same logic applies if the second edit precedes the first edit. In that case rahter
|
||||
// than pusing the first edit forward to match the second, we'll push the second edit forward to match the
|
||||
// first.
|
||||
//
|
||||
// In this case that means we have { oldStart: 10, oldEnd: 80, newEnd: 70 } or, in TextChangeRange
|
||||
// semantics: { { start: 10, length: 70 }, newLength: 60 }
|
||||
//
|
||||
// The math then works out as follows.
|
||||
// If we have { oldStart1, oldEnd1, newEnd1 } and { oldStart2, oldEnd2, newEnd2 } then we can compute the
|
||||
// final result like so:
|
||||
//
|
||||
// {
|
||||
// oldStart3: Min(oldStart1, oldStart2),
|
||||
// oldEnd3 : Max(oldEnd1, oldEnd1 + (oldEnd2 - newEnd1)),
|
||||
// newEnd3 : Max(newEnd2, newEnd2 + (newEnd1 - oldEnd2))
|
||||
// }
|
||||
|
||||
var oldStart1 = oldStartN;
|
||||
var oldEnd1 = oldEndN;
|
||||
var newEnd1 = newEndN;
|
||||
|
||||
var oldStart2 = nextChange.span().start();
|
||||
var oldEnd2 = nextChange.span().end();
|
||||
var newEnd2 = oldStart2 + nextChange.newLength();
|
||||
|
||||
oldStartN = Math.min(oldStart1, oldStart2);
|
||||
oldEndN = Math.max(oldEnd1, oldEnd1 + (oldEnd2 - newEnd1));
|
||||
newEndN = Math.max(newEnd2, newEnd2 + (newEnd1 - oldEnd2));
|
||||
}
|
||||
|
||||
return new TextChangeRange(TextSpan.fromBounds(oldStartN, oldEndN), /*newLength: */newEndN - oldStartN);
|
||||
}
|
||||
}
|
||||
|
||||
export interface ClassifiedSpan {
|
||||
textSpan: TextSpan;
|
||||
classificationType: string; // ClassificationTypeNames
|
||||
@@ -1124,6 +1428,23 @@ module ts {
|
||||
documentation: SymbolDisplayPart[];
|
||||
}
|
||||
|
||||
export interface OutliningSpan {
|
||||
/** The span of the document to actually collapse. */
|
||||
textSpan: TextSpan;
|
||||
|
||||
/** The span of the document to display when the user hovers over the collapsed span. */
|
||||
hintSpan: TextSpan;
|
||||
|
||||
/** The text to display in the editor for the collapsed region. */
|
||||
bannerText: string;
|
||||
|
||||
/**
|
||||
* Whether or not this region should be automatically collapsed when
|
||||
* the 'Collapse to Definitions' command is invoked.
|
||||
*/
|
||||
autoCollapse: boolean;
|
||||
}
|
||||
|
||||
export interface EmitOutput {
|
||||
outputFiles: OutputFile[];
|
||||
emitOutputStatus: EmitReturnStatus;
|
||||
@@ -1341,6 +1662,10 @@ module ts {
|
||||
owners: string[];
|
||||
}
|
||||
|
||||
export interface DisplayPartsSymbolWriter extends SymbolWriter {
|
||||
displayParts(): SymbolDisplayPart[];
|
||||
}
|
||||
|
||||
export function displayPartsToString(displayParts: SymbolDisplayPart[]) {
|
||||
if (displayParts) {
|
||||
return map(displayParts, displayPart => displayPart.text).join("");
|
||||
@@ -1349,100 +1674,6 @@ module ts {
|
||||
return "";
|
||||
}
|
||||
|
||||
export interface DisplayPartsSymbolWriter extends SymbolWriter {
|
||||
displayParts(): SymbolDisplayPart[];
|
||||
}
|
||||
|
||||
var displayPartWriter = getDisplayPartWriter();
|
||||
function getDisplayPartWriter(): DisplayPartsSymbolWriter {
|
||||
var displayParts: SymbolDisplayPart[];
|
||||
var lineStart: boolean;
|
||||
var indent: number;
|
||||
|
||||
resetWriter();
|
||||
return {
|
||||
displayParts: () => displayParts,
|
||||
writeKeyword: text => writeKind(text, SymbolDisplayPartKind.keyword),
|
||||
writeOperator: text => writeKind(text, SymbolDisplayPartKind.operator),
|
||||
writePunctuation: text => writeKind(text, SymbolDisplayPartKind.punctuation),
|
||||
writeSpace: text => writeKind(text, SymbolDisplayPartKind.space),
|
||||
writeStringLiteral: text => writeKind(text, SymbolDisplayPartKind.stringLiteral),
|
||||
writeParameter: text => writeKind(text, SymbolDisplayPartKind.parameterName),
|
||||
writeSymbol,
|
||||
writeLine,
|
||||
increaseIndent: () => { indent++; },
|
||||
decreaseIndent: () => { indent--; },
|
||||
clear: resetWriter,
|
||||
trackSymbol: () => { }
|
||||
};
|
||||
|
||||
function writeIndent() {
|
||||
if (lineStart) {
|
||||
var indentString = getIndentString(indent);
|
||||
if (indentString) {
|
||||
displayParts.push(displayPart(indentString, SymbolDisplayPartKind.space));
|
||||
}
|
||||
lineStart = false;
|
||||
}
|
||||
}
|
||||
|
||||
function writeKind(text: string, kind: SymbolDisplayPartKind) {
|
||||
writeIndent();
|
||||
displayParts.push(displayPart(text, kind));
|
||||
}
|
||||
|
||||
function writeSymbol(text: string, symbol: Symbol) {
|
||||
writeIndent();
|
||||
displayParts.push(symbolPart(text, symbol));
|
||||
}
|
||||
|
||||
function writeLine() {
|
||||
displayParts.push(lineBreakPart());
|
||||
lineStart = true;
|
||||
}
|
||||
|
||||
function resetWriter() {
|
||||
displayParts = []
|
||||
lineStart = true;
|
||||
indent = 0;
|
||||
}
|
||||
}
|
||||
|
||||
function displayPart(text: string, kind: SymbolDisplayPartKind, symbol?: Symbol): SymbolDisplayPart {
|
||||
return <SymbolDisplayPart> {
|
||||
text: text,
|
||||
kind: SymbolDisplayPartKind[kind]
|
||||
};
|
||||
}
|
||||
|
||||
export function spacePart() {
|
||||
return displayPart(" ", SymbolDisplayPartKind.space);
|
||||
}
|
||||
|
||||
export function keywordPart(kind: SyntaxKind) {
|
||||
return displayPart(tokenToString(kind), SymbolDisplayPartKind.keyword);
|
||||
}
|
||||
|
||||
export function punctuationPart(kind: SyntaxKind) {
|
||||
return displayPart(tokenToString(kind), SymbolDisplayPartKind.punctuation);
|
||||
}
|
||||
|
||||
export function operatorPart(kind: SyntaxKind) {
|
||||
return displayPart(tokenToString(kind), SymbolDisplayPartKind.operator);
|
||||
}
|
||||
|
||||
export function textPart(text: string) {
|
||||
return displayPart(text, SymbolDisplayPartKind.text);
|
||||
}
|
||||
|
||||
export function lineBreakPart() {
|
||||
return displayPart("\n", SymbolDisplayPartKind.lineBreak);
|
||||
}
|
||||
|
||||
function isFirstDeclarationOfSymbolParameter(symbol: Symbol) {
|
||||
return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === SyntaxKind.Parameter;
|
||||
}
|
||||
|
||||
function isLocalVariableOrFunction(symbol: Symbol) {
|
||||
if (symbol.parent) {
|
||||
return false; // This is exported symbol
|
||||
@@ -1471,59 +1702,6 @@ module ts {
|
||||
});
|
||||
}
|
||||
|
||||
export function symbolPart(text: string, symbol: Symbol) {
|
||||
return displayPart(text, displayPartKind(symbol), symbol);
|
||||
|
||||
function displayPartKind(symbol: Symbol): SymbolDisplayPartKind {
|
||||
var flags = symbol.flags;
|
||||
|
||||
if (flags & SymbolFlags.Variable) {
|
||||
return isFirstDeclarationOfSymbolParameter(symbol) ? SymbolDisplayPartKind.parameterName : SymbolDisplayPartKind.localName;
|
||||
}
|
||||
else if (flags & SymbolFlags.Property) { return SymbolDisplayPartKind.propertyName; }
|
||||
else if (flags & SymbolFlags.GetAccessor) { return SymbolDisplayPartKind.propertyName; }
|
||||
else if (flags & SymbolFlags.SetAccessor) { return SymbolDisplayPartKind.propertyName; }
|
||||
else if (flags & SymbolFlags.EnumMember) { return SymbolDisplayPartKind.enumMemberName; }
|
||||
else if (flags & SymbolFlags.Function) { return SymbolDisplayPartKind.functionName; }
|
||||
else if (flags & SymbolFlags.Class) { return SymbolDisplayPartKind.className; }
|
||||
else if (flags & SymbolFlags.Interface) { return SymbolDisplayPartKind.interfaceName; }
|
||||
else if (flags & SymbolFlags.Enum) { return SymbolDisplayPartKind.enumName; }
|
||||
else if (flags & SymbolFlags.Module) { return SymbolDisplayPartKind.moduleName; }
|
||||
else if (flags & SymbolFlags.Method) { return SymbolDisplayPartKind.methodName; }
|
||||
else if (flags & SymbolFlags.TypeParameter) { return SymbolDisplayPartKind.typeParameterName; }
|
||||
else if (flags & SymbolFlags.TypeAlias) { return SymbolDisplayPartKind.aliasName; }
|
||||
else if (flags & SymbolFlags.Import) { return SymbolDisplayPartKind.aliasName; }
|
||||
|
||||
|
||||
return SymbolDisplayPartKind.text;
|
||||
}
|
||||
}
|
||||
|
||||
export function mapToDisplayParts(writeDisplayParts: (writer: DisplayPartsSymbolWriter) => void): SymbolDisplayPart[] {
|
||||
writeDisplayParts(displayPartWriter);
|
||||
var result = displayPartWriter.displayParts();
|
||||
displayPartWriter.clear();
|
||||
return result;
|
||||
}
|
||||
|
||||
export function typeToDisplayParts(typechecker: TypeChecker, type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): SymbolDisplayPart[] {
|
||||
return mapToDisplayParts(writer => {
|
||||
typechecker.getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags);
|
||||
});
|
||||
}
|
||||
|
||||
export function symbolToDisplayParts(typeChecker: TypeChecker, symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): SymbolDisplayPart[] {
|
||||
return mapToDisplayParts(writer => {
|
||||
typeChecker.getSymbolDisplayBuilder().buildSymbolDisplay(symbol, writer, enclosingDeclaration, meaning, flags);
|
||||
});
|
||||
}
|
||||
|
||||
function signatureToDisplayParts(typechecker: TypeChecker, signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags): SymbolDisplayPart[]{
|
||||
return mapToDisplayParts(writer => {
|
||||
typechecker.getSymbolDisplayBuilder().buildSignatureDisplay(signature, writer, enclosingDeclaration, flags);
|
||||
});
|
||||
}
|
||||
|
||||
export function getDefaultCompilerOptions(): CompilerOptions {
|
||||
// Set "ScriptTarget.Latest" target by default for language service
|
||||
return {
|
||||
@@ -1532,20 +1710,6 @@ module ts {
|
||||
};
|
||||
}
|
||||
|
||||
export function compareDataObjects(dst: any, src: any): boolean {
|
||||
for (var e in dst) {
|
||||
if (typeof dst[e] === "object") {
|
||||
if (!compareDataObjects(dst[e], src[e]))
|
||||
return false;
|
||||
}
|
||||
else if (typeof dst[e] !== "function") {
|
||||
if (dst[e] !== src[e])
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
export class OperationCanceledException { }
|
||||
|
||||
export class CancellationTokenObject {
|
||||
@@ -1674,11 +1838,10 @@ module ts {
|
||||
var scriptSnapshot = this.hostCache.getScriptSnapshot(filename);
|
||||
|
||||
var start = new Date().getTime();
|
||||
sourceFile = createSourceFileFromScriptSnapshot(filename, scriptSnapshot, getDefaultCompilerOptions(), version, /*isOpen*/ true);
|
||||
sourceFile = createLanguageServiceSourceFile(filename, scriptSnapshot, getDefaultCompilerOptions().target, version, /*isOpen*/ true, /*setNodeParents:*/ true);
|
||||
this.host.log("SyntaxTreeCache.Initialize: createSourceFile: " + (new Date().getTime() - start));
|
||||
|
||||
var start = new Date().getTime();
|
||||
fixupParentReferences(sourceFile);
|
||||
this.host.log("SyntaxTreeCache.Initialize: fixupParentRefs : " + (new Date().getTime() - start));
|
||||
}
|
||||
else if (this.currentFileVersion !== version) {
|
||||
@@ -1688,12 +1851,11 @@ module ts {
|
||||
|
||||
var start = new Date().getTime();
|
||||
sourceFile = !editRange
|
||||
? createSourceFileFromScriptSnapshot(filename, scriptSnapshot, getDefaultCompilerOptions(), version, /*isOpen*/ true)
|
||||
? createLanguageServiceSourceFile(filename, scriptSnapshot, getDefaultCompilerOptions().target, version, /*isOpen*/ true, /*setNodeParents:*/ true)
|
||||
: this.currentSourceFile.update(scriptSnapshot, version, /*isOpen*/ true, editRange);
|
||||
this.host.log("SyntaxTreeCache.Initialize: updateSourceFile: " + (new Date().getTime() - start));
|
||||
|
||||
var start = new Date().getTime();
|
||||
fixupParentReferences(sourceFile);
|
||||
this.host.log("SyntaxTreeCache.Initialize: fixupParentRefs : " + (new Date().getTime() - start));
|
||||
}
|
||||
|
||||
@@ -1703,22 +1865,6 @@ module ts {
|
||||
this.currentFilename = filename;
|
||||
this.currentSourceFile = sourceFile;
|
||||
}
|
||||
|
||||
function fixupParentReferences(sourceFile: SourceFile) {
|
||||
// normally parent references are set during binding.
|
||||
// however here SourceFile data is used only for syntactic features so running the whole binding process is an overhead.
|
||||
// walk over the nodes and set parent references
|
||||
var parent: Node = sourceFile;
|
||||
function walk(n: Node): void {
|
||||
n.parent = parent;
|
||||
|
||||
var saveParent = parent;
|
||||
parent = n;
|
||||
forEachChild(n, walk);
|
||||
parent = saveParent;
|
||||
}
|
||||
forEachChild(sourceFile, walk);
|
||||
}
|
||||
}
|
||||
|
||||
public getCurrentSourceFile(filename: string): SourceFile {
|
||||
@@ -1731,8 +1877,8 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function createSourceFileFromScriptSnapshot(filename: string, scriptSnapshot: IScriptSnapshot, settings: CompilerOptions, version: string, isOpen: boolean) {
|
||||
return SourceFileObject.createSourceFileObject(filename, scriptSnapshot, settings.target, version, isOpen);
|
||||
export function createLanguageServiceSourceFile(filename: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, isOpen: boolean, setNodeParents: boolean): SourceFile {
|
||||
return SourceFileObject.createSourceFileObject(filename, scriptSnapshot, scriptTarget, version, isOpen, setNodeParents);
|
||||
}
|
||||
|
||||
export function createDocumentRegistry(): DocumentRegistry {
|
||||
@@ -1782,7 +1928,7 @@ module ts {
|
||||
var bucket = getBucketForCompilationSettings(compilationSettings, /*createIfMissing*/ true);
|
||||
var entry = lookUp(bucket, filename);
|
||||
if (!entry) {
|
||||
var sourceFile = createSourceFileFromScriptSnapshot(filename, scriptSnapshot, compilationSettings, version, isOpen);
|
||||
var sourceFile = createLanguageServiceSourceFile(filename, scriptSnapshot, compilationSettings.target, version, isOpen, /*setNodeParents:*/ false);
|
||||
|
||||
bucket[filename] = entry = {
|
||||
sourceFile: sourceFile,
|
||||
@@ -1902,20 +2048,6 @@ module ts {
|
||||
}
|
||||
|
||||
/// Helpers
|
||||
export function getNodeModifiers(node: Node): string {
|
||||
var flags = node.flags;
|
||||
var result: string[] = [];
|
||||
|
||||
if (flags & NodeFlags.Private) result.push(ScriptElementKindModifier.privateMemberModifier);
|
||||
if (flags & NodeFlags.Protected) result.push(ScriptElementKindModifier.protectedMemberModifier);
|
||||
if (flags & NodeFlags.Public) result.push(ScriptElementKindModifier.publicMemberModifier);
|
||||
if (flags & NodeFlags.Static) result.push(ScriptElementKindModifier.staticModifier);
|
||||
if (flags & NodeFlags.Export) result.push(ScriptElementKindModifier.exportedModifier);
|
||||
if (isInAmbientContext(node)) result.push(ScriptElementKindModifier.ambientModifier);
|
||||
|
||||
return result.length > 0 ? result.join(',') : ScriptElementKindModifier.none;
|
||||
}
|
||||
|
||||
function getTargetLabel(referenceNode: Node, labelName: string): Identifier {
|
||||
while (referenceNode) {
|
||||
if (referenceNode.kind === SyntaxKind.LabeledStatement && (<LabeledStatement>referenceNode).label.text === labelName) {
|
||||
@@ -2095,12 +2227,12 @@ module ts {
|
||||
var useCaseSensitivefilenames = false;
|
||||
var sourceFilesByName: Map<SourceFile> = {};
|
||||
var documentRegistry = documentRegistry;
|
||||
var cancellationToken = new CancellationTokenObject(host.getCancellationToken());
|
||||
var cancellationToken = new CancellationTokenObject(host.getCancellationToken && host.getCancellationToken());
|
||||
var activeCompletionSession: CompletionSession; // The current active completion session, used to get the completion entry details
|
||||
var writer: (filename: string, data: string, writeByteOrderMark: boolean) => void = undefined;
|
||||
|
||||
// Check if the localized messages json is set, otherwise query the host for it
|
||||
if (!localizedDiagnosticMessages) {
|
||||
if (!localizedDiagnosticMessages && host.getLocalizedDiagnosticMessages) {
|
||||
localizedDiagnosticMessages = host.getLocalizedDiagnosticMessages();
|
||||
}
|
||||
|
||||
@@ -2366,7 +2498,7 @@ module ts {
|
||||
};
|
||||
}
|
||||
|
||||
function getCompletionsAtPosition(filename: string, position: number, isMemberCompletion: boolean) {
|
||||
function getCompletionsAtPosition(filename: string, position: number) {
|
||||
synchronizeHostData();
|
||||
|
||||
filename = normalizeSlashes(filename);
|
||||
@@ -2441,7 +2573,7 @@ module ts {
|
||||
if (isRightOfDot) {
|
||||
// Right of dot member completion list
|
||||
var symbols: Symbol[] = [];
|
||||
isMemberCompletion = true;
|
||||
var isMemberCompletion = true;
|
||||
|
||||
if (node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.QualifiedName || node.kind === SyntaxKind.PropertyAccessExpression) {
|
||||
var symbol = typeInfoResolver.getSymbolAtLocation(node);
|
||||
@@ -5788,6 +5920,7 @@ module ts {
|
||||
return TokenClass.StringLiteral;
|
||||
case SyntaxKind.RegularExpressionLiteral:
|
||||
return TokenClass.RegExpLiteral;
|
||||
case SyntaxKind.ConflictMarkerTrivia:
|
||||
case SyntaxKind.MultiLineCommentTrivia:
|
||||
case SyntaxKind.SingleLineCommentTrivia:
|
||||
return TokenClass.Comment;
|
||||
|
||||
+21
-133
@@ -88,7 +88,7 @@ module ts {
|
||||
|
||||
getSyntacticClassifications(fileName: string, start: number, length: number): string;
|
||||
|
||||
getCompletionsAtPosition(fileName: string, position: number, isMemberCompletion: boolean): string;
|
||||
getCompletionsAtPosition(fileName: string, position: number): string;
|
||||
getCompletionEntryDetails(fileName: string, position: number, entryName: string): string;
|
||||
|
||||
getQuickInfoAtPosition(fileName: string, position: number): string;
|
||||
@@ -169,131 +169,6 @@ module ts {
|
||||
getDefaultCompilationSettings(): string;
|
||||
}
|
||||
|
||||
/// TODO: delete this, it is only needed until the VS interface is updated
|
||||
export const enum LanguageVersion {
|
||||
EcmaScript3 = 0,
|
||||
EcmaScript5 = 1,
|
||||
EcmaScript6 = 2,
|
||||
}
|
||||
|
||||
export const enum ModuleGenTarget {
|
||||
Unspecified = 0,
|
||||
Synchronous = 1,
|
||||
Asynchronous = 2,
|
||||
}
|
||||
|
||||
export interface CompilationSettings {
|
||||
propagateEnumConstants?: boolean;
|
||||
removeComments?: boolean;
|
||||
watch?: boolean;
|
||||
noResolve?: boolean;
|
||||
allowAutomaticSemicolonInsertion?: boolean;
|
||||
noImplicitAny?: boolean;
|
||||
noLib?: boolean;
|
||||
codeGenTarget?: LanguageVersion;
|
||||
moduleGenTarget?: ModuleGenTarget;
|
||||
outFileOption?: string;
|
||||
outDirOption?: string;
|
||||
mapSourceFiles?: boolean;
|
||||
mapRoot?: string;
|
||||
sourceRoot?: string;
|
||||
generateDeclarationFiles?: boolean;
|
||||
useCaseSensitiveFileResolution?: boolean;
|
||||
gatherDiagnostics?: boolean;
|
||||
codepage?: number;
|
||||
emitBOM?: boolean;
|
||||
|
||||
// Declare indexer signature
|
||||
[index: string]: any;
|
||||
}
|
||||
|
||||
function languageVersionToScriptTarget(languageVersion: LanguageVersion): ScriptTarget {
|
||||
if (typeof languageVersion === "undefined") return undefined;
|
||||
|
||||
switch (languageVersion) {
|
||||
case LanguageVersion.EcmaScript3: return ScriptTarget.ES3
|
||||
case LanguageVersion.EcmaScript5: return ScriptTarget.ES5;
|
||||
case LanguageVersion.EcmaScript6: return ScriptTarget.ES6;
|
||||
default: throw Error("unsupported LanguageVersion value: " + languageVersion);
|
||||
}
|
||||
}
|
||||
|
||||
function moduleGenTargetToModuleKind(moduleGenTarget: ModuleGenTarget): ModuleKind {
|
||||
if (typeof moduleGenTarget === "undefined") return undefined;
|
||||
|
||||
switch (moduleGenTarget) {
|
||||
case ModuleGenTarget.Asynchronous: return ModuleKind.AMD;
|
||||
case ModuleGenTarget.Synchronous: return ModuleKind.CommonJS;
|
||||
case ModuleGenTarget.Unspecified: return ModuleKind.None;
|
||||
default: throw Error("unsupported ModuleGenTarget value: " + moduleGenTarget);
|
||||
}
|
||||
}
|
||||
|
||||
function scriptTargetTolanguageVersion(scriptTarget: ScriptTarget): LanguageVersion {
|
||||
if (typeof scriptTarget === "undefined") return undefined;
|
||||
|
||||
switch (scriptTarget) {
|
||||
case ScriptTarget.ES3: return LanguageVersion.EcmaScript3;
|
||||
case ScriptTarget.ES5: return LanguageVersion.EcmaScript5;
|
||||
case ScriptTarget.ES6: return LanguageVersion.EcmaScript6;
|
||||
default: throw Error("unsupported ScriptTarget value: " + scriptTarget);
|
||||
}
|
||||
}
|
||||
|
||||
function moduleKindToModuleGenTarget(moduleKind: ModuleKind): ModuleGenTarget {
|
||||
if (typeof moduleKind === "undefined") return undefined;
|
||||
|
||||
switch (moduleKind) {
|
||||
case ModuleKind.AMD: return ModuleGenTarget.Asynchronous;
|
||||
case ModuleKind.CommonJS: return ModuleGenTarget.Synchronous;
|
||||
case ModuleKind.None: return ModuleGenTarget.Unspecified;
|
||||
default: throw Error("unsupported ModuleKind value: " + moduleKind);
|
||||
}
|
||||
}
|
||||
|
||||
function compilationSettingsToCompilerOptions(settings: CompilationSettings): CompilerOptions {
|
||||
// TODO: we should not be converting, but use options all the way
|
||||
var options: CompilerOptions = {};
|
||||
//options.propagateEnumConstants = settings.propagateEnumConstants;
|
||||
options.removeComments = settings.removeComments;
|
||||
options.noResolve = settings.noResolve;
|
||||
options.noImplicitAny = settings.noImplicitAny;
|
||||
options.noLib = settings.noLib;
|
||||
options.target = languageVersionToScriptTarget(settings.codeGenTarget);
|
||||
options.module = moduleGenTargetToModuleKind(settings.moduleGenTarget);
|
||||
options.out = settings.outFileOption;
|
||||
options.outDir = settings.outDirOption;
|
||||
options.sourceMap = settings.mapSourceFiles;
|
||||
options.mapRoot = settings.mapRoot;
|
||||
options.sourceRoot = settings.sourceRoot;
|
||||
options.declaration = settings.generateDeclarationFiles;
|
||||
//options.useCaseSensitiveFileResolution = settings.useCaseSensitiveFileResolution;
|
||||
options.codepage = settings.codepage;
|
||||
options.emitBOM = settings.emitBOM;
|
||||
return options;
|
||||
}
|
||||
|
||||
function compilerOptionsToCompilationSettings(options: CompilerOptions): CompilationSettings {
|
||||
var settings: CompilationSettings = {};
|
||||
//options.propagateEnumConstants = settings.propagateEnumConstants;
|
||||
settings.removeComments = options.removeComments;
|
||||
settings.noResolve = options.noResolve;
|
||||
settings.noImplicitAny = options.noImplicitAny;
|
||||
settings.noLib = options.noLib;
|
||||
settings.codeGenTarget = scriptTargetTolanguageVersion(options.target);
|
||||
settings.moduleGenTarget = moduleKindToModuleGenTarget(options.module);
|
||||
settings.outFileOption = options.out;
|
||||
settings.outDirOption = options.outDir;
|
||||
settings.mapSourceFiles = options.sourceMap;
|
||||
settings.mapRoot = options.mapRoot;
|
||||
settings.sourceRoot = options.sourceRoot;
|
||||
settings.generateDeclarationFiles = options.declaration;
|
||||
// settings.useCaseSensitiveFileResolution = options.useCaseSensitiveFileResolution;
|
||||
settings.codepage = options.codepage;
|
||||
settings.emitBOM = options.emitBOM;
|
||||
return settings;
|
||||
}
|
||||
|
||||
function logInternalError(logger: Logger, err: Error) {
|
||||
logger.log("*INTERNAL ERROR* - Exception in typescript services: " + err.message);
|
||||
}
|
||||
@@ -341,15 +216,21 @@ module ts {
|
||||
this.shimHost.log(s);
|
||||
}
|
||||
|
||||
public trace(s: string): void {
|
||||
this.shimHost.trace(s);
|
||||
}
|
||||
|
||||
public error(s: string): void {
|
||||
this.shimHost.error(s);
|
||||
}
|
||||
|
||||
public getCompilationSettings(): CompilerOptions {
|
||||
var settingsJson = this.shimHost.getCompilationSettings();
|
||||
if (settingsJson == null || settingsJson == "") {
|
||||
throw Error("LanguageServiceShimHostAdapter.getCompilationSettings: empty compilationSettings");
|
||||
return null;
|
||||
}
|
||||
var options = compilationSettingsToCompilerOptions(<CompilerOptions>JSON.parse(<any>settingsJson));
|
||||
|
||||
return options;
|
||||
return <CompilerOptions>JSON.parse(settingsJson);
|
||||
}
|
||||
|
||||
public getScriptFileNames(): string[] {
|
||||
@@ -686,11 +567,11 @@ module ts {
|
||||
* to provide at the given source position and providing a member completion
|
||||
* list if requested.
|
||||
*/
|
||||
public getCompletionsAtPosition(fileName: string, position: number, isMemberCompletion: boolean) {
|
||||
public getCompletionsAtPosition(fileName: string, position: number) {
|
||||
return this.forwardJSONCall(
|
||||
"getCompletionsAtPosition('" + fileName + "', " + position + ", " + isMemberCompletion + ")",
|
||||
"getCompletionsAtPosition('" + fileName + "', " + position + ")",
|
||||
() => {
|
||||
var completion = this.languageService.getCompletionsAtPosition(fileName, position, isMemberCompletion);
|
||||
var completion = this.languageService.getCompletionsAtPosition(fileName, position);
|
||||
return completion;
|
||||
});
|
||||
}
|
||||
@@ -850,7 +731,7 @@ module ts {
|
||||
return this.forwardJSONCall(
|
||||
"getDefaultCompilationSettings()",
|
||||
() => {
|
||||
return compilerOptionsToCompilationSettings(getDefaultCompilerOptions());
|
||||
return getDefaultCompilerOptions();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -859,6 +740,13 @@ module ts {
|
||||
private _shims: Shim[] = [];
|
||||
private documentRegistry: DocumentRegistry = createDocumentRegistry();
|
||||
|
||||
/*
|
||||
* Returns script API version.
|
||||
*/
|
||||
public getServicesVersion(): string {
|
||||
return servicesVersion;
|
||||
}
|
||||
|
||||
public createLanguageServiceShim(host: LanguageServiceShimHost): LanguageServiceShim {
|
||||
try {
|
||||
var hostAdapter = new LanguageServiceShimHostAdapter(host);
|
||||
|
||||
@@ -1,296 +0,0 @@
|
||||
module ts {
|
||||
export class TextSpan {
|
||||
private _start: number;
|
||||
private _length: number;
|
||||
|
||||
/**
|
||||
* Creates a TextSpan instance beginning with the position Start and having the Length
|
||||
* specified with length.
|
||||
*/
|
||||
constructor(start: number, length: number) {
|
||||
Debug.assert(start >= 0, "start");
|
||||
Debug.assert(length >= 0, "length");
|
||||
|
||||
this._start = start;
|
||||
this._length = length;
|
||||
}
|
||||
|
||||
public toJSON(key: any): any {
|
||||
return { start: this._start, length: this._length };
|
||||
}
|
||||
|
||||
public start(): number {
|
||||
return this._start;
|
||||
}
|
||||
|
||||
public length(): number {
|
||||
return this._length;
|
||||
}
|
||||
|
||||
public end(): number {
|
||||
return this._start + this._length;
|
||||
}
|
||||
|
||||
public isEmpty(): boolean {
|
||||
return this._length === 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether the position lies within the span. Returns true if the position is greater than or equal to Start and strictly less
|
||||
* than End, otherwise false.
|
||||
* @param position The position to check.
|
||||
*/
|
||||
public containsPosition(position: number): boolean {
|
||||
return position >= this._start && position < this.end();
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether span falls completely within this span. Returns true if the specified span falls completely within this span, otherwise false.
|
||||
* @param span The span to check.
|
||||
*/
|
||||
public containsTextSpan(span: TextSpan): boolean {
|
||||
return span._start >= this._start && span.end() <= this.end();
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether the given span overlaps this span. Two spans are considered to overlap
|
||||
* if they have positions in common and neither is empty. Empty spans do not overlap with any
|
||||
* other span. Returns true if the spans overlap, false otherwise.
|
||||
* @param span The span to check.
|
||||
*/
|
||||
public overlapsWith(span: TextSpan): boolean {
|
||||
var overlapStart = Math.max(this._start, span._start);
|
||||
var overlapEnd = Math.min(this.end(), span.end());
|
||||
|
||||
return overlapStart < overlapEnd;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the overlap with the given span, or undefined if there is no overlap.
|
||||
* @param span The span to check.
|
||||
*/
|
||||
public overlap(span: TextSpan): TextSpan {
|
||||
var overlapStart = Math.max(this._start, span._start);
|
||||
var overlapEnd = Math.min(this.end(), span.end());
|
||||
|
||||
if (overlapStart < overlapEnd) {
|
||||
return TextSpan.fromBounds(overlapStart, overlapEnd);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether span intersects this span. Two spans are considered to
|
||||
* intersect if they have positions in common or the end of one span
|
||||
* coincides with the start of the other span. Returns true if the spans intersect, false otherwise.
|
||||
* @param The span to check.
|
||||
*/
|
||||
public intersectsWithTextSpan(span: TextSpan): boolean {
|
||||
return span._start <= this.end() && span.end() >= this._start;
|
||||
}
|
||||
|
||||
public intersectsWith(start: number, length: number): boolean {
|
||||
var end = start + length;
|
||||
return start <= this.end() && end >= this._start;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether the given position intersects this span.
|
||||
* A position is considered to intersect if it is between the start and
|
||||
* end positions (inclusive) of this span. Returns true if the position intersects, false otherwise.
|
||||
* @param position The position to check.
|
||||
*/
|
||||
public intersectsWithPosition(position: number): boolean {
|
||||
return position <= this.end() && position >= this._start;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the intersection with the given span, or undefined if there is no intersection.
|
||||
* @param span The span to check.
|
||||
*/
|
||||
public intersection(span: TextSpan): TextSpan {
|
||||
var intersectStart = Math.max(this._start, span._start);
|
||||
var intersectEnd = Math.min(this.end(), span.end());
|
||||
|
||||
if (intersectStart <= intersectEnd) {
|
||||
return TextSpan.fromBounds(intersectStart, intersectEnd);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new TextSpan from the given start and end positions
|
||||
* as opposed to a position and length.
|
||||
*/
|
||||
public static fromBounds(start: number, end: number): TextSpan {
|
||||
Debug.assert(start >= 0);
|
||||
Debug.assert(end - start >= 0);
|
||||
return new TextSpan(start, end - start);
|
||||
}
|
||||
}
|
||||
|
||||
export class TextChangeRange {
|
||||
public static unchanged = new TextChangeRange(new TextSpan(0, 0), 0);
|
||||
|
||||
private _span: TextSpan;
|
||||
private _newLength: number;
|
||||
|
||||
/**
|
||||
* Initializes a new instance of TextChangeRange.
|
||||
*/
|
||||
constructor(span: TextSpan, newLength: number) {
|
||||
Debug.assert(newLength >= 0, "newLength");
|
||||
|
||||
this._span = span;
|
||||
this._newLength = newLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* The span of text before the edit which is being changed
|
||||
*/
|
||||
public span(): TextSpan {
|
||||
return this._span;
|
||||
}
|
||||
|
||||
/**
|
||||
* Width of the span after the edit. A 0 here would represent a delete
|
||||
*/
|
||||
public newLength(): number {
|
||||
return this._newLength;
|
||||
}
|
||||
|
||||
public newSpan(): TextSpan {
|
||||
return new TextSpan(this.span().start(), this.newLength());
|
||||
}
|
||||
|
||||
public isUnchanged(): boolean {
|
||||
return this.span().isEmpty() && this.newLength() === 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to merge all the changes that occurred across several versions of a script snapshot
|
||||
* into a single change. i.e. if a user keeps making successive edits to a script we will
|
||||
* have a text change from V1 to V2, V2 to V3, ..., Vn.
|
||||
*
|
||||
* This function will then merge those changes into a single change range valid between V1 and
|
||||
* Vn.
|
||||
*/
|
||||
public static collapseChangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange {
|
||||
if (changes.length === 0) {
|
||||
return TextChangeRange.unchanged;
|
||||
}
|
||||
|
||||
if (changes.length === 1) {
|
||||
return changes[0];
|
||||
}
|
||||
|
||||
// We change from talking about { { oldStart, oldLength }, newLength } to { oldStart, oldEnd, newEnd }
|
||||
// as it makes things much easier to reason about.
|
||||
var change0 = changes[0];
|
||||
|
||||
var oldStartN = change0.span().start();
|
||||
var oldEndN = change0.span().end();
|
||||
var newEndN = oldStartN + change0.newLength();
|
||||
|
||||
for (var i = 1; i < changes.length; i++) {
|
||||
var nextChange = changes[i];
|
||||
|
||||
// Consider the following case:
|
||||
// i.e. two edits. The first represents the text change range { { 10, 50 }, 30 }. i.e. The span starting
|
||||
// at 10, with length 50 is reduced to length 30. The second represents the text change range { { 30, 30 }, 40 }.
|
||||
// i.e. the span starting at 30 with length 30 is increased to length 40.
|
||||
//
|
||||
// 0 10 20 30 40 50 60 70 80 90 100
|
||||
// -------------------------------------------------------------------------------------------------------
|
||||
// | /
|
||||
// | /----
|
||||
// T1 | /----
|
||||
// | /----
|
||||
// | /----
|
||||
// -------------------------------------------------------------------------------------------------------
|
||||
// | \
|
||||
// | \
|
||||
// T2 | \
|
||||
// | \
|
||||
// | \
|
||||
// -------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Merging these turns out to not be too difficult. First, determining the new start of the change is trivial
|
||||
// it's just the min of the old and new starts. i.e.:
|
||||
//
|
||||
// 0 10 20 30 40 50 60 70 80 90 100
|
||||
// ------------------------------------------------------------*------------------------------------------
|
||||
// | /
|
||||
// | /----
|
||||
// T1 | /----
|
||||
// | /----
|
||||
// | /----
|
||||
// ----------------------------------------$-------------------$------------------------------------------
|
||||
// . | \
|
||||
// . | \
|
||||
// T2 . | \
|
||||
// . | \
|
||||
// . | \
|
||||
// ----------------------------------------------------------------------*--------------------------------
|
||||
//
|
||||
// (Note the dots represent the newly inferrred start.
|
||||
// Determining the new and old end is also pretty simple. Basically it boils down to paying attention to the
|
||||
// absolute positions at the asterixes, and the relative change between the dollar signs. Basically, we see
|
||||
// which if the two $'s precedes the other, and we move that one forward until they line up. in this case that
|
||||
// means:
|
||||
//
|
||||
// 0 10 20 30 40 50 60 70 80 90 100
|
||||
// --------------------------------------------------------------------------------*----------------------
|
||||
// | /
|
||||
// | /----
|
||||
// T1 | /----
|
||||
// | /----
|
||||
// | /----
|
||||
// ------------------------------------------------------------$------------------------------------------
|
||||
// . | \
|
||||
// . | \
|
||||
// T2 . | \
|
||||
// . | \
|
||||
// . | \
|
||||
// ----------------------------------------------------------------------*--------------------------------
|
||||
//
|
||||
// In other words (in this case), we're recognizing that the second edit happened after where the first edit
|
||||
// ended with a delta of 20 characters (60 - 40). Thus, if we go back in time to where the first edit started
|
||||
// that's the same as if we started at char 80 instead of 60.
|
||||
//
|
||||
// As it so happens, the same logic applies if the second edit precedes the first edit. In that case rahter
|
||||
// than pusing the first edit forward to match the second, we'll push the second edit forward to match the
|
||||
// first.
|
||||
//
|
||||
// In this case that means we have { oldStart: 10, oldEnd: 80, newEnd: 70 } or, in TextChangeRange
|
||||
// semantics: { { start: 10, length: 70 }, newLength: 60 }
|
||||
//
|
||||
// The math then works out as follows.
|
||||
// If we have { oldStart1, oldEnd1, newEnd1 } and { oldStart2, oldEnd2, newEnd2 } then we can compute the
|
||||
// final result like so:
|
||||
//
|
||||
// {
|
||||
// oldStart3: Min(oldStart1, oldStart2),
|
||||
// oldEnd3 : Max(oldEnd1, oldEnd1 + (oldEnd2 - newEnd1)),
|
||||
// newEnd3 : Max(newEnd2, newEnd2 + (newEnd1 - oldEnd2))
|
||||
// }
|
||||
|
||||
var oldStart1 = oldStartN;
|
||||
var oldEnd1 = oldEndN;
|
||||
var newEnd1 = newEndN;
|
||||
|
||||
var oldStart2 = nextChange.span().start();
|
||||
var oldEnd2 = nextChange.span().end();
|
||||
var newEnd2 = oldStart2 + nextChange.newLength();
|
||||
|
||||
oldStartN = Math.min(oldStart1, oldStart2);
|
||||
oldEndN = Math.max(oldEnd1, oldEnd1 + (oldEnd2 - newEnd1));
|
||||
newEndN = Math.max(newEnd2, newEnd2 + (newEnd1 - oldEnd2));
|
||||
}
|
||||
|
||||
return new TextChangeRange(TextSpan.fromBounds(oldStartN, oldEndN), /*newLength: */newEndN - oldStartN);
|
||||
}
|
||||
}
|
||||
}
|
||||
+177
-1
@@ -270,7 +270,21 @@ module ts {
|
||||
return n.getWidth() !== 0;
|
||||
}
|
||||
|
||||
export function getTypeArgumentOrTypeParameterList(node: Node): NodeArray<Node> {
|
||||
export function getNodeModifiers(node: Node): string {
|
||||
var flags = node.flags;
|
||||
var result: string[] = [];
|
||||
|
||||
if (flags & NodeFlags.Private) result.push(ScriptElementKindModifier.privateMemberModifier);
|
||||
if (flags & NodeFlags.Protected) result.push(ScriptElementKindModifier.protectedMemberModifier);
|
||||
if (flags & NodeFlags.Public) result.push(ScriptElementKindModifier.publicMemberModifier);
|
||||
if (flags & NodeFlags.Static) result.push(ScriptElementKindModifier.staticModifier);
|
||||
if (flags & NodeFlags.Export) result.push(ScriptElementKindModifier.exportedModifier);
|
||||
if (isInAmbientContext(node)) result.push(ScriptElementKindModifier.ambientModifier);
|
||||
|
||||
return result.length > 0 ? result.join(',') : ScriptElementKindModifier.none;
|
||||
}
|
||||
|
||||
export function getTypeArgumentOrTypeParameterList(node: Node): NodeArray<Node> {
|
||||
if (node.kind === SyntaxKind.TypeReference || node.kind === SyntaxKind.CallExpression) {
|
||||
return (<CallExpression>node).typeArguments;
|
||||
}
|
||||
@@ -306,4 +320,166 @@ module ts {
|
||||
return isTemplateLiteralKind(node.kind)
|
||||
&& (node.getStart() < position && position < node.getEnd()) || (!!node.isUnterminated && position === node.getEnd());
|
||||
}
|
||||
|
||||
export function compareDataObjects(dst: any, src: any): boolean {
|
||||
for (var e in dst) {
|
||||
if (typeof dst[e] === "object") {
|
||||
if (!compareDataObjects(dst[e], src[e])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (typeof dst[e] !== "function") {
|
||||
if (dst[e] !== src[e]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Display-part writer helpers
|
||||
module ts {
|
||||
export function isFirstDeclarationOfSymbolParameter(symbol: Symbol) {
|
||||
return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === SyntaxKind.Parameter;
|
||||
}
|
||||
|
||||
var displayPartWriter = getDisplayPartWriter();
|
||||
function getDisplayPartWriter(): DisplayPartsSymbolWriter {
|
||||
var displayParts: SymbolDisplayPart[];
|
||||
var lineStart: boolean;
|
||||
var indent: number;
|
||||
|
||||
resetWriter();
|
||||
return {
|
||||
displayParts: () => displayParts,
|
||||
writeKeyword: text => writeKind(text, SymbolDisplayPartKind.keyword),
|
||||
writeOperator: text => writeKind(text, SymbolDisplayPartKind.operator),
|
||||
writePunctuation: text => writeKind(text, SymbolDisplayPartKind.punctuation),
|
||||
writeSpace: text => writeKind(text, SymbolDisplayPartKind.space),
|
||||
writeStringLiteral: text => writeKind(text, SymbolDisplayPartKind.stringLiteral),
|
||||
writeParameter: text => writeKind(text, SymbolDisplayPartKind.parameterName),
|
||||
writeSymbol,
|
||||
writeLine,
|
||||
increaseIndent: () => { indent++; },
|
||||
decreaseIndent: () => { indent--; },
|
||||
clear: resetWriter,
|
||||
trackSymbol: () => { }
|
||||
};
|
||||
|
||||
function writeIndent() {
|
||||
if (lineStart) {
|
||||
var indentString = getIndentString(indent);
|
||||
if (indentString) {
|
||||
displayParts.push(displayPart(indentString, SymbolDisplayPartKind.space));
|
||||
}
|
||||
lineStart = false;
|
||||
}
|
||||
}
|
||||
|
||||
function writeKind(text: string, kind: SymbolDisplayPartKind) {
|
||||
writeIndent();
|
||||
displayParts.push(displayPart(text, kind));
|
||||
}
|
||||
|
||||
function writeSymbol(text: string, symbol: Symbol) {
|
||||
writeIndent();
|
||||
displayParts.push(symbolPart(text, symbol));
|
||||
}
|
||||
|
||||
function writeLine() {
|
||||
displayParts.push(lineBreakPart());
|
||||
lineStart = true;
|
||||
}
|
||||
|
||||
function resetWriter() {
|
||||
displayParts = []
|
||||
lineStart = true;
|
||||
indent = 0;
|
||||
}
|
||||
}
|
||||
|
||||
export function symbolPart(text: string, symbol: Symbol) {
|
||||
return displayPart(text, displayPartKind(symbol), symbol);
|
||||
|
||||
function displayPartKind(symbol: Symbol): SymbolDisplayPartKind {
|
||||
var flags = symbol.flags;
|
||||
|
||||
if (flags & SymbolFlags.Variable) {
|
||||
return isFirstDeclarationOfSymbolParameter(symbol) ? SymbolDisplayPartKind.parameterName : SymbolDisplayPartKind.localName;
|
||||
}
|
||||
else if (flags & SymbolFlags.Property) { return SymbolDisplayPartKind.propertyName; }
|
||||
else if (flags & SymbolFlags.GetAccessor) { return SymbolDisplayPartKind.propertyName; }
|
||||
else if (flags & SymbolFlags.SetAccessor) { return SymbolDisplayPartKind.propertyName; }
|
||||
else if (flags & SymbolFlags.EnumMember) { return SymbolDisplayPartKind.enumMemberName; }
|
||||
else if (flags & SymbolFlags.Function) { return SymbolDisplayPartKind.functionName; }
|
||||
else if (flags & SymbolFlags.Class) { return SymbolDisplayPartKind.className; }
|
||||
else if (flags & SymbolFlags.Interface) { return SymbolDisplayPartKind.interfaceName; }
|
||||
else if (flags & SymbolFlags.Enum) { return SymbolDisplayPartKind.enumName; }
|
||||
else if (flags & SymbolFlags.Module) { return SymbolDisplayPartKind.moduleName; }
|
||||
else if (flags & SymbolFlags.Method) { return SymbolDisplayPartKind.methodName; }
|
||||
else if (flags & SymbolFlags.TypeParameter) { return SymbolDisplayPartKind.typeParameterName; }
|
||||
else if (flags & SymbolFlags.TypeAlias) { return SymbolDisplayPartKind.aliasName; }
|
||||
else if (flags & SymbolFlags.Import) { return SymbolDisplayPartKind.aliasName; }
|
||||
|
||||
|
||||
return SymbolDisplayPartKind.text;
|
||||
}
|
||||
}
|
||||
|
||||
export function displayPart(text: string, kind: SymbolDisplayPartKind, symbol?: Symbol): SymbolDisplayPart {
|
||||
return <SymbolDisplayPart> {
|
||||
text: text,
|
||||
kind: SymbolDisplayPartKind[kind]
|
||||
};
|
||||
}
|
||||
|
||||
export function spacePart() {
|
||||
return displayPart(" ", SymbolDisplayPartKind.space);
|
||||
}
|
||||
|
||||
export function keywordPart(kind: SyntaxKind) {
|
||||
return displayPart(tokenToString(kind), SymbolDisplayPartKind.keyword);
|
||||
}
|
||||
|
||||
export function punctuationPart(kind: SyntaxKind) {
|
||||
return displayPart(tokenToString(kind), SymbolDisplayPartKind.punctuation);
|
||||
}
|
||||
|
||||
export function operatorPart(kind: SyntaxKind) {
|
||||
return displayPart(tokenToString(kind), SymbolDisplayPartKind.operator);
|
||||
}
|
||||
|
||||
export function textPart(text: string) {
|
||||
return displayPart(text, SymbolDisplayPartKind.text);
|
||||
}
|
||||
|
||||
export function lineBreakPart() {
|
||||
return displayPart("\n", SymbolDisplayPartKind.lineBreak);
|
||||
}
|
||||
|
||||
export function mapToDisplayParts(writeDisplayParts: (writer: DisplayPartsSymbolWriter) => void): SymbolDisplayPart[] {
|
||||
writeDisplayParts(displayPartWriter);
|
||||
var result = displayPartWriter.displayParts();
|
||||
displayPartWriter.clear();
|
||||
return result;
|
||||
}
|
||||
|
||||
export function typeToDisplayParts(typechecker: TypeChecker, type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): SymbolDisplayPart[] {
|
||||
return mapToDisplayParts(writer => {
|
||||
typechecker.getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags);
|
||||
});
|
||||
}
|
||||
|
||||
export function symbolToDisplayParts(typeChecker: TypeChecker, symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): SymbolDisplayPart[] {
|
||||
return mapToDisplayParts(writer => {
|
||||
typeChecker.getSymbolDisplayBuilder().buildSymbolDisplay(symbol, writer, enclosingDeclaration, meaning, flags);
|
||||
});
|
||||
}
|
||||
|
||||
export function signatureToDisplayParts(typechecker: TypeChecker, signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags): SymbolDisplayPart[] {
|
||||
return mapToDisplayParts(writer => {
|
||||
typechecker.getSymbolDisplayBuilder().buildSignatureDisplay(signature, writer, enclosingDeclaration, flags);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction3.ts(1,14): error TS1110: Type expected.
|
||||
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction3.ts(1,13): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement.
|
||||
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction3.ts(1,14): error TS1110: Type expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction3.ts (2 errors) ====
|
||||
var v = (a): => {
|
||||
~~
|
||||
!!! error TS1110: Type expected.
|
||||
|
||||
!!! error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement.
|
||||
~~
|
||||
!!! error TS1110: Type expected.
|
||||
|
||||
};
|
||||
@@ -1,17 +1,17 @@
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration5_es6.ts(1,14): error TS1138: Parameter declaration expected.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration5_es6.ts(1,19): error TS1005: ';' expected.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration5_es6.ts(1,10): error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration5_es6.ts(1,14): error TS1138: Parameter declaration expected.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration5_es6.ts(1,14): error TS2304: Cannot find name 'yield'.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration5_es6.ts(1,19): error TS1005: ';' expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration5_es6.ts (4 errors) ====
|
||||
function*foo(yield) {
|
||||
~~~~~
|
||||
!!! error TS1138: Parameter declaration expected.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~
|
||||
!!! error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
~~~~~
|
||||
!!! error TS1138: Parameter declaration expected.
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'yield'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration6_es6.ts(3,1): error TS1005: '(' expected.
|
||||
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration6_es6.ts(2,5): error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration6_es6.ts(3,1): error TS1005: '(' expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration6_es6.ts (2 errors) ====
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration8_es6.ts(4,9): error TS2304: Cannot find name 'a'.
|
||||
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration8_es6.ts(4,12): error TS1127: Invalid character.
|
||||
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration8_es6.ts(4,14): error TS1109: Expression expected.
|
||||
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration8_es6.ts(4,9): error TS2304: Cannot find name 'a'.
|
||||
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration8_es6.ts(4,16): error TS2304: Cannot find name 'bar'.
|
||||
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration8_es6.ts(5,12): error TS2304: Cannot find name 'bar'.
|
||||
|
||||
@@ -10,12 +10,12 @@ tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration
|
||||
foo() {
|
||||
// Make sure we don't think of *bar as the start of a generator method.
|
||||
if (a) # * bar;
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'a'.
|
||||
|
||||
!!! error TS1127: Invalid character.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'a'.
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'bar'.
|
||||
return bar;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
tests/cases/conformance/es6/templates/TemplateExpression1.ts(1,19): error TS1005: '}' expected.
|
||||
tests/cases/conformance/es6/templates/TemplateExpression1.ts(1,17): error TS2304: Cannot find name 'a'.
|
||||
tests/cases/conformance/es6/templates/TemplateExpression1.ts(1,19): error TS1005: '}' expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/templates/TemplateExpression1.ts (2 errors) ====
|
||||
var v = `foo ${ a
|
||||
|
||||
!!! error TS1005: '}' expected.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'a'.
|
||||
!!! error TS2304: Cannot find name 'a'.
|
||||
|
||||
!!! error TS1005: '}' expected.
|
||||
@@ -1,10 +1,10 @@
|
||||
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/TypeArgumentLists/TypeArgumentList1.ts(1,9): error TS1127: Invalid character.
|
||||
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/TypeArgumentLists/TypeArgumentList1.ts(1,1): error TS2304: Cannot find name 'Foo'.
|
||||
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/TypeArgumentLists/TypeArgumentList1.ts(1,9): error TS1127: Invalid character.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/TypeArgumentLists/TypeArgumentList1.ts (2 errors) ====
|
||||
Foo<A,B,\ C>(4, 5, 6);
|
||||
|
||||
!!! error TS1127: Invalid character.
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'Foo'.
|
||||
!!! error TS2304: Cannot find name 'Foo'.
|
||||
|
||||
!!! error TS1127: Invalid character.
|
||||
@@ -1,5 +1,9 @@
|
||||
<<<<<<< HEAD
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts(2,9): error TS9001: Generators are not currently supported.
|
||||
=======
|
||||
>>>>>>> master
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts(1,1): error TS2304: Cannot find name 'yield'.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts(2,9): error TS9001: Generators are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts (2 errors) ====
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
tests/cases/compiler/aliasErrors.ts(11,1): error TS2304: Cannot find name 'no'.
|
||||
tests/cases/compiler/aliasErrors.ts(12,1): error TS2304: Cannot find name 'no'.
|
||||
tests/cases/compiler/aliasErrors.ts(13,12): error TS1003: Identifier expected.
|
||||
tests/cases/compiler/aliasErrors.ts(14,12): error TS1003: Identifier expected.
|
||||
tests/cases/compiler/aliasErrors.ts(15,12): error TS1003: Identifier expected.
|
||||
tests/cases/compiler/aliasErrors.ts(11,1): error TS2304: Cannot find name 'no'.
|
||||
tests/cases/compiler/aliasErrors.ts(12,1): error TS2304: Cannot find name 'no'.
|
||||
tests/cases/compiler/aliasErrors.ts(16,1): error TS2304: Cannot find name 'undefined'.
|
||||
tests/cases/compiler/aliasErrors.ts(26,10): error TS2305: Module 'foo.bar.baz' has no exported member 'bar'.
|
||||
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
tests/cases/conformance/ambient/ambientErrors.ts(2,15): error TS1039: Initializers are not allowed in ambient contexts.
|
||||
tests/cases/conformance/ambient/ambientErrors.ts(6,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/conformance/ambient/ambientErrors.ts(17,22): error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
|
||||
<<<<<<< HEAD
|
||||
tests/cases/conformance/ambient/ambientErrors.ts(20,24): error TS1036: Statements are not allowed in ambient contexts.
|
||||
=======
|
||||
>>>>>>> master
|
||||
tests/cases/conformance/ambient/ambientErrors.ts(20,24): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/conformance/ambient/ambientErrors.ts(24,5): error TS1066: Ambient enum elements can only have integer literal initializers.
|
||||
tests/cases/conformance/ambient/ambientErrors.ts(29,5): error TS1066: Ambient enum elements can only have integer literal initializers.
|
||||
|
||||
@@ -3,6 +3,7 @@ tests/cases/compiler/ambientWithStatements.ts(3,5): error TS1036: Statements are
|
||||
tests/cases/compiler/ambientWithStatements.ts(4,5): error TS1036: Statements are not allowed in ambient contexts.
|
||||
tests/cases/compiler/ambientWithStatements.ts(5,5): error TS1036: Statements are not allowed in ambient contexts.
|
||||
tests/cases/compiler/ambientWithStatements.ts(7,5): error TS1036: Statements are not allowed in ambient contexts.
|
||||
tests/cases/compiler/ambientWithStatements.ts(7,15): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.
|
||||
tests/cases/compiler/ambientWithStatements.ts(8,5): error TS1036: Statements are not allowed in ambient contexts.
|
||||
tests/cases/compiler/ambientWithStatements.ts(9,5): error TS1036: Statements are not allowed in ambient contexts.
|
||||
tests/cases/compiler/ambientWithStatements.ts(10,5): error TS1036: Statements are not allowed in ambient contexts.
|
||||
@@ -11,7 +12,6 @@ tests/cases/compiler/ambientWithStatements.ts(12,5): error TS1036: Statements ar
|
||||
tests/cases/compiler/ambientWithStatements.ts(18,5): error TS1036: Statements are not allowed in ambient contexts.
|
||||
tests/cases/compiler/ambientWithStatements.ts(19,5): error TS1036: Statements are not allowed in ambient contexts.
|
||||
tests/cases/compiler/ambientWithStatements.ts(25,5): error TS1036: Statements are not allowed in ambient contexts.
|
||||
tests/cases/compiler/ambientWithStatements.ts(7,15): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.
|
||||
tests/cases/compiler/ambientWithStatements.ts(25,11): error TS2410: All symbols within a 'with' block will be resolved to 'any'.
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
tests/cases/compiler/ambiguousGenericAssertion1.ts(4,10): error TS1109: Expression expected.
|
||||
tests/cases/compiler/ambiguousGenericAssertion1.ts(4,15): error TS2304: Cannot find name 'x'.
|
||||
tests/cases/compiler/ambiguousGenericAssertion1.ts(4,16): error TS1005: ')' expected.
|
||||
tests/cases/compiler/ambiguousGenericAssertion1.ts(4,19): error TS1005: ',' expected.
|
||||
tests/cases/compiler/ambiguousGenericAssertion1.ts(4,21): error TS1005: ';' expected.
|
||||
tests/cases/compiler/ambiguousGenericAssertion1.ts(4,15): error TS2304: Cannot find name 'x'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/ambiguousGenericAssertion1.ts (5 errors) ====
|
||||
@@ -12,12 +12,12 @@ tests/cases/compiler/ambiguousGenericAssertion1.ts(4,15): error TS2304: Cannot f
|
||||
var r3 = <<T>(x: T) => T>f; // ambiguous, appears to the parser as a << operation
|
||||
~~
|
||||
!!! error TS1109: Expression expected.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'x'.
|
||||
~
|
||||
!!! error TS1005: ')' expected.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~~
|
||||
!!! error TS1005: ';' expected.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'x'.
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
tests/cases/compiler/anonymousModules.ts(1,1): error TS2304: Cannot find name 'module'.
|
||||
tests/cases/compiler/anonymousModules.ts(1,8): error TS1005: ';' expected.
|
||||
tests/cases/compiler/anonymousModules.ts(2,2): error TS1129: Statement expected.
|
||||
tests/cases/compiler/anonymousModules.ts(2,2): error TS1148: Cannot compile external modules unless the '--module' flag is provided.
|
||||
tests/cases/compiler/anonymousModules.ts(4,2): error TS2304: Cannot find name 'module'.
|
||||
tests/cases/compiler/anonymousModules.ts(4,9): error TS1005: ';' expected.
|
||||
tests/cases/compiler/anonymousModules.ts(5,3): error TS1129: Statement expected.
|
||||
tests/cases/compiler/anonymousModules.ts(6,2): error TS1128: Declaration or statement expected.
|
||||
tests/cases/compiler/anonymousModules.ts(10,9): error TS1005: ';' expected.
|
||||
tests/cases/compiler/anonymousModules.ts(13,1): error TS1128: Declaration or statement expected.
|
||||
tests/cases/compiler/anonymousModules.ts(1,1): error TS2304: Cannot find name 'module'.
|
||||
tests/cases/compiler/anonymousModules.ts(4,2): error TS2304: Cannot find name 'module'.
|
||||
tests/cases/compiler/anonymousModules.ts(5,14): error TS2395: Individual declarations in merged declaration bar must be all exported or all local.
|
||||
tests/cases/compiler/anonymousModules.ts(6,2): error TS1128: Declaration or statement expected.
|
||||
tests/cases/compiler/anonymousModules.ts(8,6): error TS2395: Individual declarations in merged declaration bar must be all exported or all local.
|
||||
tests/cases/compiler/anonymousModules.ts(10,2): error TS2304: Cannot find name 'module'.
|
||||
tests/cases/compiler/anonymousModules.ts(10,9): error TS1005: ';' expected.
|
||||
tests/cases/compiler/anonymousModules.ts(13,1): error TS1128: Declaration or statement expected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/anonymousModules.ts (13 errors) ====
|
||||
module {
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'module'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
export var foo = 1;
|
||||
~~~~~~
|
||||
!!! error TS1129: Statement expected.
|
||||
@@ -26,10 +26,10 @@ tests/cases/compiler/anonymousModules.ts(10,2): error TS2304: Cannot find name '
|
||||
!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided.
|
||||
|
||||
module {
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'module'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
export var bar = 1;
|
||||
~~~~~~
|
||||
!!! error TS1129: Statement expected.
|
||||
@@ -44,10 +44,10 @@ tests/cases/compiler/anonymousModules.ts(10,2): error TS2304: Cannot find name '
|
||||
!!! error TS2395: Individual declarations in merged declaration bar must be all exported or all local.
|
||||
|
||||
module {
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'module'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
var x = bar;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts(6,22): error TS1005: '=' expected.
|
||||
tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts(6,30): error TS1109: Expression expected.
|
||||
tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts(7,22): error TS1005: '=' expected.
|
||||
tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts(7,32): error TS1109: Expression expected.
|
||||
tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts(6,5): error TS2322: Type 'number' is not assignable to type 'ArrayConstructor'.
|
||||
Property 'isArray' is missing in type 'Number'.
|
||||
tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts(6,22): error TS1005: '=' expected.
|
||||
tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts(6,30): error TS1109: Expression expected.
|
||||
tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts(7,5): error TS2322: Type 'number' is not assignable to type 'ArrayConstructor'.
|
||||
tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts(7,22): error TS1005: '=' expected.
|
||||
tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts(7,32): error TS1109: Expression expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts (6 errors) ====
|
||||
@@ -14,17 +14,17 @@ tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts(
|
||||
var xs: typeof x[]; // Not an error. This is equivalent to Array<typeof x>
|
||||
var xs2: typeof Array;
|
||||
var xs3: typeof Array<number>;
|
||||
~~~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'ArrayConstructor'.
|
||||
!!! error TS2322: Property 'isArray' is missing in type 'Number'.
|
||||
~
|
||||
!!! error TS1005: '=' expected.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
var xs4: typeof Array<typeof x>;
|
||||
~~~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'ArrayConstructor'.
|
||||
!!! error TS2322: Property 'isArray' is missing in type 'Number'.
|
||||
var xs4: typeof Array<typeof x>;
|
||||
~
|
||||
!!! error TS1005: '=' expected.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'ArrayConstructor'.
|
||||
!!! error TS1109: Expression expected.
|
||||
@@ -19,9 +19,9 @@ tests/cases/compiler/arrowFunctionsMissingTokens.ts(41,5): error TS1128: Declara
|
||||
tests/cases/compiler/arrowFunctionsMissingTokens.ts(42,1): error TS1128: Declaration or statement expected.
|
||||
tests/cases/compiler/arrowFunctionsMissingTokens.ts(45,14): error TS1109: Expression expected.
|
||||
tests/cases/compiler/arrowFunctionsMissingTokens.ts(47,21): error TS1005: '=>' expected.
|
||||
tests/cases/compiler/arrowFunctionsMissingTokens.ts(49,14): error TS2304: Cannot find name 'x'.
|
||||
tests/cases/compiler/arrowFunctionsMissingTokens.ts(51,35): error TS1005: '=>' expected.
|
||||
tests/cases/compiler/arrowFunctionsMissingTokens.ts(53,41): error TS1005: '=>' expected.
|
||||
tests/cases/compiler/arrowFunctionsMissingTokens.ts(49,14): error TS2304: Cannot find name 'x'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/arrowFunctionsMissingTokens.ts (24 errors) ====
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/assertInWrapSomeTypeParameter.ts(2,26): error TS1005: '>' expected.
|
||||
tests/cases/compiler/assertInWrapSomeTypeParameter.ts(1,9): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
||||
tests/cases/compiler/assertInWrapSomeTypeParameter.ts(2,26): error TS1005: '>' expected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/assertInWrapSomeTypeParameter.ts (2 errors) ====
|
||||
|
||||
@@ -1,9 +1,3 @@
|
||||
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(35,9): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(42,36): error TS1034: 'super' must be followed by an argument list or member access.
|
||||
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(44,19): error TS1034: 'super' must be followed by an argument list or member access.
|
||||
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(46,27): error TS1034: 'super' must be followed by an argument list or member access.
|
||||
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(50,20): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(51,11): error TS1005: ';' expected.
|
||||
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(6,21): error TS2364: Invalid left-hand side of assignment expression.
|
||||
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(7,13): error TS2364: Invalid left-hand side of assignment expression.
|
||||
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(8,21): error TS2364: Invalid left-hand side of assignment expression.
|
||||
@@ -19,8 +13,14 @@ tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(2
|
||||
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(30,1): error TS2364: Invalid left-hand side of assignment expression.
|
||||
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(31,1): error TS2364: Invalid left-hand side of assignment expression.
|
||||
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(32,1): error TS2364: Invalid left-hand side of assignment expression.
|
||||
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(35,9): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(38,2): error TS2364: Invalid left-hand side of assignment expression.
|
||||
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(38,6): error TS2364: Invalid left-hand side of assignment expression.
|
||||
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(42,36): error TS1034: 'super' must be followed by an argument list or member access.
|
||||
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(44,19): error TS1034: 'super' must be followed by an argument list or member access.
|
||||
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(46,27): error TS1034: 'super' must be followed by an argument list or member access.
|
||||
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(50,20): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(51,11): error TS1005: ';' expected.
|
||||
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(54,1): error TS2364: Invalid left-hand side of assignment expression.
|
||||
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(57,1): error TS2364: Invalid left-hand side of assignment expression.
|
||||
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(58,1): error TS2364: Invalid left-hand side of assignment expression.
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
tests/cases/compiler/autoLift2.ts(5,17): error TS1005: ';' expected.
|
||||
tests/cases/compiler/autoLift2.ts(6,17): error TS1005: ';' expected.
|
||||
tests/cases/compiler/autoLift2.ts(5,14): error TS2339: Property 'foo' does not exist on type 'A'.
|
||||
tests/cases/compiler/autoLift2.ts(5,17): error TS1005: ';' expected.
|
||||
tests/cases/compiler/autoLift2.ts(5,19): error TS2304: Cannot find name 'any'.
|
||||
tests/cases/compiler/autoLift2.ts(6,14): error TS2339: Property 'bar' does not exist on type 'A'.
|
||||
tests/cases/compiler/autoLift2.ts(6,17): error TS1005: ';' expected.
|
||||
tests/cases/compiler/autoLift2.ts(6,19): error TS2304: Cannot find name 'any'.
|
||||
tests/cases/compiler/autoLift2.ts(12,11): error TS2339: Property 'foo' does not exist on type 'A'.
|
||||
tests/cases/compiler/autoLift2.ts(14,11): error TS2339: Property 'bar' does not exist on type 'A'.
|
||||
@@ -16,17 +16,17 @@ tests/cases/compiler/autoLift2.ts(18,33): error TS2339: Property 'bar' does not
|
||||
{
|
||||
constructor() {
|
||||
this.foo: any;
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~
|
||||
!!! error TS2339: Property 'foo' does not exist on type 'A'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'any'.
|
||||
this.bar: any;
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~
|
||||
!!! error TS2339: Property 'bar' does not exist on type 'A'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'any'.
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
tests/cases/compiler/bases.ts(7,15): error TS1005: ';' expected.
|
||||
tests/cases/compiler/bases.ts(13,15): error TS1005: ';' expected.
|
||||
tests/cases/compiler/bases.ts(7,14): error TS2339: Property 'y' does not exist on type 'B'.
|
||||
tests/cases/compiler/bases.ts(7,15): error TS1005: ';' expected.
|
||||
tests/cases/compiler/bases.ts(7,17): error TS2304: Cannot find name 'any'.
|
||||
tests/cases/compiler/bases.ts(11,7): error TS2420: Class 'C' incorrectly implements interface 'I'.
|
||||
Property 'x' is missing in type 'C'.
|
||||
tests/cases/compiler/bases.ts(12,5): error TS2377: Constructors for derived classes must contain a 'super' call.
|
||||
tests/cases/compiler/bases.ts(13,14): error TS2339: Property 'x' does not exist on type 'C'.
|
||||
tests/cases/compiler/bases.ts(13,15): error TS1005: ';' expected.
|
||||
tests/cases/compiler/bases.ts(13,17): error TS2304: Cannot find name 'any'.
|
||||
tests/cases/compiler/bases.ts(17,9): error TS2339: Property 'x' does not exist on type 'C'.
|
||||
tests/cases/compiler/bases.ts(18,9): error TS2339: Property 'y' does not exist on type 'C'.
|
||||
@@ -19,10 +19,10 @@ tests/cases/compiler/bases.ts(18,9): error TS2339: Property 'y' does not exist o
|
||||
class B {
|
||||
constructor() {
|
||||
this.y: any;
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~
|
||||
!!! error TS2339: Property 'y' does not exist on type 'B'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'any'.
|
||||
}
|
||||
@@ -35,11 +35,11 @@ tests/cases/compiler/bases.ts(18,9): error TS2339: Property 'y' does not exist o
|
||||
constructor() {
|
||||
~~~~~~~~~~~~~~~
|
||||
this.x: any;
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! error TS2339: Property 'x' does not exist on type 'C'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'any'.
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
tests/cases/compiler/callExpressionWithMissingTypeArgument1.ts(1,7): error TS1110: Type expected.
|
||||
tests/cases/compiler/callExpressionWithMissingTypeArgument1.ts(1,1): error TS2304: Cannot find name 'Foo'.
|
||||
tests/cases/compiler/callExpressionWithMissingTypeArgument1.ts(1,7): error TS1110: Type expected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/callExpressionWithMissingTypeArgument1.ts (2 errors) ====
|
||||
Foo<a,,b>();
|
||||
~
|
||||
!!! error TS1110: Type expected.
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'Foo'.
|
||||
!!! error TS2304: Cannot find name 'Foo'.
|
||||
~
|
||||
!!! error TS1110: Type expected.
|
||||
@@ -1,7 +1,7 @@
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts(20,15): error TS1005: '{' expected.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts(4,14): error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts(11,9): error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts(20,5): error TS2300: Duplicate identifier 'foo'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts(20,15): error TS1005: '{' expected.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts(21,5): error TS2300: Duplicate identifier 'foo'.
|
||||
|
||||
|
||||
@@ -30,10 +30,10 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWit
|
||||
|
||||
var b = {
|
||||
foo(x = 1), // error
|
||||
~
|
||||
!!! error TS1005: '{' expected.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'foo'.
|
||||
~
|
||||
!!! error TS1005: '{' expected.
|
||||
foo(x = 1) { }, // error
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'foo'.
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
tests/cases/conformance/classes/classExpression.ts(1,9): error TS1109: Expression expected.
|
||||
tests/cases/conformance/classes/classExpression.ts(5,10): error TS1109: Expression expected.
|
||||
tests/cases/conformance/classes/classExpression.ts(5,16): error TS1005: ':' expected.
|
||||
tests/cases/conformance/classes/classExpression.ts(5,16): error TS2304: Cannot find name 'C2'.
|
||||
tests/cases/conformance/classes/classExpression.ts(5,19): error TS1005: ',' expected.
|
||||
tests/cases/conformance/classes/classExpression.ts(7,1): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/classes/classExpression.ts(10,13): error TS1109: Expression expected.
|
||||
tests/cases/conformance/classes/classExpression.ts(5,16): error TS2304: Cannot find name 'C2'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/classExpression.ts (7 errors) ====
|
||||
@@ -19,10 +19,10 @@ tests/cases/conformance/classes/classExpression.ts(5,16): error TS2304: Cannot f
|
||||
!!! error TS1109: Expression expected.
|
||||
~~
|
||||
!!! error TS1005: ':' expected.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~~
|
||||
!!! error TS2304: Cannot find name 'C2'.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
}
|
||||
}
|
||||
~
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(7,19): error TS1133: Type reference expected.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(9,19): error TS1133: Type reference expected.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(9,24): error TS1005: ';' expected.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(3,17): error TS2304: Cannot find name 'number'.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(4,18): error TS2304: Cannot find name 'string'.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(5,18): error TS2304: Cannot find name 'boolean'.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(6,18): error TS2304: Cannot find name 'Void'.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(7,19): error TS1133: Type reference expected.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(8,18): error TS2304: Cannot find name 'Null'.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(9,19): error TS1133: Type reference expected.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(9,24): error TS1005: ';' expected.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(10,18): error TS2304: Cannot find name 'undefined'.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(11,18): error TS2304: Cannot find name 'Undefined'.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(14,18): error TS2311: A class may only extend another class.
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(16,18): error TS1133: Type reference expected.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(16,20): error TS1005: ';' expected.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(4,17): error TS2311: A class may only extend another class.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(8,18): error TS2304: Cannot find name 'x'.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(11,18): error TS2304: Cannot find name 'M'.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(14,18): error TS2304: Cannot find name 'foo'.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(16,18): error TS1133: Type reference expected.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(16,20): error TS1005: ';' expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts (6 errors) ====
|
||||
|
||||
@@ -1,9 +1,3 @@
|
||||
tests/cases/compiler/classUpdateTests.ts(93,3): error TS1129: Statement expected.
|
||||
tests/cases/compiler/classUpdateTests.ts(95,1): error TS1128: Declaration or statement expected.
|
||||
tests/cases/compiler/classUpdateTests.ts(99,3): error TS1129: Statement expected.
|
||||
tests/cases/compiler/classUpdateTests.ts(101,1): error TS1128: Declaration or statement expected.
|
||||
tests/cases/compiler/classUpdateTests.ts(105,3): error TS1129: Statement expected.
|
||||
tests/cases/compiler/classUpdateTests.ts(111,3): error TS1129: Statement expected.
|
||||
tests/cases/compiler/classUpdateTests.ts(34,2): error TS2377: Constructors for derived classes must contain a 'super' call.
|
||||
tests/cases/compiler/classUpdateTests.ts(43,18): error TS2335: 'super' can only be referenced in a derived class.
|
||||
tests/cases/compiler/classUpdateTests.ts(46,17): error TS2311: A class may only extend another class.
|
||||
@@ -14,7 +8,13 @@ tests/cases/compiler/classUpdateTests.ts(63,7): error TS2415: Class 'L' incorrec
|
||||
tests/cases/compiler/classUpdateTests.ts(69,7): error TS2415: Class 'M' incorrectly extends base class 'G'.
|
||||
Property 'p1' is private in type 'M' but not in type 'G'.
|
||||
tests/cases/compiler/classUpdateTests.ts(70,2): error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.
|
||||
tests/cases/compiler/classUpdateTests.ts(93,3): error TS1129: Statement expected.
|
||||
tests/cases/compiler/classUpdateTests.ts(95,1): error TS1128: Declaration or statement expected.
|
||||
tests/cases/compiler/classUpdateTests.ts(99,3): error TS1129: Statement expected.
|
||||
tests/cases/compiler/classUpdateTests.ts(101,1): error TS1128: Declaration or statement expected.
|
||||
tests/cases/compiler/classUpdateTests.ts(105,3): error TS1129: Statement expected.
|
||||
tests/cases/compiler/classUpdateTests.ts(105,15): error TS2339: Property 'p1' does not exist on type 'Q'.
|
||||
tests/cases/compiler/classUpdateTests.ts(111,3): error TS1129: Statement expected.
|
||||
tests/cases/compiler/classUpdateTests.ts(111,16): error TS2339: Property 'p1' does not exist on type 'R'.
|
||||
|
||||
|
||||
|
||||
@@ -1,15 +1,3 @@
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(58,9): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(59,9): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(69,15): error TS1034: 'super' must be followed by an argument list or member access.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(70,15): error TS1034: 'super' must be followed by an argument list or member access.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(74,15): error TS1034: 'super' must be followed by an argument list or member access.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(75,15): error TS1034: 'super' must be followed by an argument list or member access.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(79,15): error TS1034: 'super' must be followed by an argument list or member access.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(80,15): error TS1034: 'super' must be followed by an argument list or member access.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(85,21): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(86,21): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(87,11): error TS1005: ';' expected.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(88,11): error TS1005: ';' expected.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(7,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(8,9): error TS2364: Invalid left-hand side of assignment expression.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(11,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
@@ -40,8 +28,20 @@ tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsVa
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(53,1): error TS2364: Invalid left-hand side of assignment expression.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(54,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(55,1): error TS2364: Invalid left-hand side of assignment expression.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(58,9): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(59,9): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(62,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(63,1): error TS2364: Invalid left-hand side of assignment expression.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(69,15): error TS1034: 'super' must be followed by an argument list or member access.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(70,15): error TS1034: 'super' must be followed by an argument list or member access.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(74,15): error TS1034: 'super' must be followed by an argument list or member access.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(75,15): error TS1034: 'super' must be followed by an argument list or member access.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(79,15): error TS1034: 'super' must be followed by an argument list or member access.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(80,15): error TS1034: 'super' must be followed by an argument list or member access.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(85,21): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(86,21): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(87,11): error TS1005: ';' expected.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(88,11): error TS1005: ';' expected.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(91,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(92,1): error TS2364: Invalid left-hand side of assignment expression.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(95,1): error TS2364: Invalid left-hand side of assignment expression.
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
tests/cases/compiler/conflictMarkerTrivia1.ts(2,1): error TS1184: Merge conflict marker encountered.
|
||||
tests/cases/compiler/conflictMarkerTrivia1.ts(3,5): error TS2300: Duplicate identifier 'v'.
|
||||
tests/cases/compiler/conflictMarkerTrivia1.ts(4,1): error TS1184: Merge conflict marker encountered.
|
||||
tests/cases/compiler/conflictMarkerTrivia1.ts(5,5): error TS2300: Duplicate identifier 'v'.
|
||||
tests/cases/compiler/conflictMarkerTrivia1.ts(6,1): error TS1184: Merge conflict marker encountered.
|
||||
|
||||
|
||||
==== tests/cases/compiler/conflictMarkerTrivia1.ts (5 errors) ====
|
||||
class C {
|
||||
<<<<<<< HEAD
|
||||
|
||||
!!! error TS1184: Merge conflict marker encountered.
|
||||
v = 1;
|
||||
~
|
||||
!!! error TS2300: Duplicate identifier 'v'.
|
||||
=======
|
||||
|
||||
!!! error TS1184: Merge conflict marker encountered.
|
||||
v = 2;
|
||||
~
|
||||
!!! error TS2300: Duplicate identifier 'v'.
|
||||
>>>>>>> Branch-a
|
||||
|
||||
!!! error TS1184: Merge conflict marker encountered.
|
||||
}
|
||||
@@ -2,12 +2,12 @@ tests/cases/compiler/constDeclarations-invalidContexts.ts(4,5): error TS1156: 'c
|
||||
tests/cases/compiler/constDeclarations-invalidContexts.ts(6,5): error TS1156: 'const' declarations can only be declared inside a block.
|
||||
tests/cases/compiler/constDeclarations-invalidContexts.ts(9,5): error TS1156: 'const' declarations can only be declared inside a block.
|
||||
tests/cases/compiler/constDeclarations-invalidContexts.ts(12,5): error TS1156: 'const' declarations can only be declared inside a block.
|
||||
tests/cases/compiler/constDeclarations-invalidContexts.ts(16,7): error TS2410: All symbols within a 'with' block will be resolved to 'any'.
|
||||
tests/cases/compiler/constDeclarations-invalidContexts.ts(17,5): error TS1156: 'const' declarations can only be declared inside a block.
|
||||
tests/cases/compiler/constDeclarations-invalidContexts.ts(20,5): error TS1156: 'const' declarations can only be declared inside a block.
|
||||
tests/cases/compiler/constDeclarations-invalidContexts.ts(23,5): error TS1156: 'const' declarations can only be declared inside a block.
|
||||
tests/cases/compiler/constDeclarations-invalidContexts.ts(26,12): error TS1156: 'const' declarations can only be declared inside a block.
|
||||
tests/cases/compiler/constDeclarations-invalidContexts.ts(29,29): error TS1156: 'const' declarations can only be declared inside a block.
|
||||
tests/cases/compiler/constDeclarations-invalidContexts.ts(16,7): error TS2410: All symbols within a 'with' block will be resolved to 'any'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/constDeclarations-invalidContexts.ts (10 errors) ====
|
||||
|
||||
@@ -1,87 +1,87 @@
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(11,1): error TS2304: Cannot find name 'module'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(11,19): error TS1005: ';' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(22,35): error TS1005: ')' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(22,39): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(24,28): error TS1005: ':' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(24,29): error TS1005: ',' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(27,18): error TS1129: Statement expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(27,26): error TS2304: Cannot find name 'bfs'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(28,30): error TS1005: '=' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(31,18): error TS1109: Expression expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(34,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(34,26): error TS1005: ';' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(34,28): error TS2304: Cannot find name 'bfs'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(35,21): error TS2365: Operator '!=' cannot be applied to types 'boolean' and 'number'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(38,17): error TS1109: Expression expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(40,28): error TS2304: Cannot find name 'bfs'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(40,41): error TS1005: ';' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(40,45): error TS1002: Unterminated string literal.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(41,21): error TS2365: Operator '!=' cannot be applied to types 'boolean' and 'number'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(47,17): error TS2304: Cannot find name 'console'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(49,13): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(53,13): error TS2304: Cannot find name 'console'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(58,5): error TS1128: Declaration or statement expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(69,13): error TS1109: Expression expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(72,37): error TS1127: Invalid character.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(81,13): error TS1109: Expression expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(89,23): error TS2364: Invalid left-hand side of assignment expression.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(90,13): error TS1109: Expression expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(105,29): error TS1109: Expression expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(106,13): error TS1109: Expression expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(108,24): error TS2365: Operator '+' cannot be applied to types 'number' and 'boolean'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(138,13): error TS1109: Expression expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(141,32): error TS1005: '{' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(143,13): error TS1005: 'try' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(159,24): error TS1109: Expression expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(159,30): error TS1005: '(' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(205,28): error TS1109: Expression expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(218,10): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(218,36): error TS1005: ';' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(227,13): error TS1109: Expression expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(234,14): error TS1005: '{' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(235,9): error TS1128: Declaration or statement expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(235,27): error TS1005: ',' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(235,36): error TS1005: ';' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(238,9): error TS1128: Declaration or statement expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(238,26): error TS1005: ';' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(241,5): error TS1128: Declaration or statement expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(254,69): error TS1110: Type expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(256,9): error TS1128: Declaration or statement expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(256,31): error TS1005: ',' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,9): error TS1128: Declaration or statement expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,27): error TS1135: Argument expression expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,33): error TS1005: '(' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,43): error TS1109: Expression expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,60): error TS1005: ';' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,65): error TS1109: Expression expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,16): error TS1005: ';' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,35): error TS1109: Expression expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,55): error TS1005: ';' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS1128: Declaration or statement expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(11,1): error TS2304: Cannot find name 'module'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(22,39): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(27,26): error TS2304: Cannot find name 'bfs'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(34,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(34,28): error TS2304: Cannot find name 'bfs'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(35,21): error TS2365: Operator '!=' cannot be applied to types 'boolean' and 'number'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(40,28): error TS2304: Cannot find name 'bfs'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(41,21): error TS2365: Operator '!=' cannot be applied to types 'boolean' and 'number'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(47,17): error TS2304: Cannot find name 'console'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(53,13): error TS2304: Cannot find name 'console'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(89,23): error TS2364: Invalid left-hand side of assignment expression.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(108,24): error TS2365: Operator '+' cannot be applied to types 'number' and 'boolean'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(159,31): error TS2304: Cannot find name 'Property'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(166,13): error TS2365: Operator '+=' cannot be applied to types 'number' and 'void'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(180,40): error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(205,28): error TS1109: Expression expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(213,16): error TS2304: Cannot find name 'bool'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(218,10): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(218,29): error TS2304: Cannot find name 'yield'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(218,36): error TS1005: ';' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(223,23): error TS2304: Cannot find name 'bool'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(227,13): error TS1109: Expression expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(234,14): error TS1005: '{' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(235,9): error TS1128: Declaration or statement expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(235,16): error TS2304: Cannot find name 'method1'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(235,24): error TS2304: Cannot find name 'val'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(235,27): error TS1005: ',' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(235,28): error TS2304: Cannot find name 'number'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(235,36): error TS1005: ';' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(238,9): error TS1128: Declaration or statement expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(238,16): error TS2304: Cannot find name 'method2'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(238,26): error TS1005: ';' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(241,5): error TS1128: Declaration or statement expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(246,25): error TS2339: Property 'method1' does not exist on type 'B'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(254,9): error TS2390: Constructor implementation is missing.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(254,21): error TS2369: A parameter property is only allowed in a constructor implementation.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(254,44): error TS2369: A parameter property is only allowed in a constructor implementation.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(254,69): error TS1110: Type expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(256,9): error TS1128: Declaration or statement expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(256,16): error TS2304: Cannot find name 'Overloads'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(256,26): error TS2304: Cannot find name 'value'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(256,31): error TS1005: ',' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(256,33): error TS2304: Cannot find name 'string'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,9): error TS1128: Declaration or statement expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,16): error TS2304: Cannot find name 'Overloads'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,27): error TS1135: Argument expression expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,33): error TS1005: '(' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,35): error TS2304: Cannot find name 'string'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,43): error TS1109: Expression expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,52): error TS2304: Cannot find name 'string'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,60): error TS1005: ';' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,65): error TS1109: Expression expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,9): error TS2304: Cannot find name 'public'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,16): error TS1005: ';' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,16): error TS2304: Cannot find name 'DefaultValue'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,29): error TS2304: Cannot find name 'value'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,35): error TS1109: Expression expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,37): error TS2304: Cannot find name 'string'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,55): error TS1005: ';' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS1128: Declaration or statement expected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts (84 errors) ====
|
||||
@@ -96,10 +96,10 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,37): error T
|
||||
}
|
||||
|
||||
import fs = module("fs");
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'module'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
|
||||
|
||||
module TypeScriptAllInOne {
|
||||
@@ -117,11 +117,11 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,37): error T
|
||||
|
||||
|
||||
return 1;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! error TS1005: ':' expected.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
}
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
@@ -142,10 +142,10 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,37): error T
|
||||
|
||||
|
||||
retValue = bfs.TYPES();
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~~~~~
|
||||
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'bfs'.
|
||||
if (retValue != 0) {
|
||||
@@ -158,12 +158,12 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,37): error T
|
||||
!!! error TS1109: Expression expected.
|
||||
|
||||
retValue = bfs.OPERATOR ' );
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'bfs'.
|
||||
~~~~
|
||||
!!! error TS1005: ';' expected.
|
||||
|
||||
!!! error TS1002: Unterminated string literal.
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'bfs'.
|
||||
if (retValue != 0) {
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '!=' cannot be applied to types 'boolean' and 'number'.
|
||||
@@ -390,10 +390,10 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,37): error T
|
||||
case d = () => { yield 0; };
|
||||
~~~~
|
||||
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'yield'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
public get Property() { return 0; }
|
||||
public Member() {
|
||||
return 0;
|
||||
@@ -419,25 +419,25 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,37): error T
|
||||
public method1(val:number) {
|
||||
~~~~~~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'method1'.
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'val'.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'number'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
return val;
|
||||
}
|
||||
public method2() {
|
||||
~~~~~~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'method2'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
return 2 * this.method1(2);
|
||||
}
|
||||
}
|
||||
@@ -458,61 +458,61 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,37): error T
|
||||
private otherValue = 42;
|
||||
|
||||
constructor(private value: number, public name: string) : }
|
||||
~
|
||||
!!! error TS1110: Type expected.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2390: Constructor implementation is missing.
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2369: A parameter property is only allowed in a constructor implementation.
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2369: A parameter property is only allowed in a constructor implementation.
|
||||
~
|
||||
!!! error TS1110: Type expected.
|
||||
|
||||
public Overloads(value: string);
|
||||
~~~~~~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'Overloads'.
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'value'.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'string'.
|
||||
public Overloads( while : string, ...rest: string[]) { &
|
||||
~~~~~~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
~~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'Overloads'.
|
||||
~~~~~
|
||||
!!! error TS1135: Argument expression expected.
|
||||
~
|
||||
!!! error TS1005: '(' expected.
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'string'.
|
||||
~~~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'string'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'Overloads'.
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'string'.
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'string'.
|
||||
|
||||
public DefaultValue(value?: string = "Hello") { }
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS1005: ';' expected.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'public'.
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'DefaultValue'.
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'value'.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'string'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
}
|
||||
}
|
||||
~
|
||||
|
||||
@@ -195,12 +195,12 @@ function f4() {
|
||||
var z;
|
||||
}
|
||||
function f6() {
|
||||
var _a = [1, "hello"], _b = _a[0], x = _b === void0 ? 0 : _b, _c = _a[1], y = _c === void0 ? "" : _c;
|
||||
var _a = [1, "hello"], _b = _a[0], x = _b === void 0 ? 0 : _b, _c = _a[1], y = _c === void 0 ? "" : _c;
|
||||
var x;
|
||||
var y;
|
||||
}
|
||||
function f7() {
|
||||
var _a = [1, "hello"], _b = _a[0], x = _b === void0 ? 0 : _b, _c = _a[1], y = _c === void0 ? 1 : _c; // Error, initializer for y must be string
|
||||
var _a = [1, "hello"], _b = _a[0], x = _b === void 0 ? 0 : _b, _c = _a[1], y = _c === void 0 ? 1 : _c; // Error, initializer for y must be string
|
||||
var x;
|
||||
var y;
|
||||
}
|
||||
@@ -226,7 +226,7 @@ function f11() {
|
||||
var b;
|
||||
}
|
||||
function f12() {
|
||||
var _a = [1, ["hello", { x: 5, y: true }]], a = _a[0], _b = _a[1], _c = _b === void0 ? ["abc", { x: 10, y: false }] : _b, b = _c[0], _d = _c[1], x = _d.x, c = _d.y;
|
||||
var _a = [1, ["hello", { x: 5, y: true }]], a = _a[0], _b = _a[1], _c = _b === void 0 ? ["abc", { x: 10, y: false }] : _b, b = _c[0], _d = _c[1], x = _d.x, c = _d.y;
|
||||
var a;
|
||||
var b;
|
||||
var x;
|
||||
@@ -237,7 +237,7 @@ function f13() {
|
||||
var _b = [[x, y], { x: x, y: y }], a = _b[0], b = _b[1];
|
||||
}
|
||||
function f14(_a) {
|
||||
var _b = _a[0], a = _b === void0 ? 1 : _b, _c = _a[1], _d = _c[0], b = _d === void0 ? "hello" : _d, _e = _c[1], x = _e.x, _f = _e.y, c = _f === void0 ? false : _f;
|
||||
var _b = _a[0], a = _b === void 0 ? 1 : _b, _c = _a[1], _d = _c[0], b = _d === void 0 ? "hello" : _d, _e = _c[1], x = _e.x, _f = _e.y, c = _f === void 0 ? false : _f;
|
||||
var a;
|
||||
var b;
|
||||
var c;
|
||||
@@ -260,7 +260,7 @@ function f16() {
|
||||
var _a = f15(), a = _a.a, b = _a.b, c = _a.c;
|
||||
}
|
||||
function f17(_a) {
|
||||
var _b = _a.a, a = _b === void0 ? "" : _b, _c = _a.b, b = _c === void0 ? 0 : _c, _d = _a.c, c = _d === void0 ? false : _d;
|
||||
var _b = _a.a, a = _b === void 0 ? "" : _b, _c = _a.b, b = _c === void 0 ? 0 : _c, _d = _a.c, c = _d === void 0 ? false : _d;
|
||||
}
|
||||
f17({});
|
||||
f17({ a: "hello" });
|
||||
@@ -274,7 +274,7 @@ function g4() {
|
||||
(_b = { b: b, a: a }, a = _b.a, b = _b.b, _b);
|
||||
_c = [a, b], aa[0] = _c[0], b = _c[1];
|
||||
_d = [b, a], a = _d[0], b = _d[1]; // Error
|
||||
_e = [2, "def"], _f = _e[0], a = _f === void0 ? 1 : _f, _g = _e[1], b = _g === void0 ? "abc" : _g;
|
||||
_e = [2, "def"], _f = _e[0], a = _f === void 0 ? 1 : _f, _g = _e[1], b = _g === void 0 ? "abc" : _g;
|
||||
var _a, _b, _c, _d, _e, _f, _g;
|
||||
}
|
||||
function g5() {
|
||||
@@ -282,7 +282,7 @@ function g5() {
|
||||
_a = [1, 2], a = _a[0], b = _a[1];
|
||||
_b = [b, a], a = _b[0], b = _b[1];
|
||||
(_c = { b: b, a: a }, a = _c.a, b = _c.b, _c);
|
||||
_d = ([[2, 3]])[0], _e = _d === void0 ? [1, 2] : _d, a = _e[0], b = _e[1];
|
||||
_d = ([[2, 3]])[0], _e = _d === void 0 ? [1, 2] : _d, a = _e[0], b = _e[1];
|
||||
var x = (_f = [1, 2], a = _f[0], b = _f[1], _f);
|
||||
var _a, _b, _c, _d, _e, _f;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(8,8): error TS1110: Type expected.
|
||||
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(20,15): error TS1110: Type expected.
|
||||
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(8,8): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(10,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(13,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(17,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(20,15): error TS1110: Type expected.
|
||||
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(20,15): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(22,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(25,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
tests/cases/compiler/dontShowCompilerGeneratedMembers.ts(3,6): error TS1139: Type parameter declaration expected.
|
||||
tests/cases/compiler/dontShowCompilerGeneratedMembers.ts(4,1): error TS1109: Expression expected.
|
||||
tests/cases/compiler/dontShowCompilerGeneratedMembers.ts(1,5): error TS2322: Type 'number' is not assignable to type '{ (): any; x: number; }'.
|
||||
Property 'x' is missing in type 'Number'.
|
||||
tests/cases/compiler/dontShowCompilerGeneratedMembers.ts(3,6): error TS1139: Type parameter declaration expected.
|
||||
tests/cases/compiler/dontShowCompilerGeneratedMembers.ts(4,1): error TS1109: Expression expected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/dontShowCompilerGeneratedMembers.ts (3 errors) ====
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/dottedModuleName.ts(3,29): error TS1144: '{' or ';' expected.
|
||||
tests/cases/compiler/dottedModuleName.ts(3,18): error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
tests/cases/compiler/dottedModuleName.ts(3,29): error TS1144: '{' or ';' expected.
|
||||
tests/cases/compiler/dottedModuleName.ts(3,33): error TS2304: Cannot find name 'x'.
|
||||
|
||||
|
||||
@@ -7,10 +7,10 @@ tests/cases/compiler/dottedModuleName.ts(3,33): error TS2304: Cannot find name '
|
||||
module M {
|
||||
export module N {
|
||||
export function f(x:number)=>2*x;
|
||||
~~
|
||||
!!! error TS1144: '{' or ';' expected.
|
||||
~
|
||||
!!! error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
~~
|
||||
!!! error TS1144: '{' or ';' expected.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'x'.
|
||||
export module X.Y.Z {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/enumConflictsWithGlobalIdentifier.ts(4,29): error TS1003: Identifier expected.
|
||||
tests/cases/compiler/enumConflictsWithGlobalIdentifier.ts(4,9): error TS2304: Cannot find name 'IgnoreRulesSpecific'.
|
||||
tests/cases/compiler/enumConflictsWithGlobalIdentifier.ts(4,29): error TS1003: Identifier expected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/enumConflictsWithGlobalIdentifier.ts (2 errors) ====
|
||||
@@ -7,9 +7,9 @@ tests/cases/compiler/enumConflictsWithGlobalIdentifier.ts(4,9): error TS2304: Ca
|
||||
IgnoreRulesSpecific = 0,
|
||||
}
|
||||
var x = IgnoreRulesSpecific.
|
||||
|
||||
!!! error TS1003: Identifier expected.
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'IgnoreRulesSpecific'.
|
||||
|
||||
!!! error TS1003: Identifier expected.
|
||||
var y = Position.IgnoreRulesSpecific;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/enumMemberResolution.ts(4,29): error TS1003: Identifier expected.
|
||||
tests/cases/compiler/enumMemberResolution.ts(4,9): error TS2304: Cannot find name 'IgnoreRulesSpecific'.
|
||||
tests/cases/compiler/enumMemberResolution.ts(4,29): error TS1003: Identifier expected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/enumMemberResolution.ts (2 errors) ====
|
||||
@@ -7,10 +7,10 @@ tests/cases/compiler/enumMemberResolution.ts(4,9): error TS2304: Cannot find nam
|
||||
IgnoreRulesSpecific = 0
|
||||
}
|
||||
var x = IgnoreRulesSpecific. // error
|
||||
|
||||
!!! error TS1003: Identifier expected.
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'IgnoreRulesSpecific'.
|
||||
|
||||
!!! error TS1003: Identifier expected.
|
||||
var y = 1;
|
||||
var z = Position2.IgnoreRulesSpecific; // no error
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(46,14): error TS1034: 'super' must be followed by an argument list or member access.
|
||||
tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(4,9): error TS2335: 'super' can only be referenced in a derived class.
|
||||
tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(9,9): error TS2335: 'super' can only be referenced in a derived class.
|
||||
tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(14,9): error TS2335: 'super' can only be referenced in a derived class.
|
||||
@@ -8,6 +7,7 @@ tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(26,9): error T
|
||||
tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(30,16): error TS2335: 'super' can only be referenced in a derived class.
|
||||
tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(34,9): error TS2335: 'super' can only be referenced in a derived class.
|
||||
tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(38,9): error TS2335: 'super' can only be referenced in a derived class.
|
||||
tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(46,14): error TS1034: 'super' must be followed by an argument list or member access.
|
||||
tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(58,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(62,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(67,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
tests/cases/compiler/es6ClassTest9.ts(1,15): error TS2300: Duplicate identifier 'foo'.
|
||||
tests/cases/compiler/es6ClassTest9.ts(1,18): error TS1005: '{' expected.
|
||||
tests/cases/compiler/es6ClassTest9.ts(1,19): error TS1109: Expression expected.
|
||||
tests/cases/compiler/es6ClassTest9.ts(1,15): error TS2300: Duplicate identifier 'foo'.
|
||||
tests/cases/compiler/es6ClassTest9.ts(2,10): error TS2300: Duplicate identifier 'foo'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/es6ClassTest9.ts (4 errors) ====
|
||||
declare class foo();
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'foo'.
|
||||
~
|
||||
!!! error TS1005: '{' expected.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'foo'.
|
||||
function foo() {}
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'foo'.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
tests/cases/compiler/extension.ts(16,5): error TS1128: Declaration or statement expected.
|
||||
tests/cases/compiler/extension.ts(16,22): error TS1005: ';' expected.
|
||||
tests/cases/compiler/extension.ts(10,18): error TS2300: Duplicate identifier 'C'.
|
||||
tests/cases/compiler/extension.ts(16,5): error TS1128: Declaration or statement expected.
|
||||
tests/cases/compiler/extension.ts(16,12): error TS2304: Cannot find name 'extension'.
|
||||
tests/cases/compiler/extension.ts(16,22): error TS1005: ';' expected.
|
||||
tests/cases/compiler/extension.ts(16,28): error TS2300: Duplicate identifier 'C'.
|
||||
tests/cases/compiler/extension.ts(22,3): error TS2339: Property 'pe' does not exist on type 'C'.
|
||||
|
||||
@@ -27,10 +27,10 @@ tests/cases/compiler/extension.ts(22,3): error TS2339: Property 'pe' does not ex
|
||||
export extension class C {
|
||||
~~~~~~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
~~~~~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'extension'.
|
||||
~~~~~
|
||||
!!! error TS1005: ';' expected.
|
||||
~
|
||||
!!! error TS2300: Duplicate identifier 'C'.
|
||||
public pe:string;
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
tests/cases/compiler/externModule.ts(1,1): error TS2304: Cannot find name 'declare'.
|
||||
tests/cases/compiler/externModule.ts(1,9): error TS1005: ';' expected.
|
||||
tests/cases/compiler/externModule.ts(1,9): error TS2304: Cannot find name 'module'.
|
||||
tests/cases/compiler/externModule.ts(1,16): error TS1005: ';' expected.
|
||||
tests/cases/compiler/externModule.ts(2,5): error TS1129: Statement expected.
|
||||
tests/cases/compiler/externModule.ts(2,18): error TS1148: Cannot compile external modules unless the '--module' flag is provided.
|
||||
tests/cases/compiler/externModule.ts(30,1): error TS1128: Declaration or statement expected.
|
||||
tests/cases/compiler/externModule.ts(1,1): error TS2304: Cannot find name 'declare'.
|
||||
tests/cases/compiler/externModule.ts(1,9): error TS2304: Cannot find name 'module'.
|
||||
tests/cases/compiler/externModule.ts(3,10): error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
tests/cases/compiler/externModule.ts(4,10): error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
tests/cases/compiler/externModule.ts(18,6): error TS2390: Constructor implementation is missing.
|
||||
tests/cases/compiler/externModule.ts(20,13): error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
tests/cases/compiler/externModule.ts(26,13): error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
tests/cases/compiler/externModule.ts(28,13): error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
tests/cases/compiler/externModule.ts(30,1): error TS1128: Declaration or statement expected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/externModule.ts (13 errors) ====
|
||||
declare module {
|
||||
~~~~~~
|
||||
!!! error TS1005: ';' expected.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'declare'.
|
||||
~~~~~~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'module'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
export class XDate {
|
||||
~~~~~~
|
||||
!!! error TS1129: Statement expected.
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
tests/cases/compiler/fatarrowfunctionsErrors.ts(1,1): error TS2304: Cannot find name 'foo'.
|
||||
tests/cases/compiler/fatarrowfunctionsErrors.ts(2,1): error TS2304: Cannot find name 'foo'.
|
||||
tests/cases/compiler/fatarrowfunctionsErrors.ts(2,8): error TS1005: ',' expected.
|
||||
tests/cases/compiler/fatarrowfunctionsErrors.ts(2,18): error TS1005: ':' expected.
|
||||
tests/cases/compiler/fatarrowfunctionsErrors.ts(2,19): error TS1005: ',' expected.
|
||||
tests/cases/compiler/fatarrowfunctionsErrors.ts(2,20): error TS1128: Declaration or statement expected.
|
||||
tests/cases/compiler/fatarrowfunctionsErrors.ts(2,21): error TS1128: Declaration or statement expected.
|
||||
tests/cases/compiler/fatarrowfunctionsErrors.ts(3,1): error TS2304: Cannot find name 'foo'.
|
||||
tests/cases/compiler/fatarrowfunctionsErrors.ts(4,1): error TS2304: Cannot find name 'foo'.
|
||||
tests/cases/compiler/fatarrowfunctionsErrors.ts(5,9): error TS2304: Cannot find name 'x'.
|
||||
tests/cases/compiler/fatarrowfunctionsErrors.ts(5,10): error TS1005: ',' expected.
|
||||
tests/cases/compiler/fatarrowfunctionsErrors.ts(5,18): error TS1005: ';' expected.
|
||||
tests/cases/compiler/fatarrowfunctionsErrors.ts(5,21): error TS2304: Cannot find name 'x'.
|
||||
tests/cases/compiler/fatarrowfunctionsErrors.ts(5,23): error TS2304: Cannot find name 'x'.
|
||||
tests/cases/compiler/fatarrowfunctionsErrors.ts(9,19): error TS1005: '=>' expected.
|
||||
tests/cases/compiler/fatarrowfunctionsErrors.ts(10,27): error TS1005: '=>' expected.
|
||||
tests/cases/compiler/fatarrowfunctionsErrors.ts(11,21): error TS1005: '=>' expected.
|
||||
tests/cases/compiler/fatarrowfunctionsErrors.ts(12,23): error TS1005: '=>' expected.
|
||||
tests/cases/compiler/fatarrowfunctionsErrors.ts(1,1): error TS2304: Cannot find name 'foo'.
|
||||
tests/cases/compiler/fatarrowfunctionsErrors.ts(2,1): error TS2304: Cannot find name 'foo'.
|
||||
tests/cases/compiler/fatarrowfunctionsErrors.ts(3,1): error TS2304: Cannot find name 'foo'.
|
||||
tests/cases/compiler/fatarrowfunctionsErrors.ts(4,1): error TS2304: Cannot find name 'foo'.
|
||||
tests/cases/compiler/fatarrowfunctionsErrors.ts(5,9): error TS2304: Cannot find name 'x'.
|
||||
tests/cases/compiler/fatarrowfunctionsErrors.ts(5,21): error TS2304: Cannot find name 'x'.
|
||||
tests/cases/compiler/fatarrowfunctionsErrors.ts(5,23): error TS2304: Cannot find name 'x'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/fatarrowfunctionsErrors.ts (18 errors) ====
|
||||
@@ -23,6 +23,8 @@ tests/cases/compiler/fatarrowfunctionsErrors.ts(5,23): error TS2304: Cannot find
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'foo'.
|
||||
foo((1)=>{return 0;});
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'foo'.
|
||||
~~
|
||||
!!! error TS1005: ',' expected.
|
||||
~
|
||||
@@ -33,8 +35,6 @@ tests/cases/compiler/fatarrowfunctionsErrors.ts(5,23): error TS2304: Cannot find
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'foo'.
|
||||
foo((x?)=>{return x;})
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'foo'.
|
||||
@@ -42,12 +42,12 @@ tests/cases/compiler/fatarrowfunctionsErrors.ts(5,23): error TS2304: Cannot find
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'foo'.
|
||||
var y = x:number => x*x;
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'x'.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~~
|
||||
!!! error TS1005: ';' expected.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'x'.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'x'.
|
||||
~
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(1,23): error TS1005: ';' expected.
|
||||
tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(2,23): error TS1005: ';' expected.
|
||||
tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(4,17): error TS1005: ';' expected.
|
||||
tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(1,12): error TS2304: Cannot find name 'a'.
|
||||
tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(1,16): error TS2304: Cannot find name 'b'.
|
||||
tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(1,19): error TS2304: Cannot find name 'c'.
|
||||
tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(1,23): error TS1005: ';' expected.
|
||||
tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(1,26): error TS2304: Cannot find name 'a'.
|
||||
tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(1,28): error TS2304: Cannot find name 'b'.
|
||||
tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(1,30): error TS2304: Cannot find name 'c'.
|
||||
tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(2,13): error TS2304: Cannot find name 'a'.
|
||||
tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(2,17): error TS2304: Cannot find name 'b'.
|
||||
tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(2,20): error TS2304: Cannot find name 'c'.
|
||||
tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(2,23): error TS1005: ';' expected.
|
||||
tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(2,26): error TS2304: Cannot find name 'a'.
|
||||
tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(2,28): error TS2304: Cannot find name 'b'.
|
||||
tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(2,30): error TS2304: Cannot find name 'c'.
|
||||
tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(4,13): error TS2304: Cannot find name 'a'.
|
||||
tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(4,17): error TS1005: ';' expected.
|
||||
tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(4,20): error TS2304: Cannot find name 'a'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts (17 errors) ====
|
||||
var tt1 = (a, (b, c)) => a+b+c;
|
||||
~~
|
||||
!!! error TS1005: ';' expected.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'a'.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'b'.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'c'.
|
||||
~~
|
||||
!!! error TS1005: ';' expected.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'a'.
|
||||
~
|
||||
@@ -34,14 +34,14 @@ tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(4,20): error TS2304
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'c'.
|
||||
var tt2 = ((a), b, c) => a+b+c;
|
||||
~~
|
||||
!!! error TS1005: ';' expected.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'a'.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'b'.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'c'.
|
||||
~~
|
||||
!!! error TS1005: ';' expected.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'a'.
|
||||
~
|
||||
@@ -50,9 +50,9 @@ tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(4,20): error TS2304
|
||||
!!! error TS2304: Cannot find name 'c'.
|
||||
|
||||
var tt3 = ((a)) => a;
|
||||
~~
|
||||
!!! error TS1005: ';' expected.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'a'.
|
||||
~~
|
||||
!!! error TS1005: ';' expected.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'a'.
|
||||
@@ -1,8 +1,8 @@
|
||||
tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(117,5): error TS1003: Identifier expected.
|
||||
tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(2,16): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement.
|
||||
tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(64,17): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement.
|
||||
tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(94,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
|
||||
tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(112,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
|
||||
tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(117,5): error TS1003: Identifier expected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts (5 errors) ====
|
||||
|
||||
@@ -1,87 +1,219 @@
|
||||
tests/cases/compiler/giant.ts(23,12): error TS2300: Duplicate identifier 'pgF'.
|
||||
tests/cases/compiler/giant.ts(24,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(24,16): error TS2300: Duplicate identifier 'pgF'.
|
||||
tests/cases/compiler/giant.ts(25,12): error TS2300: Duplicate identifier 'psF'.
|
||||
tests/cases/compiler/giant.ts(26,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(26,16): error TS2300: Duplicate identifier 'psF'.
|
||||
tests/cases/compiler/giant.ts(27,13): error TS2300: Duplicate identifier 'rgF'.
|
||||
tests/cases/compiler/giant.ts(28,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(28,17): error TS2300: Duplicate identifier 'rgF'.
|
||||
tests/cases/compiler/giant.ts(29,13): error TS2300: Duplicate identifier 'rsF'.
|
||||
tests/cases/compiler/giant.ts(30,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(30,17): error TS2300: Duplicate identifier 'rsF'.
|
||||
tests/cases/compiler/giant.ts(33,12): error TS2300: Duplicate identifier 'tsF'.
|
||||
tests/cases/compiler/giant.ts(34,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(34,16): error TS2300: Duplicate identifier 'tsF'.
|
||||
tests/cases/compiler/giant.ts(35,12): error TS2300: Duplicate identifier 'tgF'.
|
||||
tests/cases/compiler/giant.ts(36,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(36,16): error TS2300: Duplicate identifier 'tgF'.
|
||||
tests/cases/compiler/giant.ts(61,5): error TS1169: Computed property names are not allowed in interfaces.
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
tests/cases/compiler/giant.ts(62,5): error TS1021: An index signature must have a type annotation.
|
||||
tests/cases/compiler/giant.ts(63,6): error TS1096: An index signature must have exactly one parameter.
|
||||
tests/cases/compiler/giant.ts(76,5): error TS2386: Overload signatures must all be optional or required.
|
||||
tests/cases/compiler/giant.ts(87,16): error TS2300: Duplicate identifier 'pgF'.
|
||||
>>>>>>> master
|
||||
tests/cases/compiler/giant.ts(88,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(88,20): error TS2300: Duplicate identifier 'pgF'.
|
||||
tests/cases/compiler/giant.ts(89,16): error TS2300: Duplicate identifier 'psF'.
|
||||
tests/cases/compiler/giant.ts(90,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(90,20): error TS2300: Duplicate identifier 'psF'.
|
||||
tests/cases/compiler/giant.ts(91,17): error TS2300: Duplicate identifier 'rgF'.
|
||||
tests/cases/compiler/giant.ts(92,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(92,21): error TS2300: Duplicate identifier 'rgF'.
|
||||
tests/cases/compiler/giant.ts(93,17): error TS2300: Duplicate identifier 'rsF'.
|
||||
tests/cases/compiler/giant.ts(94,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(94,21): error TS2300: Duplicate identifier 'rsF'.
|
||||
tests/cases/compiler/giant.ts(97,16): error TS2300: Duplicate identifier 'tsF'.
|
||||
tests/cases/compiler/giant.ts(98,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(98,20): error TS2300: Duplicate identifier 'tsF'.
|
||||
tests/cases/compiler/giant.ts(99,16): error TS2300: Duplicate identifier 'tgF'.
|
||||
tests/cases/compiler/giant.ts(100,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(100,20): error TS2300: Duplicate identifier 'tgF'.
|
||||
tests/cases/compiler/giant.ts(125,9): error TS1169: Computed property names are not allowed in interfaces.
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
tests/cases/compiler/giant.ts(126,9): error TS1021: An index signature must have a type annotation.
|
||||
tests/cases/compiler/giant.ts(127,10): error TS1096: An index signature must have exactly one parameter.
|
||||
tests/cases/compiler/giant.ts(140,9): error TS2386: Overload signatures must all be optional or required.
|
||||
>>>>>>> master
|
||||
tests/cases/compiler/giant.ts(154,39): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(166,16): error TS2300: Duplicate identifier 'pgF'.
|
||||
tests/cases/compiler/giant.ts(167,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(167,20): error TS2300: Duplicate identifier 'pgF'.
|
||||
tests/cases/compiler/giant.ts(168,16): error TS2300: Duplicate identifier 'psF'.
|
||||
tests/cases/compiler/giant.ts(169,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(169,20): error TS2300: Duplicate identifier 'psF'.
|
||||
tests/cases/compiler/giant.ts(170,17): error TS2300: Duplicate identifier 'rgF'.
|
||||
tests/cases/compiler/giant.ts(171,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(171,21): error TS2300: Duplicate identifier 'rgF'.
|
||||
tests/cases/compiler/giant.ts(172,17): error TS2300: Duplicate identifier 'rsF'.
|
||||
tests/cases/compiler/giant.ts(173,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(173,21): error TS2300: Duplicate identifier 'rsF'.
|
||||
tests/cases/compiler/giant.ts(176,16): error TS2300: Duplicate identifier 'tsF'.
|
||||
tests/cases/compiler/giant.ts(177,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(177,20): error TS2300: Duplicate identifier 'tsF'.
|
||||
tests/cases/compiler/giant.ts(178,16): error TS2300: Duplicate identifier 'tgF'.
|
||||
tests/cases/compiler/giant.ts(179,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(179,20): error TS2300: Duplicate identifier 'tgF'.
|
||||
tests/cases/compiler/giant.ts(204,9): error TS1169: Computed property names are not allowed in interfaces.
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
tests/cases/compiler/giant.ts(205,9): error TS1021: An index signature must have a type annotation.
|
||||
tests/cases/compiler/giant.ts(206,10): error TS1096: An index signature must have exactly one parameter.
|
||||
tests/cases/compiler/giant.ts(219,9): error TS2386: Overload signatures must all be optional or required.
|
||||
>>>>>>> master
|
||||
tests/cases/compiler/giant.ts(233,39): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(238,35): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(240,24): error TS1111: A constructor implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(243,21): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(244,22): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(245,16): error TS2300: Duplicate identifier 'pgF'.
|
||||
tests/cases/compiler/giant.ts(245,22): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(246,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(246,20): error TS2300: Duplicate identifier 'pgF'.
|
||||
tests/cases/compiler/giant.ts(247,16): error TS2300: Duplicate identifier 'psF'.
|
||||
tests/cases/compiler/giant.ts(247,31): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(248,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(248,20): error TS2300: Duplicate identifier 'psF'.
|
||||
tests/cases/compiler/giant.ts(249,17): error TS2300: Duplicate identifier 'rgF'.
|
||||
tests/cases/compiler/giant.ts(249,23): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(250,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(250,21): error TS2300: Duplicate identifier 'rgF'.
|
||||
tests/cases/compiler/giant.ts(251,17): error TS2300: Duplicate identifier 'rsF'.
|
||||
tests/cases/compiler/giant.ts(251,32): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(252,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(252,21): error TS2300: Duplicate identifier 'rsF'.
|
||||
tests/cases/compiler/giant.ts(254,21): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(255,16): error TS2300: Duplicate identifier 'tsF'.
|
||||
tests/cases/compiler/giant.ts(255,31): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(256,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(256,20): error TS2300: Duplicate identifier 'tsF'.
|
||||
tests/cases/compiler/giant.ts(257,16): error TS2300: Duplicate identifier 'tgF'.
|
||||
tests/cases/compiler/giant.ts(257,22): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(258,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(258,20): error TS2300: Duplicate identifier 'tgF'.
|
||||
tests/cases/compiler/giant.ts(262,22): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(262,25): error TS1036: Statements are not allowed in ambient contexts.
|
||||
tests/cases/compiler/giant.ts(267,30): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(267,33): error TS1036: Statements are not allowed in ambient contexts.
|
||||
tests/cases/compiler/giant.ts(281,12): error TS2300: Duplicate identifier 'pgF'.
|
||||
tests/cases/compiler/giant.ts(282,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(282,16): error TS2300: Duplicate identifier 'pgF'.
|
||||
tests/cases/compiler/giant.ts(283,12): error TS2300: Duplicate identifier 'psF'.
|
||||
tests/cases/compiler/giant.ts(284,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(284,16): error TS2300: Duplicate identifier 'psF'.
|
||||
tests/cases/compiler/giant.ts(285,13): error TS2300: Duplicate identifier 'rgF'.
|
||||
tests/cases/compiler/giant.ts(286,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(286,17): error TS2300: Duplicate identifier 'rgF'.
|
||||
tests/cases/compiler/giant.ts(287,13): error TS2300: Duplicate identifier 'rsF'.
|
||||
tests/cases/compiler/giant.ts(288,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(288,17): error TS2300: Duplicate identifier 'rsF'.
|
||||
tests/cases/compiler/giant.ts(291,12): error TS2300: Duplicate identifier 'tsF'.
|
||||
tests/cases/compiler/giant.ts(292,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(292,16): error TS2300: Duplicate identifier 'tsF'.
|
||||
tests/cases/compiler/giant.ts(293,12): error TS2300: Duplicate identifier 'tgF'.
|
||||
tests/cases/compiler/giant.ts(294,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(294,16): error TS2300: Duplicate identifier 'tgF'.
|
||||
tests/cases/compiler/giant.ts(319,5): error TS1169: Computed property names are not allowed in interfaces.
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
tests/cases/compiler/giant.ts(320,5): error TS1021: An index signature must have a type annotation.
|
||||
tests/cases/compiler/giant.ts(321,6): error TS1096: An index signature must have exactly one parameter.
|
||||
tests/cases/compiler/giant.ts(334,5): error TS2386: Overload signatures must all be optional or required.
|
||||
tests/cases/compiler/giant.ts(345,16): error TS2300: Duplicate identifier 'pgF'.
|
||||
>>>>>>> master
|
||||
tests/cases/compiler/giant.ts(346,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(346,20): error TS2300: Duplicate identifier 'pgF'.
|
||||
tests/cases/compiler/giant.ts(347,16): error TS2300: Duplicate identifier 'psF'.
|
||||
tests/cases/compiler/giant.ts(348,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(348,20): error TS2300: Duplicate identifier 'psF'.
|
||||
tests/cases/compiler/giant.ts(349,17): error TS2300: Duplicate identifier 'rgF'.
|
||||
tests/cases/compiler/giant.ts(350,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(350,21): error TS2300: Duplicate identifier 'rgF'.
|
||||
tests/cases/compiler/giant.ts(351,17): error TS2300: Duplicate identifier 'rsF'.
|
||||
tests/cases/compiler/giant.ts(352,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(352,21): error TS2300: Duplicate identifier 'rsF'.
|
||||
tests/cases/compiler/giant.ts(355,16): error TS2300: Duplicate identifier 'tsF'.
|
||||
tests/cases/compiler/giant.ts(356,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(356,20): error TS2300: Duplicate identifier 'tsF'.
|
||||
tests/cases/compiler/giant.ts(357,16): error TS2300: Duplicate identifier 'tgF'.
|
||||
tests/cases/compiler/giant.ts(358,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(358,20): error TS2300: Duplicate identifier 'tgF'.
|
||||
tests/cases/compiler/giant.ts(383,9): error TS1169: Computed property names are not allowed in interfaces.
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
tests/cases/compiler/giant.ts(384,9): error TS1021: An index signature must have a type annotation.
|
||||
tests/cases/compiler/giant.ts(385,10): error TS1096: An index signature must have exactly one parameter.
|
||||
tests/cases/compiler/giant.ts(398,9): error TS2386: Overload signatures must all be optional or required.
|
||||
>>>>>>> master
|
||||
tests/cases/compiler/giant.ts(412,39): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(424,16): error TS2300: Duplicate identifier 'pgF'.
|
||||
tests/cases/compiler/giant.ts(425,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(425,20): error TS2300: Duplicate identifier 'pgF'.
|
||||
tests/cases/compiler/giant.ts(426,16): error TS2300: Duplicate identifier 'psF'.
|
||||
tests/cases/compiler/giant.ts(427,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(427,20): error TS2300: Duplicate identifier 'psF'.
|
||||
tests/cases/compiler/giant.ts(428,17): error TS2300: Duplicate identifier 'rgF'.
|
||||
tests/cases/compiler/giant.ts(429,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(429,21): error TS2300: Duplicate identifier 'rgF'.
|
||||
tests/cases/compiler/giant.ts(430,17): error TS2300: Duplicate identifier 'rsF'.
|
||||
tests/cases/compiler/giant.ts(431,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(431,21): error TS2300: Duplicate identifier 'rsF'.
|
||||
tests/cases/compiler/giant.ts(434,16): error TS2300: Duplicate identifier 'tsF'.
|
||||
tests/cases/compiler/giant.ts(435,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(435,20): error TS2300: Duplicate identifier 'tsF'.
|
||||
tests/cases/compiler/giant.ts(436,16): error TS2300: Duplicate identifier 'tgF'.
|
||||
tests/cases/compiler/giant.ts(437,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(437,20): error TS2300: Duplicate identifier 'tgF'.
|
||||
tests/cases/compiler/giant.ts(462,9): error TS1169: Computed property names are not allowed in interfaces.
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
tests/cases/compiler/giant.ts(463,9): error TS1021: An index signature must have a type annotation.
|
||||
tests/cases/compiler/giant.ts(464,10): error TS1096: An index signature must have exactly one parameter.
|
||||
tests/cases/compiler/giant.ts(477,9): error TS2386: Overload signatures must all be optional or required.
|
||||
>>>>>>> master
|
||||
tests/cases/compiler/giant.ts(491,39): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(496,35): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(498,24): error TS1111: A constructor implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(501,21): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(502,22): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(503,16): error TS2300: Duplicate identifier 'pgF'.
|
||||
tests/cases/compiler/giant.ts(503,22): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(504,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(504,20): error TS2300: Duplicate identifier 'pgF'.
|
||||
tests/cases/compiler/giant.ts(505,16): error TS2300: Duplicate identifier 'psF'.
|
||||
tests/cases/compiler/giant.ts(505,31): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(506,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(506,20): error TS2300: Duplicate identifier 'psF'.
|
||||
tests/cases/compiler/giant.ts(507,17): error TS2300: Duplicate identifier 'rgF'.
|
||||
tests/cases/compiler/giant.ts(507,23): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(508,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(508,21): error TS2300: Duplicate identifier 'rgF'.
|
||||
tests/cases/compiler/giant.ts(509,17): error TS2300: Duplicate identifier 'rsF'.
|
||||
tests/cases/compiler/giant.ts(509,32): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(510,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(510,21): error TS2300: Duplicate identifier 'rsF'.
|
||||
tests/cases/compiler/giant.ts(512,21): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(513,16): error TS2300: Duplicate identifier 'tsF'.
|
||||
tests/cases/compiler/giant.ts(513,31): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(514,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(514,20): error TS2300: Duplicate identifier 'tsF'.
|
||||
tests/cases/compiler/giant.ts(515,16): error TS2300: Duplicate identifier 'tgF'.
|
||||
tests/cases/compiler/giant.ts(515,22): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(516,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(516,20): error TS2300: Duplicate identifier 'tgF'.
|
||||
tests/cases/compiler/giant.ts(520,22): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(520,25): error TS1036: Statements are not allowed in ambient contexts.
|
||||
tests/cases/compiler/giant.ts(525,30): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
@@ -90,25 +222,43 @@ tests/cases/compiler/giant.ts(532,31): error TS1037: A function implementation c
|
||||
tests/cases/compiler/giant.ts(534,20): error TS1111: A constructor implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(537,17): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(538,18): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(539,12): error TS2300: Duplicate identifier 'pgF'.
|
||||
tests/cases/compiler/giant.ts(539,18): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(540,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(540,16): error TS2300: Duplicate identifier 'pgF'.
|
||||
tests/cases/compiler/giant.ts(541,12): error TS2300: Duplicate identifier 'psF'.
|
||||
tests/cases/compiler/giant.ts(541,27): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(542,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(542,16): error TS2300: Duplicate identifier 'psF'.
|
||||
tests/cases/compiler/giant.ts(543,13): error TS2300: Duplicate identifier 'rgF'.
|
||||
tests/cases/compiler/giant.ts(543,19): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(544,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(544,17): error TS2300: Duplicate identifier 'rgF'.
|
||||
tests/cases/compiler/giant.ts(545,13): error TS2300: Duplicate identifier 'rsF'.
|
||||
tests/cases/compiler/giant.ts(545,28): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(546,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(546,17): error TS2300: Duplicate identifier 'rsF'.
|
||||
tests/cases/compiler/giant.ts(548,17): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(549,12): error TS2300: Duplicate identifier 'tsF'.
|
||||
tests/cases/compiler/giant.ts(549,27): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(550,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(550,16): error TS2300: Duplicate identifier 'tsF'.
|
||||
tests/cases/compiler/giant.ts(551,12): error TS2300: Duplicate identifier 'tgF'.
|
||||
tests/cases/compiler/giant.ts(551,18): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(552,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(552,16): error TS2300: Duplicate identifier 'tgF'.
|
||||
tests/cases/compiler/giant.ts(556,18): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(556,21): error TS1036: Statements are not allowed in ambient contexts.
|
||||
tests/cases/compiler/giant.ts(558,24): error TS1111: A constructor implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(561,21): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(563,21): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(587,9): error TS1169: Computed property names are not allowed in interfaces.
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
tests/cases/compiler/giant.ts(588,9): error TS1021: An index signature must have a type annotation.
|
||||
tests/cases/compiler/giant.ts(589,10): error TS1096: An index signature must have exactly one parameter.
|
||||
tests/cases/compiler/giant.ts(602,9): error TS2386: Overload signatures must all be optional or required.
|
||||
>>>>>>> master
|
||||
tests/cases/compiler/giant.ts(606,22): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(606,25): error TS1036: Statements are not allowed in ambient contexts.
|
||||
tests/cases/compiler/giant.ts(611,30): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
@@ -124,10 +274,17 @@ tests/cases/compiler/giant.ts(623,24): error TS1111: A constructor implementatio
|
||||
tests/cases/compiler/giant.ts(626,21): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(628,21): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(653,9): error TS1169: Computed property names are not allowed in interfaces.
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
tests/cases/compiler/giant.ts(654,9): error TS1021: An index signature must have a type annotation.
|
||||
tests/cases/compiler/giant.ts(655,10): error TS1096: An index signature must have exactly one parameter.
|
||||
tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all be optional or required.
|
||||
>>>>>>> master
|
||||
tests/cases/compiler/giant.ts(672,22): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(672,25): error TS1036: Statements are not allowed in ambient contexts.
|
||||
tests/cases/compiler/giant.ts(676,30): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(676,33): error TS1036: Statements are not allowed in ambient contexts.
|
||||
<<<<<<< HEAD
|
||||
tests/cases/compiler/giant.ts(23,12): error TS2300: Duplicate identifier 'pgF'.
|
||||
tests/cases/compiler/giant.ts(24,16): error TS2300: Duplicate identifier 'pgF'.
|
||||
tests/cases/compiler/giant.ts(25,12): error TS2300: Duplicate identifier 'psF'.
|
||||
@@ -260,6 +417,8 @@ tests/cases/compiler/giant.ts(602,9): error TS2386: Overload signatures must all
|
||||
tests/cases/compiler/giant.ts(654,9): error TS1021: An index signature must have a type annotation.
|
||||
tests/cases/compiler/giant.ts(655,10): error TS1096: An index signature must have exactly one parameter.
|
||||
tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all be optional or required.
|
||||
=======
|
||||
>>>>>>> master
|
||||
|
||||
|
||||
==== tests/cases/compiler/giant.ts (262 errors) ====
|
||||
@@ -652,40 +811,40 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
public pgF() { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'pgF'.
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
public get pgF()
|
||||
~~~
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'pgF'.
|
||||
public psF(param:any) { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'psF'.
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
public set psF(param:any)
|
||||
~~~
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'psF'.
|
||||
private rgF() { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'rgF'.
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
private get rgF()
|
||||
~~~
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'rgF'.
|
||||
private rsF(param:any) { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'rsF'.
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
private set rsF(param:any)
|
||||
~~~
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
@@ -696,20 +855,20 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
static tsF(param:any) { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'tsF'.
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
static set tsF(param:any)
|
||||
~~~
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'tsF'.
|
||||
static tgF() { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'tgF'.
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
static get tgF()
|
||||
~~~
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
@@ -1112,40 +1271,40 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
public pgF() { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'pgF'.
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
public get pgF()
|
||||
~~~
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'pgF'.
|
||||
public psF(param:any) { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'psF'.
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
public set psF(param:any)
|
||||
~~~
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'psF'.
|
||||
private rgF() { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'rgF'.
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
private get rgF()
|
||||
~~~
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'rgF'.
|
||||
private rsF(param:any) { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'rsF'.
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
private set rsF(param:any)
|
||||
~~~
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
@@ -1156,20 +1315,20 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
static tsF(param:any) { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'tsF'.
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
static set tsF(param:any)
|
||||
~~~
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'tsF'.
|
||||
static tgF() { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'tgF'.
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
static get tgF()
|
||||
~~~
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
@@ -1214,40 +1373,40 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
public pgF() { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'pgF'.
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
public get pgF()
|
||||
~~~
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'pgF'.
|
||||
public psF(param:any) { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'psF'.
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
public set psF(param:any)
|
||||
~~~
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'psF'.
|
||||
private rgF() { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'rgF'.
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
private get rgF()
|
||||
~~~
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'rgF'.
|
||||
private rsF(param:any) { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'rsF'.
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
private set rsF(param:any)
|
||||
~~~
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
@@ -1258,20 +1417,20 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
static tsF(param:any) { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'tsF'.
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
static set tsF(param:any)
|
||||
~~~
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'tsF'.
|
||||
static tgF() { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'tgF'.
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
static get tgF()
|
||||
~~~
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
tests/cases/compiler/importDeclWithClassModifiers.ts(5,8): error TS1044: 'public' modifier cannot appear on a module element.
|
||||
tests/cases/compiler/importDeclWithClassModifiers.ts(6,8): error TS1044: 'private' modifier cannot appear on a module element.
|
||||
tests/cases/compiler/importDeclWithClassModifiers.ts(7,8): error TS1044: 'static' modifier cannot appear on a module element.
|
||||
tests/cases/compiler/importDeclWithClassModifiers.ts(5,1): error TS2305: Module 'x' has no exported member 'c'.
|
||||
tests/cases/compiler/importDeclWithClassModifiers.ts(5,8): error TS1044: 'public' modifier cannot appear on a module element.
|
||||
tests/cases/compiler/importDeclWithClassModifiers.ts(6,1): error TS2305: Module 'x' has no exported member 'c'.
|
||||
tests/cases/compiler/importDeclWithClassModifiers.ts(6,8): error TS1044: 'private' modifier cannot appear on a module element.
|
||||
tests/cases/compiler/importDeclWithClassModifiers.ts(7,1): error TS2305: Module 'x' has no exported member 'c'.
|
||||
tests/cases/compiler/importDeclWithClassModifiers.ts(7,8): error TS1044: 'static' modifier cannot appear on a module element.
|
||||
|
||||
|
||||
==== tests/cases/compiler/importDeclWithClassModifiers.ts (6 errors) ====
|
||||
@@ -12,19 +12,19 @@ tests/cases/compiler/importDeclWithClassModifiers.ts(7,1): error TS2305: Module
|
||||
}
|
||||
}
|
||||
export public import a = x.c;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2305: Module 'x' has no exported member 'c'.
|
||||
~~~~~~
|
||||
!!! error TS1044: 'public' modifier cannot appear on a module element.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2305: Module 'x' has no exported member 'c'.
|
||||
export private import b = x.c;
|
||||
~~~~~~~
|
||||
!!! error TS1044: 'private' modifier cannot appear on a module element.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2305: Module 'x' has no exported member 'c'.
|
||||
~~~~~~~
|
||||
!!! error TS1044: 'private' modifier cannot appear on a module element.
|
||||
export static import c = x.c;
|
||||
~~~~~~
|
||||
!!! error TS1044: 'static' modifier cannot appear on a module element.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2305: Module 'x' has no exported member 'c'.
|
||||
~~~~~~
|
||||
!!! error TS1044: 'static' modifier cannot appear on a module element.
|
||||
var b: a;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
tests/cases/compiler/importDeclWithDeclareModifier.ts(5,1): error TS1148: Cannot compile external modules unless the '--module' flag is provided.
|
||||
tests/cases/compiler/importDeclWithDeclareModifier.ts(5,9): error TS1029: 'export' modifier must precede 'declare' modifier.
|
||||
tests/cases/compiler/importDeclWithDeclareModifier.ts(5,1): error TS2305: Module 'x' has no exported member 'c'.
|
||||
tests/cases/compiler/importDeclWithDeclareModifier.ts(5,9): error TS1029: 'export' modifier must precede 'declare' modifier.
|
||||
|
||||
|
||||
==== tests/cases/compiler/importDeclWithDeclareModifier.ts (3 errors) ====
|
||||
@@ -11,9 +11,9 @@ tests/cases/compiler/importDeclWithDeclareModifier.ts(5,1): error TS2305: Module
|
||||
declare export import a = x.c;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided.
|
||||
~~~~~~
|
||||
!!! error TS1029: 'export' modifier must precede 'declare' modifier.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2305: Module 'x' has no exported member 'c'.
|
||||
~~~~~~
|
||||
!!! error TS1029: 'export' modifier must precede 'declare' modifier.
|
||||
var b: a;
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
//// [tests/cases/compiler/importedAliasesInTypePositions.ts] ////
|
||||
|
||||
//// [file1.ts]
|
||||
export module elaborate.nested.mod.name {
|
||||
export class ReferredTo {
|
||||
doSomething(): void {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//// [file2.ts]
|
||||
import RT_ALIAS = require("file1");
|
||||
import ReferredTo = RT_ALIAS.elaborate.nested.mod.name.ReferredTo;
|
||||
|
||||
export module ImportingModule {
|
||||
class UsesReferredType {
|
||||
constructor(private referred: ReferredTo) { }
|
||||
}
|
||||
}
|
||||
|
||||
//// [file1.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
var elaborate;
|
||||
(function (elaborate) {
|
||||
var nested;
|
||||
(function (nested) {
|
||||
var mod;
|
||||
(function (mod) {
|
||||
var name;
|
||||
(function (name) {
|
||||
var ReferredTo = (function () {
|
||||
function ReferredTo() {
|
||||
}
|
||||
ReferredTo.prototype.doSomething = function () {
|
||||
};
|
||||
return ReferredTo;
|
||||
})();
|
||||
name.ReferredTo = ReferredTo;
|
||||
})(name = mod.name || (mod.name = {}));
|
||||
})(mod = nested.mod || (nested.mod = {}));
|
||||
})(nested = elaborate.nested || (elaborate.nested = {}));
|
||||
})(elaborate = exports.elaborate || (exports.elaborate = {}));
|
||||
});
|
||||
//// [file2.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
var ImportingModule;
|
||||
(function (ImportingModule) {
|
||||
var UsesReferredType = (function () {
|
||||
function UsesReferredType(referred) {
|
||||
this.referred = referred;
|
||||
}
|
||||
return UsesReferredType;
|
||||
})();
|
||||
})(ImportingModule = exports.ImportingModule || (exports.ImportingModule = {}));
|
||||
});
|
||||
@@ -0,0 +1,40 @@
|
||||
=== tests/cases/compiler/file2.ts ===
|
||||
import RT_ALIAS = require("file1");
|
||||
>RT_ALIAS : typeof RT_ALIAS
|
||||
|
||||
import ReferredTo = RT_ALIAS.elaborate.nested.mod.name.ReferredTo;
|
||||
>ReferredTo : typeof ReferredTo
|
||||
>RT_ALIAS : typeof RT_ALIAS
|
||||
>elaborate : typeof RT_ALIAS.elaborate
|
||||
>nested : typeof RT_ALIAS.elaborate.nested
|
||||
>mod : typeof RT_ALIAS.elaborate.nested.mod
|
||||
>name : typeof RT_ALIAS.elaborate.nested.mod.name
|
||||
>ReferredTo : ReferredTo
|
||||
|
||||
export module ImportingModule {
|
||||
>ImportingModule : typeof ImportingModule
|
||||
|
||||
class UsesReferredType {
|
||||
>UsesReferredType : UsesReferredType
|
||||
|
||||
constructor(private referred: ReferredTo) { }
|
||||
>referred : ReferredTo
|
||||
>ReferredTo : ReferredTo
|
||||
}
|
||||
}
|
||||
=== tests/cases/compiler/file1.ts ===
|
||||
export module elaborate.nested.mod.name {
|
||||
>elaborate : typeof elaborate
|
||||
>nested : typeof nested
|
||||
>mod : typeof mod
|
||||
>name : typeof name
|
||||
|
||||
export class ReferredTo {
|
||||
>ReferredTo : ReferredTo
|
||||
|
||||
doSomething(): void {
|
||||
>doSomething : () => void
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
tests/cases/compiler/incompleteDottedExpressionAtEOF.ts(2,18): error TS1003: Identifier expected.
|
||||
tests/cases/compiler/incompleteDottedExpressionAtEOF.ts(2,10): error TS2304: Cannot find name 'window'.
|
||||
tests/cases/compiler/incompleteDottedExpressionAtEOF.ts(2,18): error TS1003: Identifier expected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/incompleteDottedExpressionAtEOF.ts (2 errors) ====
|
||||
// used to leak __missing into error message
|
||||
var p2 = window.
|
||||
|
||||
!!! error TS1003: Identifier expected.
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'window'.
|
||||
!!! error TS2304: Cannot find name 'window'.
|
||||
|
||||
!!! error TS1003: Identifier expected.
|
||||
@@ -1,8 +1,8 @@
|
||||
tests/cases/conformance/expressions/operators/incrementAndDecrement.ts(5,9): error TS2304: Cannot find name 'window'.
|
||||
tests/cases/conformance/expressions/operators/incrementAndDecrement.ts(8,5): error TS1005: ';' expected.
|
||||
tests/cases/conformance/expressions/operators/incrementAndDecrement.ts(11,5): error TS1005: ';' expected.
|
||||
tests/cases/conformance/expressions/operators/incrementAndDecrement.ts(14,5): error TS1005: ';' expected.
|
||||
tests/cases/conformance/expressions/operators/incrementAndDecrement.ts(17,5): error TS1005: ';' expected.
|
||||
tests/cases/conformance/expressions/operators/incrementAndDecrement.ts(5,9): error TS2304: Cannot find name 'window'.
|
||||
tests/cases/conformance/expressions/operators/incrementAndDecrement.ts(24,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
||||
tests/cases/conformance/expressions/operators/incrementAndDecrement.ts(25,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
||||
tests/cases/conformance/expressions/operators/incrementAndDecrement.ts(26,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorLocals.ts(7,15): error TS1003: Identifier expected.
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorLocals.ts(17,15): error TS1003: Identifier expected.
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorLocals.ts(4,9): error TS2304: Cannot find name 'z'.
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorLocals.ts(5,15): error TS2304: Cannot find name 'z'.
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorLocals.ts(6,14): error TS2339: Property 'z' does not exist on type 'C'.
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorLocals.ts(7,15): error TS1003: Identifier expected.
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorLocals.ts(7,20): error TS2339: Property 'z' does not exist on type 'C'.
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorLocals.ts(9,9): error TS2304: Cannot find name 'z'.
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorLocals.ts(14,9): error TS2304: Cannot find name 'z'.
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorLocals.ts(15,15): error TS2304: Cannot find name 'z'.
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorLocals.ts(16,14): error TS2339: Property 'z' does not exist on type 'D<T>'.
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorLocals.ts(17,15): error TS1003: Identifier expected.
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorLocals.ts(17,20): error TS2339: Property 'z' does not exist on type 'D<T>'.
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorLocals.ts(19,9): error TS2304: Cannot find name 'z'.
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts(17,15): error TS1003: Identifier expected.
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts(4,9): error TS2304: Cannot find name 'x'.
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts(5,15): error TS2304: Cannot find name 'x'.
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts(10,9): error TS2304: Cannot find name 'x'.
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts(11,15): error TS2304: Cannot find name 'x'.
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts(17,15): error TS1003: Identifier expected.
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts(23,9): error TS2304: Cannot find name 'x'.
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
tests/cases/compiler/innerModExport1.ts(5,5): error TS2304: Cannot find name 'module'.
|
||||
tests/cases/compiler/innerModExport1.ts(5,12): error TS1005: ';' expected.
|
||||
tests/cases/compiler/innerModExport1.ts(7,9): error TS1129: Statement expected.
|
||||
tests/cases/compiler/innerModExport1.ts(14,5): error TS1148: Cannot compile external modules unless the '--module' flag is provided.
|
||||
tests/cases/compiler/innerModExport1.ts(17,1): error TS1128: Declaration or statement expected.
|
||||
tests/cases/compiler/innerModExport1.ts(5,5): error TS2304: Cannot find name 'module'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/innerModExport1.ts (5 errors) ====
|
||||
@@ -11,10 +11,10 @@ tests/cases/compiler/innerModExport1.ts(5,5): error TS2304: Cannot find name 'mo
|
||||
// inner mod 1
|
||||
var non_export_var: number;
|
||||
module {
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'module'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
var non_export_var = 0;
|
||||
export var export_var = 1;
|
||||
~~~~~~
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
tests/cases/compiler/innerModExport2.ts(5,5): error TS2304: Cannot find name 'module'.
|
||||
tests/cases/compiler/innerModExport2.ts(5,12): error TS1005: ';' expected.
|
||||
tests/cases/compiler/innerModExport2.ts(7,9): error TS1129: Statement expected.
|
||||
tests/cases/compiler/innerModExport2.ts(15,5): error TS1148: Cannot compile external modules unless the '--module' flag is provided.
|
||||
tests/cases/compiler/innerModExport2.ts(18,1): error TS1128: Declaration or statement expected.
|
||||
tests/cases/compiler/innerModExport2.ts(5,5): error TS2304: Cannot find name 'module'.
|
||||
tests/cases/compiler/innerModExport2.ts(20,7): error TS2339: Property 'NonExportFunc' does not exist on type 'typeof Outer'.
|
||||
|
||||
|
||||
@@ -12,10 +12,10 @@ tests/cases/compiler/innerModExport2.ts(20,7): error TS2339: Property 'NonExport
|
||||
// inner mod 1
|
||||
var non_export_var: number;
|
||||
module {
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'module'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
var non_export_var = 0;
|
||||
export var export_var = 1;
|
||||
~~~~~~
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
tests/cases/compiler/instantiateTypeParameter.ts(2,5): error TS1131: Property or signature expected.
|
||||
tests/cases/compiler/instantiateTypeParameter.ts(3,1): error TS1128: Declaration or statement expected.
|
||||
tests/cases/compiler/instantiateTypeParameter.ts(2,12): error TS2304: Cannot find name 'T'.
|
||||
tests/cases/compiler/instantiateTypeParameter.ts(3,1): error TS1128: Declaration or statement expected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/instantiateTypeParameter.ts (3 errors) ====
|
||||
|
||||
@@ -1,11 +1,3 @@
|
||||
tests/cases/compiler/intTypeCheck.ts(104,20): error TS1109: Expression expected.
|
||||
tests/cases/compiler/intTypeCheck.ts(118,21): error TS1109: Expression expected.
|
||||
tests/cases/compiler/intTypeCheck.ts(132,21): error TS1109: Expression expected.
|
||||
tests/cases/compiler/intTypeCheck.ts(146,21): error TS1109: Expression expected.
|
||||
tests/cases/compiler/intTypeCheck.ts(160,21): error TS1109: Expression expected.
|
||||
tests/cases/compiler/intTypeCheck.ts(174,21): error TS1109: Expression expected.
|
||||
tests/cases/compiler/intTypeCheck.ts(188,21): error TS1109: Expression expected.
|
||||
tests/cases/compiler/intTypeCheck.ts(202,21): error TS1109: Expression expected.
|
||||
tests/cases/compiler/intTypeCheck.ts(83,5): error TS2386: Overload signatures must all be optional or required.
|
||||
tests/cases/compiler/intTypeCheck.ts(97,5): error TS2322: Type 'Object' is not assignable to type 'i1'.
|
||||
Property 'p' is missing in type 'Object'.
|
||||
@@ -16,6 +8,7 @@ tests/cases/compiler/intTypeCheck.ts(101,5): error TS2322: Type '() => void' is
|
||||
Property 'p' is missing in type '() => void'.
|
||||
tests/cases/compiler/intTypeCheck.ts(104,5): error TS2322: Type 'boolean' is not assignable to type 'i1'.
|
||||
Property 'p' is missing in type 'Boolean'.
|
||||
tests/cases/compiler/intTypeCheck.ts(104,20): error TS1109: Expression expected.
|
||||
tests/cases/compiler/intTypeCheck.ts(104,21): error TS2304: Cannot find name 'i1'.
|
||||
tests/cases/compiler/intTypeCheck.ts(105,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
tests/cases/compiler/intTypeCheck.ts(110,5): error TS2322: Type '{}' is not assignable to type 'i2'.
|
||||
@@ -23,6 +16,7 @@ tests/cases/compiler/intTypeCheck.ts(111,5): error TS2322: Type 'Object' is not
|
||||
tests/cases/compiler/intTypeCheck.ts(112,17): error TS2350: Only a void function can be called with the 'new' keyword.
|
||||
tests/cases/compiler/intTypeCheck.ts(113,5): error TS2322: Type 'Base' is not assignable to type 'i2'.
|
||||
tests/cases/compiler/intTypeCheck.ts(118,5): error TS2322: Type 'boolean' is not assignable to type 'i2'.
|
||||
tests/cases/compiler/intTypeCheck.ts(118,21): error TS1109: Expression expected.
|
||||
tests/cases/compiler/intTypeCheck.ts(118,22): error TS2304: Cannot find name 'i2'.
|
||||
tests/cases/compiler/intTypeCheck.ts(119,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
tests/cases/compiler/intTypeCheck.ts(124,5): error TS2322: Type '{}' is not assignable to type 'i3'.
|
||||
@@ -30,6 +24,7 @@ tests/cases/compiler/intTypeCheck.ts(125,5): error TS2322: Type 'Object' is not
|
||||
tests/cases/compiler/intTypeCheck.ts(127,5): error TS2322: Type 'Base' is not assignable to type 'i3'.
|
||||
tests/cases/compiler/intTypeCheck.ts(129,5): error TS2322: Type '() => void' is not assignable to type 'i3'.
|
||||
tests/cases/compiler/intTypeCheck.ts(132,5): error TS2322: Type 'boolean' is not assignable to type 'i3'.
|
||||
tests/cases/compiler/intTypeCheck.ts(132,21): error TS1109: Expression expected.
|
||||
tests/cases/compiler/intTypeCheck.ts(132,22): error TS2304: Cannot find name 'i3'.
|
||||
tests/cases/compiler/intTypeCheck.ts(133,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
tests/cases/compiler/intTypeCheck.ts(139,5): error TS2322: Type 'Object' is not assignable to type 'i4'.
|
||||
@@ -41,6 +36,7 @@ tests/cases/compiler/intTypeCheck.ts(143,5): error TS2322: Type '() => void' is
|
||||
Index signature is missing in type '() => void'.
|
||||
tests/cases/compiler/intTypeCheck.ts(146,5): error TS2322: Type 'boolean' is not assignable to type 'i4'.
|
||||
Index signature is missing in type 'Boolean'.
|
||||
tests/cases/compiler/intTypeCheck.ts(146,21): error TS1109: Expression expected.
|
||||
tests/cases/compiler/intTypeCheck.ts(146,22): error TS2304: Cannot find name 'i4'.
|
||||
tests/cases/compiler/intTypeCheck.ts(147,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
tests/cases/compiler/intTypeCheck.ts(152,5): error TS2322: Type '{}' is not assignable to type 'i5'.
|
||||
@@ -54,6 +50,7 @@ tests/cases/compiler/intTypeCheck.ts(157,5): error TS2322: Type '() => void' is
|
||||
Property 'p' is missing in type '() => void'.
|
||||
tests/cases/compiler/intTypeCheck.ts(160,5): error TS2322: Type 'boolean' is not assignable to type 'i5'.
|
||||
Property 'p' is missing in type 'Boolean'.
|
||||
tests/cases/compiler/intTypeCheck.ts(160,21): error TS1109: Expression expected.
|
||||
tests/cases/compiler/intTypeCheck.ts(160,22): error TS2304: Cannot find name 'i5'.
|
||||
tests/cases/compiler/intTypeCheck.ts(161,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
tests/cases/compiler/intTypeCheck.ts(166,5): error TS2322: Type '{}' is not assignable to type 'i6'.
|
||||
@@ -63,6 +60,7 @@ tests/cases/compiler/intTypeCheck.ts(169,5): error TS2322: Type 'Base' is not as
|
||||
tests/cases/compiler/intTypeCheck.ts(171,5): error TS2322: Type '() => void' is not assignable to type 'i6'.
|
||||
Type 'void' is not assignable to type 'number'.
|
||||
tests/cases/compiler/intTypeCheck.ts(174,5): error TS2322: Type 'boolean' is not assignable to type 'i6'.
|
||||
tests/cases/compiler/intTypeCheck.ts(174,21): error TS1109: Expression expected.
|
||||
tests/cases/compiler/intTypeCheck.ts(174,22): error TS2304: Cannot find name 'i6'.
|
||||
tests/cases/compiler/intTypeCheck.ts(175,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
tests/cases/compiler/intTypeCheck.ts(180,5): error TS2322: Type '{}' is not assignable to type 'i7'.
|
||||
@@ -70,6 +68,7 @@ tests/cases/compiler/intTypeCheck.ts(181,5): error TS2322: Type 'Object' is not
|
||||
tests/cases/compiler/intTypeCheck.ts(183,17): error TS2352: Neither type 'Base' nor type 'i7' is assignable to the other.
|
||||
tests/cases/compiler/intTypeCheck.ts(185,5): error TS2322: Type '() => void' is not assignable to type 'i7'.
|
||||
tests/cases/compiler/intTypeCheck.ts(188,5): error TS2322: Type 'boolean' is not assignable to type 'i7'.
|
||||
tests/cases/compiler/intTypeCheck.ts(188,21): error TS1109: Expression expected.
|
||||
tests/cases/compiler/intTypeCheck.ts(188,22): error TS2304: Cannot find name 'i7'.
|
||||
tests/cases/compiler/intTypeCheck.ts(189,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
tests/cases/compiler/intTypeCheck.ts(195,5): error TS2322: Type 'Object' is not assignable to type 'i8'.
|
||||
@@ -81,6 +80,7 @@ tests/cases/compiler/intTypeCheck.ts(199,5): error TS2322: Type '() => void' is
|
||||
Index signature is missing in type '() => void'.
|
||||
tests/cases/compiler/intTypeCheck.ts(202,5): error TS2322: Type 'boolean' is not assignable to type 'i8'.
|
||||
Index signature is missing in type 'Boolean'.
|
||||
tests/cases/compiler/intTypeCheck.ts(202,21): error TS1109: Expression expected.
|
||||
tests/cases/compiler/intTypeCheck.ts(202,22): error TS2304: Cannot find name 'i8'.
|
||||
tests/cases/compiler/intTypeCheck.ts(203,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
|
||||
@@ -203,11 +203,11 @@ tests/cases/compiler/intTypeCheck.ts(203,17): error TS2351: Cannot use 'new' wit
|
||||
//var obj7: i1 = function foo() { };
|
||||
var obj8: i1 = <i1> anyVar;
|
||||
var obj9: i1 = new <i1> anyVar;
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~~~
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'i1'.
|
||||
!!! error TS2322: Property 'p' is missing in type 'Boolean'.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~
|
||||
!!! error TS2304: Cannot find name 'i1'.
|
||||
var obj10: i1 = new {};
|
||||
@@ -234,10 +234,10 @@ tests/cases/compiler/intTypeCheck.ts(203,17): error TS2351: Cannot use 'new' wit
|
||||
//var obj18: i2 = function foo() { };
|
||||
var obj19: i2 = <i2> anyVar;
|
||||
var obj20: i2 = new <i2> anyVar;
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~~~~
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'i2'.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~
|
||||
!!! error TS2304: Cannot find name 'i2'.
|
||||
var obj21: i2 = new {};
|
||||
@@ -264,10 +264,10 @@ tests/cases/compiler/intTypeCheck.ts(203,17): error TS2351: Cannot use 'new' wit
|
||||
//var obj29: i3 = function foo() { };
|
||||
var obj30: i3 = <i3> anyVar;
|
||||
var obj31: i3 = new <i3> anyVar;
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~~~~
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'i3'.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~
|
||||
!!! error TS2304: Cannot find name 'i3'.
|
||||
var obj32: i3 = new {};
|
||||
@@ -297,11 +297,11 @@ tests/cases/compiler/intTypeCheck.ts(203,17): error TS2351: Cannot use 'new' wit
|
||||
//var obj40: i4 = function foo() { };
|
||||
var obj41: i4 = <i4> anyVar;
|
||||
var obj42: i4 = new <i4> anyVar;
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~~~~
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'i4'.
|
||||
!!! error TS2322: Index signature is missing in type 'Boolean'.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~
|
||||
!!! error TS2304: Cannot find name 'i4'.
|
||||
var obj43: i4 = new {};
|
||||
@@ -334,11 +334,11 @@ tests/cases/compiler/intTypeCheck.ts(203,17): error TS2351: Cannot use 'new' wit
|
||||
//var obj51: i5 = function foo() { };
|
||||
var obj52: i5 = <i5> anyVar;
|
||||
var obj53: i5 = new <i5> anyVar;
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~~~~
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'i5'.
|
||||
!!! error TS2322: Property 'p' is missing in type 'Boolean'.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~
|
||||
!!! error TS2304: Cannot find name 'i5'.
|
||||
var obj54: i5 = new {};
|
||||
@@ -368,10 +368,10 @@ tests/cases/compiler/intTypeCheck.ts(203,17): error TS2351: Cannot use 'new' wit
|
||||
//var obj62: i6 = function foo() { };
|
||||
var obj63: i6 = <i6> anyVar;
|
||||
var obj64: i6 = new <i6> anyVar;
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~~~~
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'i6'.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~
|
||||
!!! error TS2304: Cannot find name 'i6'.
|
||||
var obj65: i6 = new {};
|
||||
@@ -398,10 +398,10 @@ tests/cases/compiler/intTypeCheck.ts(203,17): error TS2351: Cannot use 'new' wit
|
||||
//var obj73: i7 = function foo() { };
|
||||
var obj74: i7 = <i7> anyVar;
|
||||
var obj75: i7 = new <i7> anyVar;
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~~~~
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'i7'.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~
|
||||
!!! error TS2304: Cannot find name 'i7'.
|
||||
var obj76: i7 = new {};
|
||||
@@ -431,11 +431,11 @@ tests/cases/compiler/intTypeCheck.ts(203,17): error TS2351: Cannot use 'new' wit
|
||||
//var obj84: i8 = function foo() { };
|
||||
var obj85: i8 = <i8> anyVar;
|
||||
var obj86: i8 = new <i8> anyVar;
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~~~~
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'i8'.
|
||||
!!! error TS2322: Index signature is missing in type 'Boolean'.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~
|
||||
!!! error TS2304: Cannot find name 'i8'.
|
||||
var obj87: i8 = new {};
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
tests/cases/compiler/interfaceDeclaration4.ts(39,14): error TS1005: '{' expected.
|
||||
tests/cases/compiler/interfaceDeclaration4.ts(39,18): error TS1005: ';' expected.
|
||||
tests/cases/compiler/interfaceDeclaration4.ts(18,11): error TS2430: Interface 'I3' incorrectly extends interface 'I1'.
|
||||
Types of property 'item' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
@@ -7,7 +5,9 @@ tests/cases/compiler/interfaceDeclaration4.ts(27,7): error TS2420: Class 'C2' in
|
||||
Property 'item' is missing in type 'C2'.
|
||||
tests/cases/compiler/interfaceDeclaration4.ts(36,7): error TS2420: Class 'C3' incorrectly implements interface 'I1'.
|
||||
Property 'item' is missing in type 'C3'.
|
||||
tests/cases/compiler/interfaceDeclaration4.ts(39,14): error TS1005: '{' expected.
|
||||
tests/cases/compiler/interfaceDeclaration4.ts(39,15): error TS2304: Cannot find name 'I1'.
|
||||
tests/cases/compiler/interfaceDeclaration4.ts(39,18): error TS1005: ';' expected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/interfaceDeclaration4.ts (6 errors) ====
|
||||
@@ -62,8 +62,8 @@ tests/cases/compiler/interfaceDeclaration4.ts(39,15): error TS2304: Cannot find
|
||||
interface Foo.I1 { }
|
||||
~
|
||||
!!! error TS1005: '{' expected.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~
|
||||
!!! error TS2304: Cannot find name 'I1'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user