From e7895c59d43c9a088834de81446bd2fe7c078844 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Tue, 14 Apr 2015 15:05:08 -0700 Subject: [PATCH 01/45] Move commonSourceDirectory computation to its own function --- src/compiler/program.ts | 86 ++++++++++++++++++++++------------------- 1 file changed, 46 insertions(+), 40 deletions(-) diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 46466478029..64090f76344 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -453,6 +453,51 @@ module ts { } } + function computecommonSourceDirectory(sourceFiles: SourceFile[]): string { + let commonPathComponents: string[]; + forEach(files, sourceFile => { + // Each file contributes into common source file path + if (!(sourceFile.flags & NodeFlags.DeclarationFile) + && !fileExtensionIs(sourceFile.fileName, ".js")) { + let sourcePathComponents = getNormalizedPathComponents(sourceFile.fileName, host.getCurrentDirectory()); + sourcePathComponents.pop(); // FileName is not part of directory + if (commonPathComponents) { + for (let i = 0; i < Math.min(commonPathComponents.length, sourcePathComponents.length); i++) { + if (commonPathComponents[i] !== sourcePathComponents[i]) { + if (i === 0) { + diagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); + return; + } + + // New common path found that is 0 -> i-1 + commonPathComponents.length = i; + break; + } + } + + // If the fileComponent path completely matched and less than already found update the length + if (sourcePathComponents.length < commonPathComponents.length) { + commonPathComponents.length = sourcePathComponents.length; + } + } + else { + // first file + commonPathComponents = sourcePathComponents; + } + } + }); + + let commonSourceDirectory = getNormalizedPathFromPathComponents(commonPathComponents); + if (commonSourceDirectory) { + // Make sure directory path ends with directory separator so this string can directly + // used to replace with "" to get the relative path of the source file and the relative path doesn't + // start with / making it rooted path + commonSourceDirectory += directorySeparator; + } + + return commonSourceDirectory; + } + function verifyCompilerOptions() { if (options.separateCompilation) { if (options.sourceMap) { @@ -515,46 +560,7 @@ module ts { (options.mapRoot && // there is --mapRoot specified and there would be multiple js files generated (!options.out || firstExternalModuleSourceFile !== undefined))) { - let commonPathComponents: string[]; - forEach(files, sourceFile => { - // Each file contributes into common source file path - if (!(sourceFile.flags & NodeFlags.DeclarationFile) - && !fileExtensionIs(sourceFile.fileName, ".js")) { - let sourcePathComponents = getNormalizedPathComponents(sourceFile.fileName, host.getCurrentDirectory()); - sourcePathComponents.pop(); // FileName is not part of directory - if (commonPathComponents) { - for (let i = 0; i < Math.min(commonPathComponents.length, sourcePathComponents.length); i++) { - if (commonPathComponents[i] !== sourcePathComponents[i]) { - if (i === 0) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); - return; - } - - // New common path found that is 0 -> i-1 - commonPathComponents.length = i; - break; - } - } - - // If the fileComponent path completely matched and less than already found update the length - if (sourcePathComponents.length < commonPathComponents.length) { - commonPathComponents.length = sourcePathComponents.length; - } - } - else { - // first file - commonPathComponents = sourcePathComponents; - } - } - }); - - commonSourceDirectory = getNormalizedPathFromPathComponents(commonPathComponents); - if (commonSourceDirectory) { - // Make sure directory path ends with directory separator so this string can directly - // used to replace with "" to get the relative path of the source file and the relative path doesn't - // start with / making it rooted path - commonSourceDirectory += directorySeparator; - } + commonSourceDirectory = computecommonSourceDirectory(files); } if (options.noEmit) { From 261adffe50128708172c2185763fa856383c99d6 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Tue, 14 Apr 2015 22:11:25 -0700 Subject: [PATCH 02/45] Add rootDir option --- src/compiler/commandLineParser.ts | 7 ++ .../diagnosticInformationMap.generated.ts | 2 + src/compiler/diagnosticMessages.json | 9 ++ src/compiler/program.ts | 87 ++++++++++++------- src/compiler/types.ts | 1 + src/harness/projectsRunner.ts | 5 +- 6 files changed, 81 insertions(+), 30 deletions(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 8169421ca17..47f0594a76e 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -110,6 +110,13 @@ module ts { type: "boolean", description: Diagnostics.Do_not_emit_comments_to_output, }, + { + name: "rootDir", + type: "string", + isFilePath: true, + description: Diagnostics.Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir, + paramType: Diagnostics.LOCATION, + }, { name: "separateCompilation", type: "boolean", diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 0271ac73105..7c9d9b56c63 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -495,6 +495,8 @@ module 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." }, Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: DiagnosticCategory.Message, key: "Do not emit declarations for code that has an '@internal' annotation." }, Preserve_new_lines_when_emitting_code: { code: 6057, category: DiagnosticCategory.Message, key: "Preserve new-lines when emitting code." }, + Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir: { code: 6058, category: DiagnosticCategory.Message, key: "Specifies the root directory of input files. Use to control the output directory structure with --outDir." }, + File_0_is_not_under_rootDir_1_RootDir_is_expected_to_contain_all_source_files: { code: 6059, category: DiagnosticCategory.Error, key: "File '{0}' is not under rootDir '{1}'. RootDir is expected to contain all source files." }, 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." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 063a0d50ef5..31fc9090a6f 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1968,6 +1968,15 @@ "category": "Message", "code": 6057 }, + "Specifies the root directory of input files. Use to control the output directory structure with --outDir.": { + "category": "Message", + "code": 6058 + }, + "File '{0}' is not under rootDir '{1}'. RootDir is expected to contain all source files.": { + "category": "Error", + "code": 6059 + }, + "Variable '{0}' implicitly has an '{1}' type.": { "category": "Error", diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 64090f76344..e3fe08d04eb 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -455,47 +455,62 @@ module ts { function computecommonSourceDirectory(sourceFiles: SourceFile[]): string { let commonPathComponents: string[]; + let currentDirectory = host.getCurrentDirectory(); forEach(files, sourceFile => { // Each file contributes into common source file path - if (!(sourceFile.flags & NodeFlags.DeclarationFile) - && !fileExtensionIs(sourceFile.fileName, ".js")) { - let sourcePathComponents = getNormalizedPathComponents(sourceFile.fileName, host.getCurrentDirectory()); - sourcePathComponents.pop(); // FileName is not part of directory - if (commonPathComponents) { - for (let i = 0; i < Math.min(commonPathComponents.length, sourcePathComponents.length); i++) { - if (commonPathComponents[i] !== sourcePathComponents[i]) { - if (i === 0) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); - return; - } + if (isDeclarationFile(sourceFile)) { + return; + } - // New common path found that is 0 -> i-1 - commonPathComponents.length = i; - break; + let sourcePathComponents = getNormalizedPathComponents(sourceFile.fileName, currentDirectory); + sourcePathComponents.pop(); // FileName is not part of directory + if (commonPathComponents) { + for (let i = 0; i < Math.min(commonPathComponents.length, sourcePathComponents.length); i++) { + if (commonPathComponents[i] !== sourcePathComponents[i]) { + if (i === 0) { + diagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); + return; } - } - // If the fileComponent path completely matched and less than already found update the length - if (sourcePathComponents.length < commonPathComponents.length) { - commonPathComponents.length = sourcePathComponents.length; + // New common path found that is 0 -> i-1 + commonPathComponents.length = i; + break; } } - else { - // first file - commonPathComponents = sourcePathComponents; + + // If the fileComponent path completely matched and less than already found update the length + if (sourcePathComponents.length < commonPathComponents.length) { + commonPathComponents.length = sourcePathComponents.length; } } + else { + // first file + commonPathComponents = sourcePathComponents; + } + }); - let commonSourceDirectory = getNormalizedPathFromPathComponents(commonPathComponents); - if (commonSourceDirectory) { - // Make sure directory path ends with directory separator so this string can directly - // used to replace with "" to get the relative path of the source file and the relative path doesn't - // start with / making it rooted path - commonSourceDirectory += directorySeparator; + return getNormalizedPathFromPathComponents(commonPathComponents); + } + + function checkSourceFilesBelongToPath(soruceFiles: SourceFile[], rootDirectory: string): boolean { + let allFilesBelongToPath = true; + if (files) { + let currentDirectory = host.getCurrentDirectory(); + let absoluteRootDirectoryPath = host.getCanonicalFileName(getNormalizedAbsolutePath(rootDirectory, currentDirectory)); + + for (var sourceFile of files) { + if (!isDeclarationFile(sourceFile)) { + let absoluteSourceFilePath = host.getCanonicalFileName(getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory)); + if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) { + diagnostics.add(createCompilerDiagnostic(Diagnostics.File_0_is_not_under_rootDir_1_RootDir_is_expected_to_contain_all_source_files, sourceFile.fileName, options.rootDir)); + allFilesBelongToPath = false; + } + } + } } - return commonSourceDirectory; + return allFilesBelongToPath; } function verifyCompilerOptions() { @@ -560,7 +575,21 @@ module ts { (options.mapRoot && // there is --mapRoot specified and there would be multiple js files generated (!options.out || firstExternalModuleSourceFile !== undefined))) { - commonSourceDirectory = computecommonSourceDirectory(files); + if (options.rootDir && checkSourceFilesBelongToPath(files, options.rootDir)) { + // If a rootDir is specified and is valid use it as the commonSourceDirectory + commonSourceDirectory = getNormalizedAbsolutePath(options.rootDir, host.getCurrentDirectory()); + } + else { + // Compute the commonSourceDirectory from the input files + commonSourceDirectory = computecommonSourceDirectory(files); + } + + if (commonSourceDirectory && commonSourceDirectory[commonSourceDirectory.length - 1] !== directorySeparator) { + // Make sure directory path ends with directory separator so this string can directly + // used to replace with "" to get the relative path of the source file and the relative path doesn't + // start with / making it rooted path + commonSourceDirectory += directorySeparator; + } } if (options.noEmit) { diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 43c210331a5..0e7c089cc27 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1648,6 +1648,7 @@ module ts { preserveConstEnums?: boolean; project?: string; removeComments?: boolean; + rootDir?: string; sourceMap?: boolean; sourceRoot?: string; suppressImplicitAnyIndexErrors?: boolean; diff --git a/src/harness/projectsRunner.ts b/src/harness/projectsRunner.ts index 3291128a7a5..6823bfafac2 100644 --- a/src/harness/projectsRunner.ts +++ b/src/harness/projectsRunner.ts @@ -18,6 +18,7 @@ interface ProjectRunnerTestCase { runTest?: boolean; // Run the resulting test bug?: string; // If there is any bug associated with this test case noResolve?: boolean; + rootDir?: string; // --rootDir } interface ProjectRunnerTestCaseResolutionInfo extends ProjectRunnerTestCase { @@ -160,7 +161,8 @@ class ProjectRunner extends RunnerBase { 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 + noResolve: testCase.noResolve, + rootDir: testCase.rootDir }; } @@ -344,6 +346,7 @@ class ProjectRunner extends RunnerBase { baselineCheck: testCase.baselineCheck, runTest: testCase.runTest, bug: testCase.bug, + rootDir: testCase.rootDir, resolvedInputFiles: ts.map(compilerResult.program.getSourceFiles(), inputFile => inputFile.fileName), emittedFiles: ts.map(compilerResult.outputFiles, outputFile => outputFile.emittedFileName) }; From 99c0adbc2adba8d1b74f761d117ba73dfed9519e Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Tue, 14 Apr 2015 22:19:59 -0700 Subject: [PATCH 03/45] Add rootDir tests --- .../outdir/simple/FolderB/FolderC/fileC.d.ts | 2 + .../outdir/simple/FolderB/FolderC/fileC.js | 5 + .../simple/FolderB/FolderC/fileC.js.map | 1 + .../amd/outdir/simple/FolderB/fileB.d.ts | 4 + .../amd/outdir/simple/FolderB/fileB.js | 6 + .../amd/outdir/simple/FolderB/fileB.js.map | 1 + .../rootDirectory/amd/rootDirectory.json | 22 ++++ .../amd/rootDirectory.sourcemap.txt | 123 ++++++++++++++++++ .../outdir/simple/FolderB/FolderC/fileC.d.ts | 2 + .../outdir/simple/FolderB/FolderC/fileC.js | 5 + .../simple/FolderB/FolderC/fileC.js.map | 1 + .../node/outdir/simple/FolderB/fileB.d.ts | 4 + .../node/outdir/simple/FolderB/fileB.js | 6 + .../node/outdir/simple/FolderB/fileB.js.map | 1 + .../rootDirectory/node/rootDirectory.json | 22 ++++ .../node/rootDirectory.sourcemap.txt | 123 ++++++++++++++++++ .../amd/outdir/simple/FolderC/fileC.d.ts | 2 + .../amd/outdir/simple/FolderC/fileC.js | 5 + .../amd/outdir/simple/fileB.d.ts | 4 + .../amd/outdir/simple/fileB.js | 6 + .../amd/rootDirectoryErrors.errors.txt | 14 ++ .../amd/rootDirectoryErrors.json | 22 ++++ .../node/outdir/simple/FolderC/fileC.d.ts | 2 + .../node/outdir/simple/FolderC/fileC.js | 5 + .../node/outdir/simple/fileB.d.ts | 4 + .../node/outdir/simple/fileB.js | 6 + .../node/rootDirectoryErrors.errors.txt | 14 ++ .../node/rootDirectoryErrors.json | 22 ++++ .../outdir/simple/FolderB/FolderC/fileC.js | 6 + .../simple/FolderB/FolderC/fileC.js.map | 1 + .../amd/outdir/simple/FolderB/fileB.js | 7 + .../amd/outdir/simple/FolderB/fileB.js.map | 1 + .../amd/rootDirectoryWithSourceRoot.json | 23 ++++ .../rootDirectoryWithSourceRoot.sourcemap.txt | 123 ++++++++++++++++++ .../outdir/simple/FolderB/FolderC/fileC.js | 6 + .../simple/FolderB/FolderC/fileC.js.map | 1 + .../node/outdir/simple/FolderB/fileB.js | 7 + .../node/outdir/simple/FolderB/fileB.js.map | 1 + .../node/rootDirectoryWithSourceRoot.json | 23 ++++ .../rootDirectoryWithSourceRoot.sourcemap.txt | 123 ++++++++++++++++++ tests/cases/project/rootDirectory.json | 12 ++ tests/cases/project/rootDirectoryErrors.json | 11 ++ .../project/rootDirectoryWithSourceRoot.json | 12 ++ .../FolderA/FolderB/FolderC/fileC.ts | 2 + .../rootDirectory/FolderA/FolderB/fileB.ts | 4 + 45 files changed, 797 insertions(+) create mode 100644 tests/baselines/reference/project/rootDirectory/amd/outdir/simple/FolderB/FolderC/fileC.d.ts create mode 100644 tests/baselines/reference/project/rootDirectory/amd/outdir/simple/FolderB/FolderC/fileC.js create mode 100644 tests/baselines/reference/project/rootDirectory/amd/outdir/simple/FolderB/FolderC/fileC.js.map create mode 100644 tests/baselines/reference/project/rootDirectory/amd/outdir/simple/FolderB/fileB.d.ts create mode 100644 tests/baselines/reference/project/rootDirectory/amd/outdir/simple/FolderB/fileB.js create mode 100644 tests/baselines/reference/project/rootDirectory/amd/outdir/simple/FolderB/fileB.js.map create mode 100644 tests/baselines/reference/project/rootDirectory/amd/rootDirectory.json create mode 100644 tests/baselines/reference/project/rootDirectory/amd/rootDirectory.sourcemap.txt create mode 100644 tests/baselines/reference/project/rootDirectory/node/outdir/simple/FolderB/FolderC/fileC.d.ts create mode 100644 tests/baselines/reference/project/rootDirectory/node/outdir/simple/FolderB/FolderC/fileC.js create mode 100644 tests/baselines/reference/project/rootDirectory/node/outdir/simple/FolderB/FolderC/fileC.js.map create mode 100644 tests/baselines/reference/project/rootDirectory/node/outdir/simple/FolderB/fileB.d.ts create mode 100644 tests/baselines/reference/project/rootDirectory/node/outdir/simple/FolderB/fileB.js create mode 100644 tests/baselines/reference/project/rootDirectory/node/outdir/simple/FolderB/fileB.js.map create mode 100644 tests/baselines/reference/project/rootDirectory/node/rootDirectory.json create mode 100644 tests/baselines/reference/project/rootDirectory/node/rootDirectory.sourcemap.txt create mode 100644 tests/baselines/reference/project/rootDirectoryErrors/amd/outdir/simple/FolderC/fileC.d.ts create mode 100644 tests/baselines/reference/project/rootDirectoryErrors/amd/outdir/simple/FolderC/fileC.js create mode 100644 tests/baselines/reference/project/rootDirectoryErrors/amd/outdir/simple/fileB.d.ts create mode 100644 tests/baselines/reference/project/rootDirectoryErrors/amd/outdir/simple/fileB.js create mode 100644 tests/baselines/reference/project/rootDirectoryErrors/amd/rootDirectoryErrors.errors.txt create mode 100644 tests/baselines/reference/project/rootDirectoryErrors/amd/rootDirectoryErrors.json create mode 100644 tests/baselines/reference/project/rootDirectoryErrors/node/outdir/simple/FolderC/fileC.d.ts create mode 100644 tests/baselines/reference/project/rootDirectoryErrors/node/outdir/simple/FolderC/fileC.js create mode 100644 tests/baselines/reference/project/rootDirectoryErrors/node/outdir/simple/fileB.d.ts create mode 100644 tests/baselines/reference/project/rootDirectoryErrors/node/outdir/simple/fileB.js create mode 100644 tests/baselines/reference/project/rootDirectoryErrors/node/rootDirectoryErrors.errors.txt create mode 100644 tests/baselines/reference/project/rootDirectoryErrors/node/rootDirectoryErrors.json create mode 100644 tests/baselines/reference/project/rootDirectoryWithSourceRoot/amd/outdir/simple/FolderB/FolderC/fileC.js create mode 100644 tests/baselines/reference/project/rootDirectoryWithSourceRoot/amd/outdir/simple/FolderB/FolderC/fileC.js.map create mode 100644 tests/baselines/reference/project/rootDirectoryWithSourceRoot/amd/outdir/simple/FolderB/fileB.js create mode 100644 tests/baselines/reference/project/rootDirectoryWithSourceRoot/amd/outdir/simple/FolderB/fileB.js.map create mode 100644 tests/baselines/reference/project/rootDirectoryWithSourceRoot/amd/rootDirectoryWithSourceRoot.json create mode 100644 tests/baselines/reference/project/rootDirectoryWithSourceRoot/amd/rootDirectoryWithSourceRoot.sourcemap.txt create mode 100644 tests/baselines/reference/project/rootDirectoryWithSourceRoot/node/outdir/simple/FolderB/FolderC/fileC.js create mode 100644 tests/baselines/reference/project/rootDirectoryWithSourceRoot/node/outdir/simple/FolderB/FolderC/fileC.js.map create mode 100644 tests/baselines/reference/project/rootDirectoryWithSourceRoot/node/outdir/simple/FolderB/fileB.js create mode 100644 tests/baselines/reference/project/rootDirectoryWithSourceRoot/node/outdir/simple/FolderB/fileB.js.map create mode 100644 tests/baselines/reference/project/rootDirectoryWithSourceRoot/node/rootDirectoryWithSourceRoot.json create mode 100644 tests/baselines/reference/project/rootDirectoryWithSourceRoot/node/rootDirectoryWithSourceRoot.sourcemap.txt create mode 100644 tests/cases/project/rootDirectory.json create mode 100644 tests/cases/project/rootDirectoryErrors.json create mode 100644 tests/cases/project/rootDirectoryWithSourceRoot.json create mode 100644 tests/cases/projects/rootDirectory/FolderA/FolderB/FolderC/fileC.ts create mode 100644 tests/cases/projects/rootDirectory/FolderA/FolderB/fileB.ts diff --git a/tests/baselines/reference/project/rootDirectory/amd/outdir/simple/FolderB/FolderC/fileC.d.ts b/tests/baselines/reference/project/rootDirectory/amd/outdir/simple/FolderB/FolderC/fileC.d.ts new file mode 100644 index 00000000000..8147620b211 --- /dev/null +++ b/tests/baselines/reference/project/rootDirectory/amd/outdir/simple/FolderB/FolderC/fileC.d.ts @@ -0,0 +1,2 @@ +declare class C { +} diff --git a/tests/baselines/reference/project/rootDirectory/amd/outdir/simple/FolderB/FolderC/fileC.js b/tests/baselines/reference/project/rootDirectory/amd/outdir/simple/FolderB/FolderC/fileC.js new file mode 100644 index 00000000000..325ac60ee32 --- /dev/null +++ b/tests/baselines/reference/project/rootDirectory/amd/outdir/simple/FolderB/FolderC/fileC.js @@ -0,0 +1,5 @@ +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/project/rootDirectory/amd/outdir/simple/FolderB/FolderC/fileC.js.map b/tests/baselines/reference/project/rootDirectory/amd/outdir/simple/FolderB/FolderC/fileC.js.map new file mode 100644 index 00000000000..de54805ee54 --- /dev/null +++ b/tests/baselines/reference/project/rootDirectory/amd/outdir/simple/FolderB/FolderC/fileC.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fileC.js","sourceRoot":"","sources":["../../../../FolderA/FolderB/FolderC/fileC.ts"],"names":["C","C.constructor"],"mappings":"AAAA;IAAAA;IACAC,CAACA;IAADD,QAACA;AAADA,CAACA,AADD,IACC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/rootDirectory/amd/outdir/simple/FolderB/fileB.d.ts b/tests/baselines/reference/project/rootDirectory/amd/outdir/simple/FolderB/fileB.d.ts new file mode 100644 index 00000000000..4ff813c3839 --- /dev/null +++ b/tests/baselines/reference/project/rootDirectory/amd/outdir/simple/FolderB/fileB.d.ts @@ -0,0 +1,4 @@ +/// +declare class B { + c: C; +} diff --git a/tests/baselines/reference/project/rootDirectory/amd/outdir/simple/FolderB/fileB.js b/tests/baselines/reference/project/rootDirectory/amd/outdir/simple/FolderB/fileB.js new file mode 100644 index 00000000000..99199ca1742 --- /dev/null +++ b/tests/baselines/reference/project/rootDirectory/amd/outdir/simple/FolderB/fileB.js @@ -0,0 +1,6 @@ +/// +var B = (function () { + function B() { + } + return B; +})(); diff --git a/tests/baselines/reference/project/rootDirectory/amd/outdir/simple/FolderB/fileB.js.map b/tests/baselines/reference/project/rootDirectory/amd/outdir/simple/FolderB/fileB.js.map new file mode 100644 index 00000000000..d1c844d3247 --- /dev/null +++ b/tests/baselines/reference/project/rootDirectory/amd/outdir/simple/FolderB/fileB.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fileB.js","sourceRoot":"","sources":["../../../FolderA/FolderB/fileB.ts"],"names":["B","B.constructor"],"mappings":"AACA,AADA,wCAAwC;;IACxCA;IAEAC,CAACA;IAADD,QAACA;AAADA,CAACA,AAFD,IAEC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/rootDirectory/amd/rootDirectory.json b/tests/baselines/reference/project/rootDirectory/amd/rootDirectory.json new file mode 100644 index 00000000000..111f0277ec1 --- /dev/null +++ b/tests/baselines/reference/project/rootDirectory/amd/rootDirectory.json @@ -0,0 +1,22 @@ +{ + "scenario": "rootDirectory: specify rootDirectory", + "projectRoot": "tests/cases/projects/rootDirectory", + "inputFiles": [ + "FolderA/FolderB/fileB.ts" + ], + "outDir": "outdir/simple", + "declaration": true, + "baselineCheck": true, + "rootDir": "FolderA", + "resolvedInputFiles": [ + "lib.d.ts", + "FolderA/FolderB/FolderC/fileC.ts", + "FolderA/FolderB/fileB.ts" + ], + "emittedFiles": [ + "outdir/simple/FolderB/FolderC/fileC.js", + "outdir/simple/FolderB/FolderC/fileC.d.ts", + "outdir/simple/FolderB/fileB.js", + "outdir/simple/FolderB/fileB.d.ts" + ] +} \ No newline at end of file diff --git a/tests/baselines/reference/project/rootDirectory/amd/rootDirectory.sourcemap.txt b/tests/baselines/reference/project/rootDirectory/amd/rootDirectory.sourcemap.txt new file mode 100644 index 00000000000..83ee3b40181 --- /dev/null +++ b/tests/baselines/reference/project/rootDirectory/amd/rootDirectory.sourcemap.txt @@ -0,0 +1,123 @@ +=================================================================== +JsFile: fileC.js +mapUrl: fileC.js.map +sourceRoot: +sources: ../../../../FolderA/FolderB/FolderC/fileC.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:outdir/simple/FolderB/FolderC/fileC.js +sourceFile:../../../../FolderA/FolderB/FolderC/fileC.ts +------------------------------------------------------------------- +>>>var C = (function () { +1 > +2 >^^^^^^^^^^^^^^^^^^^-> +1 > +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +--- +>>> function C() { +1->^^^^ +2 > ^^-> +1-> +1->Emitted(2, 5) Source(1, 1) + SourceIndex(0) name (C) +--- +>>> } +1->^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1->class C { + > +2 > } +1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (C.constructor) +2 >Emitted(3, 6) Source(2, 2) + SourceIndex(0) name (C.constructor) +--- +>>> return C; +1->^^^^ +2 > ^^^^^^^^ +1-> +2 > } +1->Emitted(4, 5) Source(2, 1) + SourceIndex(0) name (C) +2 >Emitted(4, 13) Source(2, 2) + SourceIndex(0) name (C) +--- +>>>})(); +1 > +2 >^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >} +3 > +4 > class C { + > } +1 >Emitted(5, 1) Source(2, 1) + SourceIndex(0) name (C) +2 >Emitted(5, 2) Source(2, 2) + SourceIndex(0) name (C) +3 >Emitted(5, 2) Source(1, 1) + SourceIndex(0) +4 >Emitted(5, 6) Source(2, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=fileC.js.map=================================================================== +JsFile: fileB.js +mapUrl: fileB.js.map +sourceRoot: +sources: ../../../FolderA/FolderB/fileB.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:outdir/simple/FolderB/fileB.js +sourceFile:../../../FolderA/FolderB/fileB.ts +------------------------------------------------------------------- +>>>/// +1 > +2 > +3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 >/// + > +2 > +3 >/// +1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +3 >Emitted(1, 41) Source(1, 41) + SourceIndex(0) +--- +>>>var B = (function () { +>>> function B() { +1 >^^^^ +2 > ^^-> +1 > + > +1 >Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (B) +--- +>>> } +1->^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1->class B { + > public c: C; + > +2 > } +1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (B.constructor) +2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (B.constructor) +--- +>>> return B; +1->^^^^ +2 > ^^^^^^^^ +1-> +2 > } +1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (B) +2 >Emitted(5, 13) Source(4, 2) + SourceIndex(0) name (B) +--- +>>>})(); +1 > +2 >^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >} +3 > +4 > class B { + > public c: C; + > } +1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (B) +2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (B) +3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) +4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=fileB.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/rootDirectory/node/outdir/simple/FolderB/FolderC/fileC.d.ts b/tests/baselines/reference/project/rootDirectory/node/outdir/simple/FolderB/FolderC/fileC.d.ts new file mode 100644 index 00000000000..8147620b211 --- /dev/null +++ b/tests/baselines/reference/project/rootDirectory/node/outdir/simple/FolderB/FolderC/fileC.d.ts @@ -0,0 +1,2 @@ +declare class C { +} diff --git a/tests/baselines/reference/project/rootDirectory/node/outdir/simple/FolderB/FolderC/fileC.js b/tests/baselines/reference/project/rootDirectory/node/outdir/simple/FolderB/FolderC/fileC.js new file mode 100644 index 00000000000..325ac60ee32 --- /dev/null +++ b/tests/baselines/reference/project/rootDirectory/node/outdir/simple/FolderB/FolderC/fileC.js @@ -0,0 +1,5 @@ +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/project/rootDirectory/node/outdir/simple/FolderB/FolderC/fileC.js.map b/tests/baselines/reference/project/rootDirectory/node/outdir/simple/FolderB/FolderC/fileC.js.map new file mode 100644 index 00000000000..de54805ee54 --- /dev/null +++ b/tests/baselines/reference/project/rootDirectory/node/outdir/simple/FolderB/FolderC/fileC.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fileC.js","sourceRoot":"","sources":["../../../../FolderA/FolderB/FolderC/fileC.ts"],"names":["C","C.constructor"],"mappings":"AAAA;IAAAA;IACAC,CAACA;IAADD,QAACA;AAADA,CAACA,AADD,IACC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/rootDirectory/node/outdir/simple/FolderB/fileB.d.ts b/tests/baselines/reference/project/rootDirectory/node/outdir/simple/FolderB/fileB.d.ts new file mode 100644 index 00000000000..4ff813c3839 --- /dev/null +++ b/tests/baselines/reference/project/rootDirectory/node/outdir/simple/FolderB/fileB.d.ts @@ -0,0 +1,4 @@ +/// +declare class B { + c: C; +} diff --git a/tests/baselines/reference/project/rootDirectory/node/outdir/simple/FolderB/fileB.js b/tests/baselines/reference/project/rootDirectory/node/outdir/simple/FolderB/fileB.js new file mode 100644 index 00000000000..99199ca1742 --- /dev/null +++ b/tests/baselines/reference/project/rootDirectory/node/outdir/simple/FolderB/fileB.js @@ -0,0 +1,6 @@ +/// +var B = (function () { + function B() { + } + return B; +})(); diff --git a/tests/baselines/reference/project/rootDirectory/node/outdir/simple/FolderB/fileB.js.map b/tests/baselines/reference/project/rootDirectory/node/outdir/simple/FolderB/fileB.js.map new file mode 100644 index 00000000000..d1c844d3247 --- /dev/null +++ b/tests/baselines/reference/project/rootDirectory/node/outdir/simple/FolderB/fileB.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fileB.js","sourceRoot":"","sources":["../../../FolderA/FolderB/fileB.ts"],"names":["B","B.constructor"],"mappings":"AACA,AADA,wCAAwC;;IACxCA;IAEAC,CAACA;IAADD,QAACA;AAADA,CAACA,AAFD,IAEC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/rootDirectory/node/rootDirectory.json b/tests/baselines/reference/project/rootDirectory/node/rootDirectory.json new file mode 100644 index 00000000000..111f0277ec1 --- /dev/null +++ b/tests/baselines/reference/project/rootDirectory/node/rootDirectory.json @@ -0,0 +1,22 @@ +{ + "scenario": "rootDirectory: specify rootDirectory", + "projectRoot": "tests/cases/projects/rootDirectory", + "inputFiles": [ + "FolderA/FolderB/fileB.ts" + ], + "outDir": "outdir/simple", + "declaration": true, + "baselineCheck": true, + "rootDir": "FolderA", + "resolvedInputFiles": [ + "lib.d.ts", + "FolderA/FolderB/FolderC/fileC.ts", + "FolderA/FolderB/fileB.ts" + ], + "emittedFiles": [ + "outdir/simple/FolderB/FolderC/fileC.js", + "outdir/simple/FolderB/FolderC/fileC.d.ts", + "outdir/simple/FolderB/fileB.js", + "outdir/simple/FolderB/fileB.d.ts" + ] +} \ No newline at end of file diff --git a/tests/baselines/reference/project/rootDirectory/node/rootDirectory.sourcemap.txt b/tests/baselines/reference/project/rootDirectory/node/rootDirectory.sourcemap.txt new file mode 100644 index 00000000000..83ee3b40181 --- /dev/null +++ b/tests/baselines/reference/project/rootDirectory/node/rootDirectory.sourcemap.txt @@ -0,0 +1,123 @@ +=================================================================== +JsFile: fileC.js +mapUrl: fileC.js.map +sourceRoot: +sources: ../../../../FolderA/FolderB/FolderC/fileC.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:outdir/simple/FolderB/FolderC/fileC.js +sourceFile:../../../../FolderA/FolderB/FolderC/fileC.ts +------------------------------------------------------------------- +>>>var C = (function () { +1 > +2 >^^^^^^^^^^^^^^^^^^^-> +1 > +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +--- +>>> function C() { +1->^^^^ +2 > ^^-> +1-> +1->Emitted(2, 5) Source(1, 1) + SourceIndex(0) name (C) +--- +>>> } +1->^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1->class C { + > +2 > } +1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (C.constructor) +2 >Emitted(3, 6) Source(2, 2) + SourceIndex(0) name (C.constructor) +--- +>>> return C; +1->^^^^ +2 > ^^^^^^^^ +1-> +2 > } +1->Emitted(4, 5) Source(2, 1) + SourceIndex(0) name (C) +2 >Emitted(4, 13) Source(2, 2) + SourceIndex(0) name (C) +--- +>>>})(); +1 > +2 >^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >} +3 > +4 > class C { + > } +1 >Emitted(5, 1) Source(2, 1) + SourceIndex(0) name (C) +2 >Emitted(5, 2) Source(2, 2) + SourceIndex(0) name (C) +3 >Emitted(5, 2) Source(1, 1) + SourceIndex(0) +4 >Emitted(5, 6) Source(2, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=fileC.js.map=================================================================== +JsFile: fileB.js +mapUrl: fileB.js.map +sourceRoot: +sources: ../../../FolderA/FolderB/fileB.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:outdir/simple/FolderB/fileB.js +sourceFile:../../../FolderA/FolderB/fileB.ts +------------------------------------------------------------------- +>>>/// +1 > +2 > +3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 >/// + > +2 > +3 >/// +1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +3 >Emitted(1, 41) Source(1, 41) + SourceIndex(0) +--- +>>>var B = (function () { +>>> function B() { +1 >^^^^ +2 > ^^-> +1 > + > +1 >Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (B) +--- +>>> } +1->^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1->class B { + > public c: C; + > +2 > } +1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (B.constructor) +2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (B.constructor) +--- +>>> return B; +1->^^^^ +2 > ^^^^^^^^ +1-> +2 > } +1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (B) +2 >Emitted(5, 13) Source(4, 2) + SourceIndex(0) name (B) +--- +>>>})(); +1 > +2 >^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >} +3 > +4 > class B { + > public c: C; + > } +1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (B) +2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (B) +3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) +4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=fileB.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/rootDirectoryErrors/amd/outdir/simple/FolderC/fileC.d.ts b/tests/baselines/reference/project/rootDirectoryErrors/amd/outdir/simple/FolderC/fileC.d.ts new file mode 100644 index 00000000000..8147620b211 --- /dev/null +++ b/tests/baselines/reference/project/rootDirectoryErrors/amd/outdir/simple/FolderC/fileC.d.ts @@ -0,0 +1,2 @@ +declare class C { +} diff --git a/tests/baselines/reference/project/rootDirectoryErrors/amd/outdir/simple/FolderC/fileC.js b/tests/baselines/reference/project/rootDirectoryErrors/amd/outdir/simple/FolderC/fileC.js new file mode 100644 index 00000000000..325ac60ee32 --- /dev/null +++ b/tests/baselines/reference/project/rootDirectoryErrors/amd/outdir/simple/FolderC/fileC.js @@ -0,0 +1,5 @@ +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/project/rootDirectoryErrors/amd/outdir/simple/fileB.d.ts b/tests/baselines/reference/project/rootDirectoryErrors/amd/outdir/simple/fileB.d.ts new file mode 100644 index 00000000000..4ff813c3839 --- /dev/null +++ b/tests/baselines/reference/project/rootDirectoryErrors/amd/outdir/simple/fileB.d.ts @@ -0,0 +1,4 @@ +/// +declare class B { + c: C; +} diff --git a/tests/baselines/reference/project/rootDirectoryErrors/amd/outdir/simple/fileB.js b/tests/baselines/reference/project/rootDirectoryErrors/amd/outdir/simple/fileB.js new file mode 100644 index 00000000000..99199ca1742 --- /dev/null +++ b/tests/baselines/reference/project/rootDirectoryErrors/amd/outdir/simple/fileB.js @@ -0,0 +1,6 @@ +/// +var B = (function () { + function B() { + } + return B; +})(); diff --git a/tests/baselines/reference/project/rootDirectoryErrors/amd/rootDirectoryErrors.errors.txt b/tests/baselines/reference/project/rootDirectoryErrors/amd/rootDirectoryErrors.errors.txt new file mode 100644 index 00000000000..7e10d8fbcd9 --- /dev/null +++ b/tests/baselines/reference/project/rootDirectoryErrors/amd/rootDirectoryErrors.errors.txt @@ -0,0 +1,14 @@ +error TS6059: File 'FolderA/FolderB/fileB.ts' is not under rootDir 'FolderA/FolderB/FolderC'. RootDir is expected to contain all source files. + + +!!! error TS6059: File 'fileB.ts' is not under rootDir 'FolderA/FolderB/FolderC'. RootDir is expected to contain all source files. +==== FolderA/FolderB/FolderC/fileC.ts (0 errors) ==== + class C { + } + +==== FolderA/FolderB/fileB.ts (0 errors) ==== + /// + class B { + public c: C; + } + \ No newline at end of file diff --git a/tests/baselines/reference/project/rootDirectoryErrors/amd/rootDirectoryErrors.json b/tests/baselines/reference/project/rootDirectoryErrors/amd/rootDirectoryErrors.json new file mode 100644 index 00000000000..fdde42592ca --- /dev/null +++ b/tests/baselines/reference/project/rootDirectoryErrors/amd/rootDirectoryErrors.json @@ -0,0 +1,22 @@ +{ + "scenario": "rootDirectory: Files outside the rootDirectory", + "projectRoot": "tests/cases/projects/rootDirectory", + "inputFiles": [ + "FolderA/FolderB/fileB.ts" + ], + "outDir": "outdir/simple", + "declaration": true, + "baselineCheck": true, + "rootDir": "FolderA/FolderB/FolderC", + "resolvedInputFiles": [ + "lib.d.ts", + "FolderA/FolderB/FolderC/fileC.ts", + "FolderA/FolderB/fileB.ts" + ], + "emittedFiles": [ + "outdir/simple/FolderC/fileC.js", + "outdir/simple/FolderC/fileC.d.ts", + "outdir/simple/fileB.js", + "outdir/simple/fileB.d.ts" + ] +} \ No newline at end of file diff --git a/tests/baselines/reference/project/rootDirectoryErrors/node/outdir/simple/FolderC/fileC.d.ts b/tests/baselines/reference/project/rootDirectoryErrors/node/outdir/simple/FolderC/fileC.d.ts new file mode 100644 index 00000000000..8147620b211 --- /dev/null +++ b/tests/baselines/reference/project/rootDirectoryErrors/node/outdir/simple/FolderC/fileC.d.ts @@ -0,0 +1,2 @@ +declare class C { +} diff --git a/tests/baselines/reference/project/rootDirectoryErrors/node/outdir/simple/FolderC/fileC.js b/tests/baselines/reference/project/rootDirectoryErrors/node/outdir/simple/FolderC/fileC.js new file mode 100644 index 00000000000..325ac60ee32 --- /dev/null +++ b/tests/baselines/reference/project/rootDirectoryErrors/node/outdir/simple/FolderC/fileC.js @@ -0,0 +1,5 @@ +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/project/rootDirectoryErrors/node/outdir/simple/fileB.d.ts b/tests/baselines/reference/project/rootDirectoryErrors/node/outdir/simple/fileB.d.ts new file mode 100644 index 00000000000..4ff813c3839 --- /dev/null +++ b/tests/baselines/reference/project/rootDirectoryErrors/node/outdir/simple/fileB.d.ts @@ -0,0 +1,4 @@ +/// +declare class B { + c: C; +} diff --git a/tests/baselines/reference/project/rootDirectoryErrors/node/outdir/simple/fileB.js b/tests/baselines/reference/project/rootDirectoryErrors/node/outdir/simple/fileB.js new file mode 100644 index 00000000000..99199ca1742 --- /dev/null +++ b/tests/baselines/reference/project/rootDirectoryErrors/node/outdir/simple/fileB.js @@ -0,0 +1,6 @@ +/// +var B = (function () { + function B() { + } + return B; +})(); diff --git a/tests/baselines/reference/project/rootDirectoryErrors/node/rootDirectoryErrors.errors.txt b/tests/baselines/reference/project/rootDirectoryErrors/node/rootDirectoryErrors.errors.txt new file mode 100644 index 00000000000..7e10d8fbcd9 --- /dev/null +++ b/tests/baselines/reference/project/rootDirectoryErrors/node/rootDirectoryErrors.errors.txt @@ -0,0 +1,14 @@ +error TS6059: File 'FolderA/FolderB/fileB.ts' is not under rootDir 'FolderA/FolderB/FolderC'. RootDir is expected to contain all source files. + + +!!! error TS6059: File 'fileB.ts' is not under rootDir 'FolderA/FolderB/FolderC'. RootDir is expected to contain all source files. +==== FolderA/FolderB/FolderC/fileC.ts (0 errors) ==== + class C { + } + +==== FolderA/FolderB/fileB.ts (0 errors) ==== + /// + class B { + public c: C; + } + \ No newline at end of file diff --git a/tests/baselines/reference/project/rootDirectoryErrors/node/rootDirectoryErrors.json b/tests/baselines/reference/project/rootDirectoryErrors/node/rootDirectoryErrors.json new file mode 100644 index 00000000000..fdde42592ca --- /dev/null +++ b/tests/baselines/reference/project/rootDirectoryErrors/node/rootDirectoryErrors.json @@ -0,0 +1,22 @@ +{ + "scenario": "rootDirectory: Files outside the rootDirectory", + "projectRoot": "tests/cases/projects/rootDirectory", + "inputFiles": [ + "FolderA/FolderB/fileB.ts" + ], + "outDir": "outdir/simple", + "declaration": true, + "baselineCheck": true, + "rootDir": "FolderA/FolderB/FolderC", + "resolvedInputFiles": [ + "lib.d.ts", + "FolderA/FolderB/FolderC/fileC.ts", + "FolderA/FolderB/fileB.ts" + ], + "emittedFiles": [ + "outdir/simple/FolderC/fileC.js", + "outdir/simple/FolderC/fileC.d.ts", + "outdir/simple/fileB.js", + "outdir/simple/fileB.d.ts" + ] +} \ No newline at end of file diff --git a/tests/baselines/reference/project/rootDirectoryWithSourceRoot/amd/outdir/simple/FolderB/FolderC/fileC.js b/tests/baselines/reference/project/rootDirectoryWithSourceRoot/amd/outdir/simple/FolderB/FolderC/fileC.js new file mode 100644 index 00000000000..8840c2117cf --- /dev/null +++ b/tests/baselines/reference/project/rootDirectoryWithSourceRoot/amd/outdir/simple/FolderB/FolderC/fileC.js @@ -0,0 +1,6 @@ +var C = (function () { + function C() { + } + return C; +})(); +//# sourceMappingURL=fileC.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/rootDirectoryWithSourceRoot/amd/outdir/simple/FolderB/FolderC/fileC.js.map b/tests/baselines/reference/project/rootDirectoryWithSourceRoot/amd/outdir/simple/FolderB/FolderC/fileC.js.map new file mode 100644 index 00000000000..9a35f3fbc3e --- /dev/null +++ b/tests/baselines/reference/project/rootDirectoryWithSourceRoot/amd/outdir/simple/FolderB/FolderC/fileC.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fileC.js","sourceRoot":"SourceRootPath/","sources":["FolderB/FolderC/fileC.ts"],"names":["C","C.constructor"],"mappings":"AAAA;IAAAA;IACAC,CAACA;IAADD,QAACA;AAADA,CAACA,AADD,IACC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/rootDirectoryWithSourceRoot/amd/outdir/simple/FolderB/fileB.js b/tests/baselines/reference/project/rootDirectoryWithSourceRoot/amd/outdir/simple/FolderB/fileB.js new file mode 100644 index 00000000000..84af55d2d89 --- /dev/null +++ b/tests/baselines/reference/project/rootDirectoryWithSourceRoot/amd/outdir/simple/FolderB/fileB.js @@ -0,0 +1,7 @@ +/// +var B = (function () { + function B() { + } + return B; +})(); +//# sourceMappingURL=fileB.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/rootDirectoryWithSourceRoot/amd/outdir/simple/FolderB/fileB.js.map b/tests/baselines/reference/project/rootDirectoryWithSourceRoot/amd/outdir/simple/FolderB/fileB.js.map new file mode 100644 index 00000000000..16a45385420 --- /dev/null +++ b/tests/baselines/reference/project/rootDirectoryWithSourceRoot/amd/outdir/simple/FolderB/fileB.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fileB.js","sourceRoot":"SourceRootPath/","sources":["FolderB/fileB.ts"],"names":["B","B.constructor"],"mappings":"AACA,AADA,wCAAwC;;IACxCA;IAEAC,CAACA;IAADD,QAACA;AAADA,CAACA,AAFD,IAEC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/rootDirectoryWithSourceRoot/amd/rootDirectoryWithSourceRoot.json b/tests/baselines/reference/project/rootDirectoryWithSourceRoot/amd/rootDirectoryWithSourceRoot.json new file mode 100644 index 00000000000..deb12150736 --- /dev/null +++ b/tests/baselines/reference/project/rootDirectoryWithSourceRoot/amd/rootDirectoryWithSourceRoot.json @@ -0,0 +1,23 @@ +{ + "scenario": "rootDirectory: specify rootDirectory with sourceRoot", + "projectRoot": "tests/cases/projects/rootDirectory", + "inputFiles": [ + "FolderA/FolderB/fileB.ts" + ], + "outDir": "outdir/simple", + "sourceMap": true, + "sourceRoot": "SourceRootPath", + "baselineCheck": true, + "rootDir": "FolderA", + "resolvedInputFiles": [ + "lib.d.ts", + "FolderA/FolderB/FolderC/fileC.ts", + "FolderA/FolderB/fileB.ts" + ], + "emittedFiles": [ + "outdir/simple/FolderB/FolderC/fileC.js.map", + "outdir/simple/FolderB/FolderC/fileC.js", + "outdir/simple/FolderB/fileB.js.map", + "outdir/simple/FolderB/fileB.js" + ] +} \ No newline at end of file diff --git a/tests/baselines/reference/project/rootDirectoryWithSourceRoot/amd/rootDirectoryWithSourceRoot.sourcemap.txt b/tests/baselines/reference/project/rootDirectoryWithSourceRoot/amd/rootDirectoryWithSourceRoot.sourcemap.txt new file mode 100644 index 00000000000..7c5843bdd34 --- /dev/null +++ b/tests/baselines/reference/project/rootDirectoryWithSourceRoot/amd/rootDirectoryWithSourceRoot.sourcemap.txt @@ -0,0 +1,123 @@ +=================================================================== +JsFile: fileC.js +mapUrl: fileC.js.map +sourceRoot: SourceRootPath/ +sources: FolderB/FolderC/fileC.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:outdir/simple/FolderB/FolderC/fileC.js +sourceFile:FolderB/FolderC/fileC.ts +------------------------------------------------------------------- +>>>var C = (function () { +1 > +2 >^^^^^^^^^^^^^^^^^^^-> +1 > +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +--- +>>> function C() { +1->^^^^ +2 > ^^-> +1-> +1->Emitted(2, 5) Source(1, 1) + SourceIndex(0) name (C) +--- +>>> } +1->^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1->class C { + > +2 > } +1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (C.constructor) +2 >Emitted(3, 6) Source(2, 2) + SourceIndex(0) name (C.constructor) +--- +>>> return C; +1->^^^^ +2 > ^^^^^^^^ +1-> +2 > } +1->Emitted(4, 5) Source(2, 1) + SourceIndex(0) name (C) +2 >Emitted(4, 13) Source(2, 2) + SourceIndex(0) name (C) +--- +>>>})(); +1 > +2 >^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >} +3 > +4 > class C { + > } +1 >Emitted(5, 1) Source(2, 1) + SourceIndex(0) name (C) +2 >Emitted(5, 2) Source(2, 2) + SourceIndex(0) name (C) +3 >Emitted(5, 2) Source(1, 1) + SourceIndex(0) +4 >Emitted(5, 6) Source(2, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=fileC.js.map=================================================================== +JsFile: fileB.js +mapUrl: fileB.js.map +sourceRoot: SourceRootPath/ +sources: FolderB/fileB.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:outdir/simple/FolderB/fileB.js +sourceFile:FolderB/fileB.ts +------------------------------------------------------------------- +>>>/// +1 > +2 > +3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 >/// + > +2 > +3 >/// +1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +3 >Emitted(1, 41) Source(1, 41) + SourceIndex(0) +--- +>>>var B = (function () { +>>> function B() { +1 >^^^^ +2 > ^^-> +1 > + > +1 >Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (B) +--- +>>> } +1->^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1->class B { + > public c: C; + > +2 > } +1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (B.constructor) +2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (B.constructor) +--- +>>> return B; +1->^^^^ +2 > ^^^^^^^^ +1-> +2 > } +1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (B) +2 >Emitted(5, 13) Source(4, 2) + SourceIndex(0) name (B) +--- +>>>})(); +1 > +2 >^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >} +3 > +4 > class B { + > public c: C; + > } +1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (B) +2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (B) +3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) +4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=fileB.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/rootDirectoryWithSourceRoot/node/outdir/simple/FolderB/FolderC/fileC.js b/tests/baselines/reference/project/rootDirectoryWithSourceRoot/node/outdir/simple/FolderB/FolderC/fileC.js new file mode 100644 index 00000000000..8840c2117cf --- /dev/null +++ b/tests/baselines/reference/project/rootDirectoryWithSourceRoot/node/outdir/simple/FolderB/FolderC/fileC.js @@ -0,0 +1,6 @@ +var C = (function () { + function C() { + } + return C; +})(); +//# sourceMappingURL=fileC.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/rootDirectoryWithSourceRoot/node/outdir/simple/FolderB/FolderC/fileC.js.map b/tests/baselines/reference/project/rootDirectoryWithSourceRoot/node/outdir/simple/FolderB/FolderC/fileC.js.map new file mode 100644 index 00000000000..9a35f3fbc3e --- /dev/null +++ b/tests/baselines/reference/project/rootDirectoryWithSourceRoot/node/outdir/simple/FolderB/FolderC/fileC.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fileC.js","sourceRoot":"SourceRootPath/","sources":["FolderB/FolderC/fileC.ts"],"names":["C","C.constructor"],"mappings":"AAAA;IAAAA;IACAC,CAACA;IAADD,QAACA;AAADA,CAACA,AADD,IACC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/rootDirectoryWithSourceRoot/node/outdir/simple/FolderB/fileB.js b/tests/baselines/reference/project/rootDirectoryWithSourceRoot/node/outdir/simple/FolderB/fileB.js new file mode 100644 index 00000000000..84af55d2d89 --- /dev/null +++ b/tests/baselines/reference/project/rootDirectoryWithSourceRoot/node/outdir/simple/FolderB/fileB.js @@ -0,0 +1,7 @@ +/// +var B = (function () { + function B() { + } + return B; +})(); +//# sourceMappingURL=fileB.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/rootDirectoryWithSourceRoot/node/outdir/simple/FolderB/fileB.js.map b/tests/baselines/reference/project/rootDirectoryWithSourceRoot/node/outdir/simple/FolderB/fileB.js.map new file mode 100644 index 00000000000..16a45385420 --- /dev/null +++ b/tests/baselines/reference/project/rootDirectoryWithSourceRoot/node/outdir/simple/FolderB/fileB.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fileB.js","sourceRoot":"SourceRootPath/","sources":["FolderB/fileB.ts"],"names":["B","B.constructor"],"mappings":"AACA,AADA,wCAAwC;;IACxCA;IAEAC,CAACA;IAADD,QAACA;AAADA,CAACA,AAFD,IAEC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/rootDirectoryWithSourceRoot/node/rootDirectoryWithSourceRoot.json b/tests/baselines/reference/project/rootDirectoryWithSourceRoot/node/rootDirectoryWithSourceRoot.json new file mode 100644 index 00000000000..deb12150736 --- /dev/null +++ b/tests/baselines/reference/project/rootDirectoryWithSourceRoot/node/rootDirectoryWithSourceRoot.json @@ -0,0 +1,23 @@ +{ + "scenario": "rootDirectory: specify rootDirectory with sourceRoot", + "projectRoot": "tests/cases/projects/rootDirectory", + "inputFiles": [ + "FolderA/FolderB/fileB.ts" + ], + "outDir": "outdir/simple", + "sourceMap": true, + "sourceRoot": "SourceRootPath", + "baselineCheck": true, + "rootDir": "FolderA", + "resolvedInputFiles": [ + "lib.d.ts", + "FolderA/FolderB/FolderC/fileC.ts", + "FolderA/FolderB/fileB.ts" + ], + "emittedFiles": [ + "outdir/simple/FolderB/FolderC/fileC.js.map", + "outdir/simple/FolderB/FolderC/fileC.js", + "outdir/simple/FolderB/fileB.js.map", + "outdir/simple/FolderB/fileB.js" + ] +} \ No newline at end of file diff --git a/tests/baselines/reference/project/rootDirectoryWithSourceRoot/node/rootDirectoryWithSourceRoot.sourcemap.txt b/tests/baselines/reference/project/rootDirectoryWithSourceRoot/node/rootDirectoryWithSourceRoot.sourcemap.txt new file mode 100644 index 00000000000..7c5843bdd34 --- /dev/null +++ b/tests/baselines/reference/project/rootDirectoryWithSourceRoot/node/rootDirectoryWithSourceRoot.sourcemap.txt @@ -0,0 +1,123 @@ +=================================================================== +JsFile: fileC.js +mapUrl: fileC.js.map +sourceRoot: SourceRootPath/ +sources: FolderB/FolderC/fileC.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:outdir/simple/FolderB/FolderC/fileC.js +sourceFile:FolderB/FolderC/fileC.ts +------------------------------------------------------------------- +>>>var C = (function () { +1 > +2 >^^^^^^^^^^^^^^^^^^^-> +1 > +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +--- +>>> function C() { +1->^^^^ +2 > ^^-> +1-> +1->Emitted(2, 5) Source(1, 1) + SourceIndex(0) name (C) +--- +>>> } +1->^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1->class C { + > +2 > } +1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (C.constructor) +2 >Emitted(3, 6) Source(2, 2) + SourceIndex(0) name (C.constructor) +--- +>>> return C; +1->^^^^ +2 > ^^^^^^^^ +1-> +2 > } +1->Emitted(4, 5) Source(2, 1) + SourceIndex(0) name (C) +2 >Emitted(4, 13) Source(2, 2) + SourceIndex(0) name (C) +--- +>>>})(); +1 > +2 >^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >} +3 > +4 > class C { + > } +1 >Emitted(5, 1) Source(2, 1) + SourceIndex(0) name (C) +2 >Emitted(5, 2) Source(2, 2) + SourceIndex(0) name (C) +3 >Emitted(5, 2) Source(1, 1) + SourceIndex(0) +4 >Emitted(5, 6) Source(2, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=fileC.js.map=================================================================== +JsFile: fileB.js +mapUrl: fileB.js.map +sourceRoot: SourceRootPath/ +sources: FolderB/fileB.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:outdir/simple/FolderB/fileB.js +sourceFile:FolderB/fileB.ts +------------------------------------------------------------------- +>>>/// +1 > +2 > +3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 >/// + > +2 > +3 >/// +1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +3 >Emitted(1, 41) Source(1, 41) + SourceIndex(0) +--- +>>>var B = (function () { +>>> function B() { +1 >^^^^ +2 > ^^-> +1 > + > +1 >Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (B) +--- +>>> } +1->^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1->class B { + > public c: C; + > +2 > } +1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (B.constructor) +2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (B.constructor) +--- +>>> return B; +1->^^^^ +2 > ^^^^^^^^ +1-> +2 > } +1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (B) +2 >Emitted(5, 13) Source(4, 2) + SourceIndex(0) name (B) +--- +>>>})(); +1 > +2 >^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >} +3 > +4 > class B { + > public c: C; + > } +1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (B) +2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (B) +3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) +4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=fileB.js.map \ No newline at end of file diff --git a/tests/cases/project/rootDirectory.json b/tests/cases/project/rootDirectory.json new file mode 100644 index 00000000000..6dad3982f93 --- /dev/null +++ b/tests/cases/project/rootDirectory.json @@ -0,0 +1,12 @@ +{ + "scenario": "rootDirectory: specify rootDirectory", + "projectRoot": "tests/cases/projects/rootDirectory", + "inputFiles": [ + "FolderA/FolderB/fileB.ts" + ], + "outDir": "outdir/simple", + "rootDir": "FolderA", + "sourceMap": true, + "declaration": true, + "baselineCheck": true +} \ No newline at end of file diff --git a/tests/cases/project/rootDirectoryErrors.json b/tests/cases/project/rootDirectoryErrors.json new file mode 100644 index 00000000000..18a256486d0 --- /dev/null +++ b/tests/cases/project/rootDirectoryErrors.json @@ -0,0 +1,11 @@ +{ + "scenario": "rootDirectory: Files outside the rootDirectory", + "projectRoot": "tests/cases/projects/rootDirectory", + "inputFiles": [ + "FolderA/FolderB/fileB.ts" + ], + "outDir": "outdir/simple", + "rootDir": "FolderA/FolderB/FolderC", + "declaration": true, + "baselineCheck": true +} \ No newline at end of file diff --git a/tests/cases/project/rootDirectoryWithSourceRoot.json b/tests/cases/project/rootDirectoryWithSourceRoot.json new file mode 100644 index 00000000000..227b55c13fd --- /dev/null +++ b/tests/cases/project/rootDirectoryWithSourceRoot.json @@ -0,0 +1,12 @@ +{ + "scenario": "rootDirectory: specify rootDirectory with sourceRoot", + "projectRoot": "tests/cases/projects/rootDirectory", + "inputFiles": [ + "FolderA/FolderB/fileB.ts" + ], + "outDir": "outdir/simple", + "rootDir": "FolderA", + "sourceMap": true, + "sourceRoot": "SourceRootPath", + "baselineCheck": true +} \ No newline at end of file diff --git a/tests/cases/projects/rootDirectory/FolderA/FolderB/FolderC/fileC.ts b/tests/cases/projects/rootDirectory/FolderA/FolderB/FolderC/fileC.ts new file mode 100644 index 00000000000..f4885b3ca74 --- /dev/null +++ b/tests/cases/projects/rootDirectory/FolderA/FolderB/FolderC/fileC.ts @@ -0,0 +1,2 @@ +class C { +} diff --git a/tests/cases/projects/rootDirectory/FolderA/FolderB/fileB.ts b/tests/cases/projects/rootDirectory/FolderA/FolderB/fileB.ts new file mode 100644 index 00000000000..03e0f4ad332 --- /dev/null +++ b/tests/cases/projects/rootDirectory/FolderA/FolderB/fileB.ts @@ -0,0 +1,4 @@ +/// +class B { + public c: C; +} From a2e888de13b6c99e950dd5d47d4de1d69279ce25 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Tue, 14 Apr 2015 22:20:08 -0700 Subject: [PATCH 04/45] Accept baselines --- .../reference/APISample_compile.types | 32 ++++----- .../reference/APISample_linter.types | 30 ++++---- .../reference/APISample_transform.types | 12 ++-- .../reference/APISample_watcher.types | 70 +++++++++---------- 4 files changed, 72 insertions(+), 72 deletions(-) diff --git a/tests/baselines/reference/APISample_compile.types b/tests/baselines/reference/APISample_compile.types index d147ded3f0e..fef97ec9211 100644 --- a/tests/baselines/reference/APISample_compile.types +++ b/tests/baselines/reference/APISample_compile.types @@ -28,9 +28,9 @@ export function compile(fileNames: string[], options: ts.CompilerOptions): void var program = ts.createProgram(fileNames, options); >program : ts.Program, Symbol(program, Decl(APISample_compile.ts, 14, 7)) >ts.createProgram(fileNames, options) : ts.Program ->ts.createProgram : (rootNames: string[], options: ts.CompilerOptions, host?: ts.CompilerHost) => ts.Program, Symbol(ts.createProgram, Decl(typescript.d.ts, 1201, 113)) +>ts.createProgram : (rootNames: string[], options: ts.CompilerOptions, host?: ts.CompilerHost) => ts.Program, Symbol(ts.createProgram, Decl(typescript.d.ts, 1202, 113)) >ts : typeof ts, Symbol(ts, Decl(APISample_compile.ts, 9, 20)) ->createProgram : (rootNames: string[], options: ts.CompilerOptions, host?: ts.CompilerHost) => ts.Program, Symbol(ts.createProgram, Decl(typescript.d.ts, 1201, 113)) +>createProgram : (rootNames: string[], options: ts.CompilerOptions, host?: ts.CompilerHost) => ts.Program, Symbol(ts.createProgram, Decl(typescript.d.ts, 1202, 113)) >fileNames : string[], Symbol(fileNames, Decl(APISample_compile.ts, 13, 24)) >options : ts.CompilerOptions, Symbol(options, Decl(APISample_compile.ts, 13, 44)) @@ -46,9 +46,9 @@ export function compile(fileNames: string[], options: ts.CompilerOptions): void >ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics) : ts.Diagnostic[] >ts.getPreEmitDiagnostics(program).concat : { (...items: U[]): ts.Diagnostic[]; (...items: ts.Diagnostic[]): ts.Diagnostic[]; }, Symbol(Array.concat, Decl(lib.d.ts, 1025, 13), Decl(lib.d.ts, 1030, 46)) >ts.getPreEmitDiagnostics(program) : ts.Diagnostic[] ->ts.getPreEmitDiagnostics : (program: ts.Program) => ts.Diagnostic[], Symbol(ts.getPreEmitDiagnostics, Decl(typescript.d.ts, 1199, 98)) +>ts.getPreEmitDiagnostics : (program: ts.Program) => ts.Diagnostic[], Symbol(ts.getPreEmitDiagnostics, Decl(typescript.d.ts, 1200, 98)) >ts : typeof ts, Symbol(ts, Decl(APISample_compile.ts, 9, 20)) ->getPreEmitDiagnostics : (program: ts.Program) => ts.Diagnostic[], Symbol(ts.getPreEmitDiagnostics, Decl(typescript.d.ts, 1199, 98)) +>getPreEmitDiagnostics : (program: ts.Program) => ts.Diagnostic[], Symbol(ts.getPreEmitDiagnostics, Decl(typescript.d.ts, 1200, 98)) >program : ts.Program, Symbol(program, Decl(APISample_compile.ts, 14, 7)) >concat : { (...items: U[]): ts.Diagnostic[]; (...items: ts.Diagnostic[]): ts.Diagnostic[]; }, Symbol(Array.concat, Decl(lib.d.ts, 1025, 13), Decl(lib.d.ts, 1030, 46)) >emitResult.diagnostics : ts.Diagnostic[], Symbol(ts.EmitResult.diagnostics, Decl(typescript.d.ts, 820, 29)) @@ -67,11 +67,11 @@ export function compile(fileNames: string[], options: ts.CompilerOptions): void >line : number, Symbol(line, Decl(APISample_compile.ts, 20, 13)) >character : number, Symbol(character, Decl(APISample_compile.ts, 20, 19)) >diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start) : ts.LineAndCharacter ->diagnostic.file.getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter, Symbol(ts.SourceFile.getLineAndCharacterOfPosition, Decl(typescript.d.ts, 1263, 46)) +>diagnostic.file.getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter, Symbol(ts.SourceFile.getLineAndCharacterOfPosition, Decl(typescript.d.ts, 1264, 46)) >diagnostic.file : ts.SourceFile, Symbol(ts.Diagnostic.file, Decl(typescript.d.ts, 1062, 26)) >diagnostic : ts.Diagnostic, Symbol(diagnostic, Decl(APISample_compile.ts, 19, 27)) >file : ts.SourceFile, Symbol(ts.Diagnostic.file, Decl(typescript.d.ts, 1062, 26)) ->getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter, Symbol(ts.SourceFile.getLineAndCharacterOfPosition, Decl(typescript.d.ts, 1263, 46)) +>getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter, Symbol(ts.SourceFile.getLineAndCharacterOfPosition, Decl(typescript.d.ts, 1264, 46)) >diagnostic.start : number, Symbol(ts.Diagnostic.start, Decl(typescript.d.ts, 1063, 25)) >diagnostic : ts.Diagnostic, Symbol(diagnostic, Decl(APISample_compile.ts, 19, 27)) >start : number, Symbol(ts.Diagnostic.start, Decl(typescript.d.ts, 1063, 25)) @@ -79,9 +79,9 @@ export function compile(fileNames: string[], options: ts.CompilerOptions): void var message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n'); >message : string, Symbol(message, Decl(APISample_compile.ts, 21, 11)) >ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n') : string ->ts.flattenDiagnosticMessageText : (messageText: string | ts.DiagnosticMessageChain, newLine: string) => string, Symbol(ts.flattenDiagnosticMessageText, Decl(typescript.d.ts, 1200, 67)) +>ts.flattenDiagnosticMessageText : (messageText: string | ts.DiagnosticMessageChain, newLine: string) => string, Symbol(ts.flattenDiagnosticMessageText, Decl(typescript.d.ts, 1201, 67)) >ts : typeof ts, Symbol(ts, Decl(APISample_compile.ts, 9, 20)) ->flattenDiagnosticMessageText : (messageText: string | ts.DiagnosticMessageChain, newLine: string) => string, Symbol(ts.flattenDiagnosticMessageText, Decl(typescript.d.ts, 1200, 67)) +>flattenDiagnosticMessageText : (messageText: string | ts.DiagnosticMessageChain, newLine: string) => string, Symbol(ts.flattenDiagnosticMessageText, Decl(typescript.d.ts, 1201, 67)) >diagnostic.messageText : string | ts.DiagnosticMessageChain, Symbol(ts.Diagnostic.messageText, Decl(typescript.d.ts, 1065, 23)) >diagnostic : ts.Diagnostic, Symbol(diagnostic, Decl(APISample_compile.ts, 19, 27)) >messageText : string | ts.DiagnosticMessageChain, Symbol(ts.Diagnostic.messageText, Decl(typescript.d.ts, 1065, 23)) @@ -153,16 +153,16 @@ compile(process.argv.slice(2), { target: ts.ScriptTarget.ES5, module: ts.ModuleKind.CommonJS >target : ts.ScriptTarget, Symbol(target, Decl(APISample_compile.ts, 31, 45)) ->ts.ScriptTarget.ES5 : ts.ScriptTarget, Symbol(ts.ScriptTarget.ES5, Decl(typescript.d.ts, 1117, 16)) ->ts.ScriptTarget : typeof ts.ScriptTarget, Symbol(ts.ScriptTarget, Decl(typescript.d.ts, 1115, 5)) +>ts.ScriptTarget.ES5 : ts.ScriptTarget, Symbol(ts.ScriptTarget.ES5, Decl(typescript.d.ts, 1118, 16)) +>ts.ScriptTarget : typeof ts.ScriptTarget, Symbol(ts.ScriptTarget, Decl(typescript.d.ts, 1116, 5)) >ts : typeof ts, Symbol(ts, Decl(APISample_compile.ts, 9, 20)) ->ScriptTarget : typeof ts.ScriptTarget, Symbol(ts.ScriptTarget, Decl(typescript.d.ts, 1115, 5)) ->ES5 : ts.ScriptTarget, Symbol(ts.ScriptTarget.ES5, Decl(typescript.d.ts, 1117, 16)) +>ScriptTarget : typeof ts.ScriptTarget, Symbol(ts.ScriptTarget, Decl(typescript.d.ts, 1116, 5)) +>ES5 : ts.ScriptTarget, Symbol(ts.ScriptTarget.ES5, Decl(typescript.d.ts, 1118, 16)) >module : ts.ModuleKind, Symbol(module, Decl(APISample_compile.ts, 32, 32)) ->ts.ModuleKind.CommonJS : ts.ModuleKind, Symbol(ts.ModuleKind.CommonJS, Decl(typescript.d.ts, 1108, 17)) ->ts.ModuleKind : typeof ts.ModuleKind, Symbol(ts.ModuleKind, Decl(typescript.d.ts, 1106, 5)) +>ts.ModuleKind.CommonJS : ts.ModuleKind, Symbol(ts.ModuleKind.CommonJS, Decl(typescript.d.ts, 1109, 17)) +>ts.ModuleKind : typeof ts.ModuleKind, Symbol(ts.ModuleKind, Decl(typescript.d.ts, 1107, 5)) >ts : typeof ts, Symbol(ts, Decl(APISample_compile.ts, 9, 20)) ->ModuleKind : typeof ts.ModuleKind, Symbol(ts.ModuleKind, Decl(typescript.d.ts, 1106, 5)) ->CommonJS : ts.ModuleKind, Symbol(ts.ModuleKind.CommonJS, Decl(typescript.d.ts, 1108, 17)) +>ModuleKind : typeof ts.ModuleKind, Symbol(ts.ModuleKind, Decl(typescript.d.ts, 1107, 5)) +>CommonJS : ts.ModuleKind, Symbol(ts.ModuleKind.CommonJS, Decl(typescript.d.ts, 1109, 17)) }); diff --git a/tests/baselines/reference/APISample_linter.types b/tests/baselines/reference/APISample_linter.types index c285bc15390..d9628c0fb0e 100644 --- a/tests/baselines/reference/APISample_linter.types +++ b/tests/baselines/reference/APISample_linter.types @@ -22,7 +22,7 @@ export function delint(sourceFile: ts.SourceFile) { >delint : (sourceFile: ts.SourceFile) => void, Symbol(delint, Decl(APISample_linter.ts, 11, 33)) >sourceFile : ts.SourceFile, Symbol(sourceFile, Decl(APISample_linter.ts, 13, 23)) >ts : any, Symbol(ts, Decl(APISample_linter.ts, 11, 6)) ->SourceFile : ts.SourceFile, Symbol(ts.SourceFile, Decl(typescript.d.ts, 740, 5), Decl(typescript.d.ts, 1261, 5)) +>SourceFile : ts.SourceFile, Symbol(ts.SourceFile, Decl(typescript.d.ts, 740, 5), Decl(typescript.d.ts, 1262, 5)) delintNode(sourceFile); >delintNode(sourceFile) : void @@ -33,7 +33,7 @@ export function delint(sourceFile: ts.SourceFile) { >delintNode : (node: ts.Node) => void, Symbol(delintNode, Decl(APISample_linter.ts, 14, 27)) >node : ts.Node, Symbol(node, Decl(APISample_linter.ts, 16, 24)) >ts : any, Symbol(ts, Decl(APISample_linter.ts, 11, 6)) ->Node : ts.Node, Symbol(ts.Node, Decl(typescript.d.ts, 296, 5), Decl(typescript.d.ts, 1221, 32)) +>Node : ts.Node, Symbol(ts.Node, Decl(typescript.d.ts, 296, 5), Decl(typescript.d.ts, 1222, 32)) switch (node.kind) { >node.kind : ts.SyntaxKind, Symbol(ts.Node.kind, Decl(typescript.d.ts, 297, 38)) @@ -219,9 +219,9 @@ export function delint(sourceFile: ts.SourceFile) { ts.forEachChild(node, delintNode); >ts.forEachChild(node, delintNode) : void ->ts.forEachChild : (node: ts.Node, cbNode: (node: ts.Node) => T, cbNodeArray?: (nodes: ts.Node[]) => T) => T, Symbol(ts.forEachChild, Decl(typescript.d.ts, 1186, 48)) +>ts.forEachChild : (node: ts.Node, cbNode: (node: ts.Node) => T, cbNodeArray?: (nodes: ts.Node[]) => T) => T, Symbol(ts.forEachChild, Decl(typescript.d.ts, 1187, 48)) >ts : typeof ts, Symbol(ts, Decl(APISample_linter.ts, 11, 6)) ->forEachChild : (node: ts.Node, cbNode: (node: ts.Node) => T, cbNodeArray?: (nodes: ts.Node[]) => T) => T, Symbol(ts.forEachChild, Decl(typescript.d.ts, 1186, 48)) +>forEachChild : (node: ts.Node, cbNode: (node: ts.Node) => T, cbNodeArray?: (nodes: ts.Node[]) => T) => T, Symbol(ts.forEachChild, Decl(typescript.d.ts, 1187, 48)) >node : ts.Node, Symbol(node, Decl(APISample_linter.ts, 16, 24)) >delintNode : (node: ts.Node) => void, Symbol(delintNode, Decl(APISample_linter.ts, 14, 27)) } @@ -230,20 +230,20 @@ export function delint(sourceFile: ts.SourceFile) { >report : (node: ts.Node, message: string) => void, Symbol(report, Decl(APISample_linter.ts, 48, 5)) >node : ts.Node, Symbol(node, Decl(APISample_linter.ts, 50, 20)) >ts : any, Symbol(ts, Decl(APISample_linter.ts, 11, 6)) ->Node : ts.Node, Symbol(ts.Node, Decl(typescript.d.ts, 296, 5), Decl(typescript.d.ts, 1221, 32)) +>Node : ts.Node, Symbol(ts.Node, Decl(typescript.d.ts, 296, 5), Decl(typescript.d.ts, 1222, 32)) >message : string, Symbol(message, Decl(APISample_linter.ts, 50, 34)) let { line, character } = sourceFile.getLineAndCharacterOfPosition(node.getStart()); >line : number, Symbol(line, Decl(APISample_linter.ts, 51, 13)) >character : number, Symbol(character, Decl(APISample_linter.ts, 51, 19)) >sourceFile.getLineAndCharacterOfPosition(node.getStart()) : ts.LineAndCharacter ->sourceFile.getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter, Symbol(ts.SourceFile.getLineAndCharacterOfPosition, Decl(typescript.d.ts, 1263, 46)) +>sourceFile.getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter, Symbol(ts.SourceFile.getLineAndCharacterOfPosition, Decl(typescript.d.ts, 1264, 46)) >sourceFile : ts.SourceFile, Symbol(sourceFile, Decl(APISample_linter.ts, 13, 23)) ->getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter, Symbol(ts.SourceFile.getLineAndCharacterOfPosition, Decl(typescript.d.ts, 1263, 46)) +>getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter, Symbol(ts.SourceFile.getLineAndCharacterOfPosition, Decl(typescript.d.ts, 1264, 46)) >node.getStart() : number ->node.getStart : (sourceFile?: ts.SourceFile) => number, Symbol(ts.Node.getStart, Decl(typescript.d.ts, 1226, 53)) +>node.getStart : (sourceFile?: ts.SourceFile) => number, Symbol(ts.Node.getStart, Decl(typescript.d.ts, 1227, 53)) >node : ts.Node, Symbol(node, Decl(APISample_linter.ts, 50, 20)) ->getStart : (sourceFile?: ts.SourceFile) => number, Symbol(ts.Node.getStart, Decl(typescript.d.ts, 1226, 53)) +>getStart : (sourceFile?: ts.SourceFile) => number, Symbol(ts.Node.getStart, Decl(typescript.d.ts, 1227, 53)) console.log(`${sourceFile.fileName} (${line + 1},${character + 1}): ${message}`); >console.log(`${sourceFile.fileName} (${line + 1},${character + 1}): ${message}`) : any @@ -286,9 +286,9 @@ fileNames.forEach(fileName => { let sourceFile = ts.createSourceFile(fileName, readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true); >sourceFile : ts.SourceFile, Symbol(sourceFile, Decl(APISample_linter.ts, 59, 7)) >ts.createSourceFile(fileName, readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true) : ts.SourceFile ->ts.createSourceFile : (fileName: string, sourceText: string, languageVersion: ts.ScriptTarget, setParentNodes?: boolean) => ts.SourceFile, Symbol(ts.createSourceFile, Decl(typescript.d.ts, 1190, 62)) +>ts.createSourceFile : (fileName: string, sourceText: string, languageVersion: ts.ScriptTarget, setParentNodes?: boolean) => ts.SourceFile, Symbol(ts.createSourceFile, Decl(typescript.d.ts, 1191, 62)) >ts : typeof ts, Symbol(ts, Decl(APISample_linter.ts, 11, 6)) ->createSourceFile : (fileName: string, sourceText: string, languageVersion: ts.ScriptTarget, setParentNodes?: boolean) => ts.SourceFile, Symbol(ts.createSourceFile, Decl(typescript.d.ts, 1190, 62)) +>createSourceFile : (fileName: string, sourceText: string, languageVersion: ts.ScriptTarget, setParentNodes?: boolean) => ts.SourceFile, Symbol(ts.createSourceFile, Decl(typescript.d.ts, 1191, 62)) >fileName : any, Symbol(fileName, Decl(APISample_linter.ts, 57, 18)) >readFileSync(fileName).toString() : any >readFileSync(fileName).toString : any @@ -296,11 +296,11 @@ fileNames.forEach(fileName => { >readFileSync : any, Symbol(readFileSync, Decl(APISample_linter.ts, 9, 11)) >fileName : any, Symbol(fileName, Decl(APISample_linter.ts, 57, 18)) >toString : any ->ts.ScriptTarget.ES6 : ts.ScriptTarget, Symbol(ts.ScriptTarget.ES6, Decl(typescript.d.ts, 1118, 16)) ->ts.ScriptTarget : typeof ts.ScriptTarget, Symbol(ts.ScriptTarget, Decl(typescript.d.ts, 1115, 5)) +>ts.ScriptTarget.ES6 : ts.ScriptTarget, Symbol(ts.ScriptTarget.ES6, Decl(typescript.d.ts, 1119, 16)) +>ts.ScriptTarget : typeof ts.ScriptTarget, Symbol(ts.ScriptTarget, Decl(typescript.d.ts, 1116, 5)) >ts : typeof ts, Symbol(ts, Decl(APISample_linter.ts, 11, 6)) ->ScriptTarget : typeof ts.ScriptTarget, Symbol(ts.ScriptTarget, Decl(typescript.d.ts, 1115, 5)) ->ES6 : ts.ScriptTarget, Symbol(ts.ScriptTarget.ES6, Decl(typescript.d.ts, 1118, 16)) +>ScriptTarget : typeof ts.ScriptTarget, Symbol(ts.ScriptTarget, Decl(typescript.d.ts, 1116, 5)) +>ES6 : ts.ScriptTarget, Symbol(ts.ScriptTarget.ES6, Decl(typescript.d.ts, 1119, 16)) >true : boolean // delint it diff --git a/tests/baselines/reference/APISample_transform.types b/tests/baselines/reference/APISample_transform.types index 6e27f70d877..4bd9052bffb 100644 --- a/tests/baselines/reference/APISample_transform.types +++ b/tests/baselines/reference/APISample_transform.types @@ -19,17 +19,17 @@ const source = "let x: string = 'string'"; let result = ts.transpile(source, { module: ts.ModuleKind.CommonJS }); >result : string, Symbol(result, Decl(APISample_transform.ts, 13, 3)) >ts.transpile(source, { module: ts.ModuleKind.CommonJS }) : string ->ts.transpile : (input: string, compilerOptions?: ts.CompilerOptions, fileName?: string, diagnostics?: ts.Diagnostic[]) => string, Symbol(ts.transpile, Decl(typescript.d.ts, 1729, 5)) +>ts.transpile : (input: string, compilerOptions?: ts.CompilerOptions, fileName?: string, diagnostics?: ts.Diagnostic[]) => string, Symbol(ts.transpile, Decl(typescript.d.ts, 1730, 5)) >ts : typeof ts, Symbol(ts, Decl(APISample_transform.ts, 9, 6)) ->transpile : (input: string, compilerOptions?: ts.CompilerOptions, fileName?: string, diagnostics?: ts.Diagnostic[]) => string, Symbol(ts.transpile, Decl(typescript.d.ts, 1729, 5)) +>transpile : (input: string, compilerOptions?: ts.CompilerOptions, fileName?: string, diagnostics?: ts.Diagnostic[]) => string, Symbol(ts.transpile, Decl(typescript.d.ts, 1730, 5)) >source : string, Symbol(source, Decl(APISample_transform.ts, 11, 5)) >{ module: ts.ModuleKind.CommonJS } : { [x: string]: ts.ModuleKind; module: ts.ModuleKind; } >module : ts.ModuleKind, Symbol(module, Decl(APISample_transform.ts, 13, 35)) ->ts.ModuleKind.CommonJS : ts.ModuleKind, Symbol(ts.ModuleKind.CommonJS, Decl(typescript.d.ts, 1108, 17)) ->ts.ModuleKind : typeof ts.ModuleKind, Symbol(ts.ModuleKind, Decl(typescript.d.ts, 1106, 5)) +>ts.ModuleKind.CommonJS : ts.ModuleKind, Symbol(ts.ModuleKind.CommonJS, Decl(typescript.d.ts, 1109, 17)) +>ts.ModuleKind : typeof ts.ModuleKind, Symbol(ts.ModuleKind, Decl(typescript.d.ts, 1107, 5)) >ts : typeof ts, Symbol(ts, Decl(APISample_transform.ts, 9, 6)) ->ModuleKind : typeof ts.ModuleKind, Symbol(ts.ModuleKind, Decl(typescript.d.ts, 1106, 5)) ->CommonJS : ts.ModuleKind, Symbol(ts.ModuleKind.CommonJS, Decl(typescript.d.ts, 1108, 17)) +>ModuleKind : typeof ts.ModuleKind, Symbol(ts.ModuleKind, Decl(typescript.d.ts, 1107, 5)) +>CommonJS : ts.ModuleKind, Symbol(ts.ModuleKind.CommonJS, Decl(typescript.d.ts, 1109, 17)) console.log(JSON.stringify(result)); >console.log(JSON.stringify(result)) : any diff --git a/tests/baselines/reference/APISample_watcher.types b/tests/baselines/reference/APISample_watcher.types index abc915e3776..a1902c98e48 100644 --- a/tests/baselines/reference/APISample_watcher.types +++ b/tests/baselines/reference/APISample_watcher.types @@ -59,7 +59,7 @@ function watch(rootFileNames: string[], options: ts.CompilerOptions) { const servicesHost: ts.LanguageServiceHost = { >servicesHost : ts.LanguageServiceHost, Symbol(servicesHost, Decl(APISample_watcher.ts, 23, 9)) >ts : any, Symbol(ts, Decl(APISample_watcher.ts, 12, 6)) ->LanguageServiceHost : ts.LanguageServiceHost, Symbol(ts.LanguageServiceHost, Decl(typescript.d.ts, 1295, 5)) +>LanguageServiceHost : ts.LanguageServiceHost, Symbol(ts.LanguageServiceHost, Decl(typescript.d.ts, 1296, 5)) >{ getScriptFileNames: () => rootFileNames, getScriptVersion: (fileName) => files[fileName] && files[fileName].version.toString(), getScriptSnapshot: (fileName) => { if (!fs.existsSync(fileName)) { return undefined; } return ts.ScriptSnapshot.fromString(fs.readFileSync(fileName).toString()); }, getCurrentDirectory: () => process.cwd(), getCompilationSettings: () => options, getDefaultLibFileName: (options) => ts.getDefaultLibFilePath(options), } : { getScriptFileNames: () => string[]; getScriptVersion: (fileName: string) => string; getScriptSnapshot: (fileName: string) => ts.IScriptSnapshot; getCurrentDirectory: () => any; getCompilationSettings: () => ts.CompilerOptions; getDefaultLibFileName: (options: ts.CompilerOptions) => string; } getScriptFileNames: () => rootFileNames, @@ -103,11 +103,11 @@ function watch(rootFileNames: string[], options: ts.CompilerOptions) { return ts.ScriptSnapshot.fromString(fs.readFileSync(fileName).toString()); >ts.ScriptSnapshot.fromString(fs.readFileSync(fileName).toString()) : ts.IScriptSnapshot ->ts.ScriptSnapshot.fromString : (text: string) => ts.IScriptSnapshot, Symbol(ts.ScriptSnapshot.fromString, Decl(typescript.d.ts, 1288, 27)) ->ts.ScriptSnapshot : typeof ts.ScriptSnapshot, Symbol(ts.ScriptSnapshot, Decl(typescript.d.ts, 1287, 5)) +>ts.ScriptSnapshot.fromString : (text: string) => ts.IScriptSnapshot, Symbol(ts.ScriptSnapshot.fromString, Decl(typescript.d.ts, 1289, 27)) +>ts.ScriptSnapshot : typeof ts.ScriptSnapshot, Symbol(ts.ScriptSnapshot, Decl(typescript.d.ts, 1288, 5)) >ts : typeof ts, Symbol(ts, Decl(APISample_watcher.ts, 12, 6)) ->ScriptSnapshot : typeof ts.ScriptSnapshot, Symbol(ts.ScriptSnapshot, Decl(typescript.d.ts, 1287, 5)) ->fromString : (text: string) => ts.IScriptSnapshot, Symbol(ts.ScriptSnapshot.fromString, Decl(typescript.d.ts, 1288, 27)) +>ScriptSnapshot : typeof ts.ScriptSnapshot, Symbol(ts.ScriptSnapshot, Decl(typescript.d.ts, 1288, 5)) +>fromString : (text: string) => ts.IScriptSnapshot, Symbol(ts.ScriptSnapshot.fromString, Decl(typescript.d.ts, 1289, 27)) >fs.readFileSync(fileName).toString() : any >fs.readFileSync(fileName).toString : any >fs.readFileSync(fileName) : any @@ -136,9 +136,9 @@ function watch(rootFileNames: string[], options: ts.CompilerOptions) { >(options) => ts.getDefaultLibFilePath(options) : (options: ts.CompilerOptions) => string >options : ts.CompilerOptions, Symbol(options, Decl(APISample_watcher.ts, 35, 32)) >ts.getDefaultLibFilePath(options) : string ->ts.getDefaultLibFilePath : (options: ts.CompilerOptions) => string, Symbol(ts.getDefaultLibFilePath, Decl(typescript.d.ts, 1737, 44)) +>ts.getDefaultLibFilePath : (options: ts.CompilerOptions) => string, Symbol(ts.getDefaultLibFilePath, Decl(typescript.d.ts, 1738, 44)) >ts : typeof ts, Symbol(ts, Decl(APISample_watcher.ts, 12, 6)) ->getDefaultLibFilePath : (options: ts.CompilerOptions) => string, Symbol(ts.getDefaultLibFilePath, Decl(typescript.d.ts, 1737, 44)) +>getDefaultLibFilePath : (options: ts.CompilerOptions) => string, Symbol(ts.getDefaultLibFilePath, Decl(typescript.d.ts, 1738, 44)) >options : ts.CompilerOptions, Symbol(options, Decl(APISample_watcher.ts, 35, 32)) }; @@ -147,14 +147,14 @@ function watch(rootFileNames: string[], options: ts.CompilerOptions) { const services = ts.createLanguageService(servicesHost, ts.createDocumentRegistry()) >services : ts.LanguageService, Symbol(services, Decl(APISample_watcher.ts, 39, 9)) >ts.createLanguageService(servicesHost, ts.createDocumentRegistry()) : ts.LanguageService ->ts.createLanguageService : (host: ts.LanguageServiceHost, documentRegistry?: ts.DocumentRegistry) => ts.LanguageService, Symbol(ts.createLanguageService, Decl(typescript.d.ts, 1735, 97)) +>ts.createLanguageService : (host: ts.LanguageServiceHost, documentRegistry?: ts.DocumentRegistry) => ts.LanguageService, Symbol(ts.createLanguageService, Decl(typescript.d.ts, 1736, 97)) >ts : typeof ts, Symbol(ts, Decl(APISample_watcher.ts, 12, 6)) ->createLanguageService : (host: ts.LanguageServiceHost, documentRegistry?: ts.DocumentRegistry) => ts.LanguageService, Symbol(ts.createLanguageService, Decl(typescript.d.ts, 1735, 97)) +>createLanguageService : (host: ts.LanguageServiceHost, documentRegistry?: ts.DocumentRegistry) => ts.LanguageService, Symbol(ts.createLanguageService, Decl(typescript.d.ts, 1736, 97)) >servicesHost : ts.LanguageServiceHost, Symbol(servicesHost, Decl(APISample_watcher.ts, 23, 9)) >ts.createDocumentRegistry() : ts.DocumentRegistry ->ts.createDocumentRegistry : () => ts.DocumentRegistry, Symbol(ts.createDocumentRegistry, Decl(typescript.d.ts, 1733, 193)) +>ts.createDocumentRegistry : () => ts.DocumentRegistry, Symbol(ts.createDocumentRegistry, Decl(typescript.d.ts, 1734, 193)) >ts : typeof ts, Symbol(ts, Decl(APISample_watcher.ts, 12, 6)) ->createDocumentRegistry : () => ts.DocumentRegistry, Symbol(ts.createDocumentRegistry, Decl(typescript.d.ts, 1733, 193)) +>createDocumentRegistry : () => ts.DocumentRegistry, Symbol(ts.createDocumentRegistry, Decl(typescript.d.ts, 1734, 193)) // Now let's watch the files rootFileNames.forEach(fileName => { @@ -231,16 +231,16 @@ function watch(rootFileNames: string[], options: ts.CompilerOptions) { let output = services.getEmitOutput(fileName); >output : ts.EmitOutput, Symbol(output, Decl(APISample_watcher.ts, 64, 11)) >services.getEmitOutput(fileName) : ts.EmitOutput ->services.getEmitOutput : (fileName: string) => ts.EmitOutput, Symbol(ts.LanguageService.getEmitOutput, Decl(typescript.d.ts, 1339, 132)) +>services.getEmitOutput : (fileName: string) => ts.EmitOutput, Symbol(ts.LanguageService.getEmitOutput, Decl(typescript.d.ts, 1340, 132)) >services : ts.LanguageService, Symbol(services, Decl(APISample_watcher.ts, 39, 9)) ->getEmitOutput : (fileName: string) => ts.EmitOutput, Symbol(ts.LanguageService.getEmitOutput, Decl(typescript.d.ts, 1339, 132)) +>getEmitOutput : (fileName: string) => ts.EmitOutput, Symbol(ts.LanguageService.getEmitOutput, Decl(typescript.d.ts, 1340, 132)) >fileName : string, Symbol(fileName, Decl(APISample_watcher.ts, 63, 22)) if (!output.emitSkipped) { >!output.emitSkipped : boolean ->output.emitSkipped : boolean, Symbol(ts.EmitOutput.emitSkipped, Decl(typescript.d.ts, 1542, 34)) +>output.emitSkipped : boolean, Symbol(ts.EmitOutput.emitSkipped, Decl(typescript.d.ts, 1543, 34)) >output : ts.EmitOutput, Symbol(output, Decl(APISample_watcher.ts, 64, 11)) ->emitSkipped : boolean, Symbol(ts.EmitOutput.emitSkipped, Decl(typescript.d.ts, 1542, 34)) +>emitSkipped : boolean, Symbol(ts.EmitOutput.emitSkipped, Decl(typescript.d.ts, 1543, 34)) console.log(`Emitting ${fileName}`); >console.log(`Emitting ${fileName}`) : any @@ -268,9 +268,9 @@ function watch(rootFileNames: string[], options: ts.CompilerOptions) { output.outputFiles.forEach(o => { >output.outputFiles.forEach(o => { fs.writeFileSync(o.name, o.text, "utf8"); }) : void >output.outputFiles.forEach : (callbackfn: (value: ts.OutputFile, index: number, array: ts.OutputFile[]) => void, thisArg?: any) => void, Symbol(Array.forEach, Decl(lib.d.ts, 1108, 95)) ->output.outputFiles : ts.OutputFile[], Symbol(ts.EmitOutput.outputFiles, Decl(typescript.d.ts, 1541, 26)) +>output.outputFiles : ts.OutputFile[], Symbol(ts.EmitOutput.outputFiles, Decl(typescript.d.ts, 1542, 26)) >output : ts.EmitOutput, Symbol(output, Decl(APISample_watcher.ts, 64, 11)) ->outputFiles : ts.OutputFile[], Symbol(ts.EmitOutput.outputFiles, Decl(typescript.d.ts, 1541, 26)) +>outputFiles : ts.OutputFile[], Symbol(ts.EmitOutput.outputFiles, Decl(typescript.d.ts, 1542, 26)) >forEach : (callbackfn: (value: ts.OutputFile, index: number, array: ts.OutputFile[]) => void, thisArg?: any) => void, Symbol(Array.forEach, Decl(lib.d.ts, 1108, 95)) >o => { fs.writeFileSync(o.name, o.text, "utf8"); } : (o: ts.OutputFile) => void >o : ts.OutputFile, Symbol(o, Decl(APISample_watcher.ts, 74, 35)) @@ -280,12 +280,12 @@ function watch(rootFileNames: string[], options: ts.CompilerOptions) { >fs.writeFileSync : any >fs : any, Symbol(fs, Decl(APISample_watcher.ts, 9, 11)) >writeFileSync : any ->o.name : string, Symbol(ts.OutputFile.name, Decl(typescript.d.ts, 1550, 26)) +>o.name : string, Symbol(ts.OutputFile.name, Decl(typescript.d.ts, 1551, 26)) >o : ts.OutputFile, Symbol(o, Decl(APISample_watcher.ts, 74, 35)) ->name : string, Symbol(ts.OutputFile.name, Decl(typescript.d.ts, 1550, 26)) ->o.text : string, Symbol(ts.OutputFile.text, Decl(typescript.d.ts, 1552, 36)) +>name : string, Symbol(ts.OutputFile.name, Decl(typescript.d.ts, 1551, 26)) +>o.text : string, Symbol(ts.OutputFile.text, Decl(typescript.d.ts, 1553, 36)) >o : ts.OutputFile, Symbol(o, Decl(APISample_watcher.ts, 74, 35)) ->text : string, Symbol(ts.OutputFile.text, Decl(typescript.d.ts, 1552, 36)) +>text : string, Symbol(ts.OutputFile.text, Decl(typescript.d.ts, 1553, 36)) >"utf8" : string }); @@ -302,24 +302,24 @@ function watch(rootFileNames: string[], options: ts.CompilerOptions) { >services.getCompilerOptionsDiagnostics() .concat(services.getSyntacticDiagnostics(fileName)) : ts.Diagnostic[] >services.getCompilerOptionsDiagnostics() .concat : { (...items: U[]): ts.Diagnostic[]; (...items: ts.Diagnostic[]): ts.Diagnostic[]; }, Symbol(Array.concat, Decl(lib.d.ts, 1025, 13), Decl(lib.d.ts, 1030, 46)) >services.getCompilerOptionsDiagnostics() : ts.Diagnostic[] ->services.getCompilerOptionsDiagnostics : () => ts.Diagnostic[], Symbol(ts.LanguageService.getCompilerOptionsDiagnostics, Decl(typescript.d.ts, 1313, 63)) +>services.getCompilerOptionsDiagnostics : () => ts.Diagnostic[], Symbol(ts.LanguageService.getCompilerOptionsDiagnostics, Decl(typescript.d.ts, 1314, 63)) >services : ts.LanguageService, Symbol(services, Decl(APISample_watcher.ts, 39, 9)) ->getCompilerOptionsDiagnostics : () => ts.Diagnostic[], Symbol(ts.LanguageService.getCompilerOptionsDiagnostics, Decl(typescript.d.ts, 1313, 63)) +>getCompilerOptionsDiagnostics : () => ts.Diagnostic[], Symbol(ts.LanguageService.getCompilerOptionsDiagnostics, Decl(typescript.d.ts, 1314, 63)) .concat(services.getSyntacticDiagnostics(fileName)) >concat : { (...items: U[]): ts.Diagnostic[]; (...items: ts.Diagnostic[]): ts.Diagnostic[]; }, Symbol(Array.concat, Decl(lib.d.ts, 1025, 13), Decl(lib.d.ts, 1030, 46)) >services.getSyntacticDiagnostics(fileName) : ts.Diagnostic[] ->services.getSyntacticDiagnostics : (fileName: string) => ts.Diagnostic[], Symbol(ts.LanguageService.getSyntacticDiagnostics, Decl(typescript.d.ts, 1311, 37)) +>services.getSyntacticDiagnostics : (fileName: string) => ts.Diagnostic[], Symbol(ts.LanguageService.getSyntacticDiagnostics, Decl(typescript.d.ts, 1312, 37)) >services : ts.LanguageService, Symbol(services, Decl(APISample_watcher.ts, 39, 9)) ->getSyntacticDiagnostics : (fileName: string) => ts.Diagnostic[], Symbol(ts.LanguageService.getSyntacticDiagnostics, Decl(typescript.d.ts, 1311, 37)) +>getSyntacticDiagnostics : (fileName: string) => ts.Diagnostic[], Symbol(ts.LanguageService.getSyntacticDiagnostics, Decl(typescript.d.ts, 1312, 37)) >fileName : string, Symbol(fileName, Decl(APISample_watcher.ts, 79, 23)) .concat(services.getSemanticDiagnostics(fileName)); >concat : { (...items: U[]): ts.Diagnostic[]; (...items: ts.Diagnostic[]): ts.Diagnostic[]; }, Symbol(Array.concat, Decl(lib.d.ts, 1025, 13), Decl(lib.d.ts, 1030, 46)) >services.getSemanticDiagnostics(fileName) : ts.Diagnostic[] ->services.getSemanticDiagnostics : (fileName: string) => ts.Diagnostic[], Symbol(ts.LanguageService.getSemanticDiagnostics, Decl(typescript.d.ts, 1312, 64)) +>services.getSemanticDiagnostics : (fileName: string) => ts.Diagnostic[], Symbol(ts.LanguageService.getSemanticDiagnostics, Decl(typescript.d.ts, 1313, 64)) >services : ts.LanguageService, Symbol(services, Decl(APISample_watcher.ts, 39, 9)) ->getSemanticDiagnostics : (fileName: string) => ts.Diagnostic[], Symbol(ts.LanguageService.getSemanticDiagnostics, Decl(typescript.d.ts, 1312, 64)) +>getSemanticDiagnostics : (fileName: string) => ts.Diagnostic[], Symbol(ts.LanguageService.getSemanticDiagnostics, Decl(typescript.d.ts, 1313, 64)) >fileName : string, Symbol(fileName, Decl(APISample_watcher.ts, 79, 23)) allDiagnostics.forEach(diagnostic => { @@ -333,9 +333,9 @@ function watch(rootFileNames: string[], options: ts.CompilerOptions) { let message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n"); >message : string, Symbol(message, Decl(APISample_watcher.ts, 85, 15)) >ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n") : string ->ts.flattenDiagnosticMessageText : (messageText: string | ts.DiagnosticMessageChain, newLine: string) => string, Symbol(ts.flattenDiagnosticMessageText, Decl(typescript.d.ts, 1200, 67)) +>ts.flattenDiagnosticMessageText : (messageText: string | ts.DiagnosticMessageChain, newLine: string) => string, Symbol(ts.flattenDiagnosticMessageText, Decl(typescript.d.ts, 1201, 67)) >ts : typeof ts, Symbol(ts, Decl(APISample_watcher.ts, 12, 6)) ->flattenDiagnosticMessageText : (messageText: string | ts.DiagnosticMessageChain, newLine: string) => string, Symbol(ts.flattenDiagnosticMessageText, Decl(typescript.d.ts, 1200, 67)) +>flattenDiagnosticMessageText : (messageText: string | ts.DiagnosticMessageChain, newLine: string) => string, Symbol(ts.flattenDiagnosticMessageText, Decl(typescript.d.ts, 1201, 67)) >diagnostic.messageText : string | ts.DiagnosticMessageChain, Symbol(ts.Diagnostic.messageText, Decl(typescript.d.ts, 1065, 23)) >diagnostic : ts.Diagnostic, Symbol(diagnostic, Decl(APISample_watcher.ts, 84, 31)) >messageText : string | ts.DiagnosticMessageChain, Symbol(ts.Diagnostic.messageText, Decl(typescript.d.ts, 1065, 23)) @@ -350,11 +350,11 @@ function watch(rootFileNames: string[], options: ts.CompilerOptions) { >line : number, Symbol(line, Decl(APISample_watcher.ts, 87, 21)) >character : number, Symbol(character, Decl(APISample_watcher.ts, 87, 27)) >diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start) : ts.LineAndCharacter ->diagnostic.file.getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter, Symbol(ts.SourceFile.getLineAndCharacterOfPosition, Decl(typescript.d.ts, 1263, 46)) +>diagnostic.file.getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter, Symbol(ts.SourceFile.getLineAndCharacterOfPosition, Decl(typescript.d.ts, 1264, 46)) >diagnostic.file : ts.SourceFile, Symbol(ts.Diagnostic.file, Decl(typescript.d.ts, 1062, 26)) >diagnostic : ts.Diagnostic, Symbol(diagnostic, Decl(APISample_watcher.ts, 84, 31)) >file : ts.SourceFile, Symbol(ts.Diagnostic.file, Decl(typescript.d.ts, 1062, 26)) ->getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter, Symbol(ts.SourceFile.getLineAndCharacterOfPosition, Decl(typescript.d.ts, 1263, 46)) +>getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter, Symbol(ts.SourceFile.getLineAndCharacterOfPosition, Decl(typescript.d.ts, 1264, 46)) >diagnostic.start : number, Symbol(ts.Diagnostic.start, Decl(typescript.d.ts, 1063, 25)) >diagnostic : ts.Diagnostic, Symbol(diagnostic, Decl(APISample_watcher.ts, 84, 31)) >start : number, Symbol(ts.Diagnostic.start, Decl(typescript.d.ts, 1063, 25)) @@ -435,9 +435,9 @@ watch(currentDirectoryFiles, { module: ts.ModuleKind.CommonJS }); >currentDirectoryFiles : any, Symbol(currentDirectoryFiles, Decl(APISample_watcher.ts, 98, 5)) >{ module: ts.ModuleKind.CommonJS } : { [x: string]: ts.ModuleKind; module: ts.ModuleKind; } >module : ts.ModuleKind, Symbol(module, Decl(APISample_watcher.ts, 102, 30)) ->ts.ModuleKind.CommonJS : ts.ModuleKind, Symbol(ts.ModuleKind.CommonJS, Decl(typescript.d.ts, 1108, 17)) ->ts.ModuleKind : typeof ts.ModuleKind, Symbol(ts.ModuleKind, Decl(typescript.d.ts, 1106, 5)) +>ts.ModuleKind.CommonJS : ts.ModuleKind, Symbol(ts.ModuleKind.CommonJS, Decl(typescript.d.ts, 1109, 17)) +>ts.ModuleKind : typeof ts.ModuleKind, Symbol(ts.ModuleKind, Decl(typescript.d.ts, 1107, 5)) >ts : typeof ts, Symbol(ts, Decl(APISample_watcher.ts, 12, 6)) ->ModuleKind : typeof ts.ModuleKind, Symbol(ts.ModuleKind, Decl(typescript.d.ts, 1106, 5)) ->CommonJS : ts.ModuleKind, Symbol(ts.ModuleKind.CommonJS, Decl(typescript.d.ts, 1108, 17)) +>ModuleKind : typeof ts.ModuleKind, Symbol(ts.ModuleKind, Decl(typescript.d.ts, 1107, 5)) +>CommonJS : ts.ModuleKind, Symbol(ts.ModuleKind.CommonJS, Decl(typescript.d.ts, 1109, 17)) From 16bbedcbf9ab0b8eae2fd797f3edf87e2f842d12 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Tue, 14 Apr 2015 22:27:42 -0700 Subject: [PATCH 05/45] Add source maps to rootdir tests --- .../rootDirectory/amd/outdir/simple/FolderB/FolderC/fileC.js | 1 + .../project/rootDirectory/amd/outdir/simple/FolderB/fileB.js | 1 + .../reference/project/rootDirectory/amd/rootDirectory.json | 3 +++ .../rootDirectory/node/outdir/simple/FolderB/FolderC/fileC.js | 1 + .../project/rootDirectory/node/outdir/simple/FolderB/fileB.js | 1 + .../reference/project/rootDirectory/node/rootDirectory.json | 3 +++ 6 files changed, 10 insertions(+) diff --git a/tests/baselines/reference/project/rootDirectory/amd/outdir/simple/FolderB/FolderC/fileC.js b/tests/baselines/reference/project/rootDirectory/amd/outdir/simple/FolderB/FolderC/fileC.js index 325ac60ee32..8840c2117cf 100644 --- a/tests/baselines/reference/project/rootDirectory/amd/outdir/simple/FolderB/FolderC/fileC.js +++ b/tests/baselines/reference/project/rootDirectory/amd/outdir/simple/FolderB/FolderC/fileC.js @@ -3,3 +3,4 @@ var C = (function () { } return C; })(); +//# sourceMappingURL=fileC.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/rootDirectory/amd/outdir/simple/FolderB/fileB.js b/tests/baselines/reference/project/rootDirectory/amd/outdir/simple/FolderB/fileB.js index 99199ca1742..84af55d2d89 100644 --- a/tests/baselines/reference/project/rootDirectory/amd/outdir/simple/FolderB/fileB.js +++ b/tests/baselines/reference/project/rootDirectory/amd/outdir/simple/FolderB/fileB.js @@ -4,3 +4,4 @@ var B = (function () { } return B; })(); +//# sourceMappingURL=fileB.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/rootDirectory/amd/rootDirectory.json b/tests/baselines/reference/project/rootDirectory/amd/rootDirectory.json index 111f0277ec1..2ec18b3ac5a 100644 --- a/tests/baselines/reference/project/rootDirectory/amd/rootDirectory.json +++ b/tests/baselines/reference/project/rootDirectory/amd/rootDirectory.json @@ -5,6 +5,7 @@ "FolderA/FolderB/fileB.ts" ], "outDir": "outdir/simple", + "sourceMap": true, "declaration": true, "baselineCheck": true, "rootDir": "FolderA", @@ -14,8 +15,10 @@ "FolderA/FolderB/fileB.ts" ], "emittedFiles": [ + "outdir/simple/FolderB/FolderC/fileC.js.map", "outdir/simple/FolderB/FolderC/fileC.js", "outdir/simple/FolderB/FolderC/fileC.d.ts", + "outdir/simple/FolderB/fileB.js.map", "outdir/simple/FolderB/fileB.js", "outdir/simple/FolderB/fileB.d.ts" ] diff --git a/tests/baselines/reference/project/rootDirectory/node/outdir/simple/FolderB/FolderC/fileC.js b/tests/baselines/reference/project/rootDirectory/node/outdir/simple/FolderB/FolderC/fileC.js index 325ac60ee32..8840c2117cf 100644 --- a/tests/baselines/reference/project/rootDirectory/node/outdir/simple/FolderB/FolderC/fileC.js +++ b/tests/baselines/reference/project/rootDirectory/node/outdir/simple/FolderB/FolderC/fileC.js @@ -3,3 +3,4 @@ var C = (function () { } return C; })(); +//# sourceMappingURL=fileC.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/rootDirectory/node/outdir/simple/FolderB/fileB.js b/tests/baselines/reference/project/rootDirectory/node/outdir/simple/FolderB/fileB.js index 99199ca1742..84af55d2d89 100644 --- a/tests/baselines/reference/project/rootDirectory/node/outdir/simple/FolderB/fileB.js +++ b/tests/baselines/reference/project/rootDirectory/node/outdir/simple/FolderB/fileB.js @@ -4,3 +4,4 @@ var B = (function () { } return B; })(); +//# sourceMappingURL=fileB.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/rootDirectory/node/rootDirectory.json b/tests/baselines/reference/project/rootDirectory/node/rootDirectory.json index 111f0277ec1..2ec18b3ac5a 100644 --- a/tests/baselines/reference/project/rootDirectory/node/rootDirectory.json +++ b/tests/baselines/reference/project/rootDirectory/node/rootDirectory.json @@ -5,6 +5,7 @@ "FolderA/FolderB/fileB.ts" ], "outDir": "outdir/simple", + "sourceMap": true, "declaration": true, "baselineCheck": true, "rootDir": "FolderA", @@ -14,8 +15,10 @@ "FolderA/FolderB/fileB.ts" ], "emittedFiles": [ + "outdir/simple/FolderB/FolderC/fileC.js.map", "outdir/simple/FolderB/FolderC/fileC.js", "outdir/simple/FolderB/FolderC/fileC.d.ts", + "outdir/simple/FolderB/fileB.js.map", "outdir/simple/FolderB/fileB.js", "outdir/simple/FolderB/fileB.d.ts" ] From bda1f59d7b04bee5ac585e63bbf3ffff3247cfe2 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 16 Apr 2015 14:39:02 -0700 Subject: [PATCH 06/45] Include property in union type only if all underlying properties are public --- src/compiler/checker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index e9430a058f8..630d108c0e9 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -2945,7 +2945,7 @@ module ts { let type = getApparentType(current); if (type !== unknownType) { let prop = getPropertyOfType(type, name); - if (!prop) { + if (!prop || getDeclarationFlagsFromSymbol(prop) & (NodeFlags.Private | NodeFlags.Protected)) { return undefined; } if (!props) { From 0e0cac8ce0fff920e7f423f8846146c2887ebe11 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 16 Apr 2015 14:41:33 -0700 Subject: [PATCH 07/45] Adding test --- .../unionTypePropertyAccessibility.errors.txt | 87 +++++++++++++++ .../unionTypePropertyAccessibility.js | 101 ++++++++++++++++++ .../union/unionTypePropertyAccessibility.ts | 47 ++++++++ 3 files changed, 235 insertions(+) create mode 100644 tests/baselines/reference/unionTypePropertyAccessibility.errors.txt create mode 100644 tests/baselines/reference/unionTypePropertyAccessibility.js create mode 100644 tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts diff --git a/tests/baselines/reference/unionTypePropertyAccessibility.errors.txt b/tests/baselines/reference/unionTypePropertyAccessibility.errors.txt new file mode 100644 index 00000000000..ab60674ddc6 --- /dev/null +++ b/tests/baselines/reference/unionTypePropertyAccessibility.errors.txt @@ -0,0 +1,87 @@ +tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts(35,1): error TS2445: Property 'member' is protected and only accessible within class 'Protected' and its subclasses. +tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts(36,1): error TS2341: Property 'member' is private and only accessible within class 'Private'. +tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts(38,4): error TS2339: Property 'member' does not exist on type 'Default | Protected'. +tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts(39,4): error TS2339: Property 'member' does not exist on type 'Default | Private'. +tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts(40,4): error TS2339: Property 'member' does not exist on type 'Public | Protected'. +tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts(41,4): error TS2339: Property 'member' does not exist on type 'Public | Private'. +tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts(42,5): error TS2339: Property 'member' does not exist on type 'Protected | Private'. +tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts(43,5): error TS2339: Property 'member' does not exist on type 'Default | Public | Protected'. +tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts(44,5): error TS2339: Property 'member' does not exist on type 'Default | Public | Private'. +tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts(45,5): error TS2339: Property 'member' does not exist on type 'Default | Protected | Private'. +tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts(46,5): error TS2339: Property 'member' does not exist on type 'Public | Protected | Private'. +tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts(47,5): error TS2339: Property 'member' does not exist on type 'Default | Public | Protected | Private'. + + +==== tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts (12 errors) ==== + class Default { + member: string; + } + + class Public { + public member: string; + } + + class Protected { + protected member: string; + } + + class Private { + private member: number; + } + + var v1: Default; + var v2: Public; + var v3: Protected; + var v4: Private; + var v5: Default | Public; + var v6: Default | Protected; + var v7: Default | Private; + var v8: Public | Protected; + var v9: Public | Private; + var v10: Protected | Private; + var v11: Default | Public | Protected; + var v12: Default | Public | Private; + var v13: Default | Protected | Private; + var v14: Public | Private | Protected; + var v15: Default | Public | Private | Protected; + + v1.member; + v2.member; + v3.member; + ~~~~~~~~~ +!!! error TS2445: Property 'member' is protected and only accessible within class 'Protected' and its subclasses. + v4.member; + ~~~~~~~~~ +!!! error TS2341: Property 'member' is private and only accessible within class 'Private'. + v5.member; + v6.member; + ~~~~~~ +!!! error TS2339: Property 'member' does not exist on type 'Default | Protected'. + v7.member; + ~~~~~~ +!!! error TS2339: Property 'member' does not exist on type 'Default | Private'. + v8.member; + ~~~~~~ +!!! error TS2339: Property 'member' does not exist on type 'Public | Protected'. + v9.member; + ~~~~~~ +!!! error TS2339: Property 'member' does not exist on type 'Public | Private'. + v10.member; + ~~~~~~ +!!! error TS2339: Property 'member' does not exist on type 'Protected | Private'. + v11.member; + ~~~~~~ +!!! error TS2339: Property 'member' does not exist on type 'Default | Public | Protected'. + v12.member; + ~~~~~~ +!!! error TS2339: Property 'member' does not exist on type 'Default | Public | Private'. + v13.member; + ~~~~~~ +!!! error TS2339: Property 'member' does not exist on type 'Default | Protected | Private'. + v14.member; + ~~~~~~ +!!! error TS2339: Property 'member' does not exist on type 'Public | Protected | Private'. + v15.member; + ~~~~~~ +!!! error TS2339: Property 'member' does not exist on type 'Default | Public | Protected | Private'. + \ No newline at end of file diff --git a/tests/baselines/reference/unionTypePropertyAccessibility.js b/tests/baselines/reference/unionTypePropertyAccessibility.js new file mode 100644 index 00000000000..3c5c4b42fee --- /dev/null +++ b/tests/baselines/reference/unionTypePropertyAccessibility.js @@ -0,0 +1,101 @@ +//// [unionTypePropertyAccessibility.ts] +class Default { + member: string; +} + +class Public { + public member: string; +} + +class Protected { + protected member: string; +} + +class Private { + private member: number; +} + +var v1: Default; +var v2: Public; +var v3: Protected; +var v4: Private; +var v5: Default | Public; +var v6: Default | Protected; +var v7: Default | Private; +var v8: Public | Protected; +var v9: Public | Private; +var v10: Protected | Private; +var v11: Default | Public | Protected; +var v12: Default | Public | Private; +var v13: Default | Protected | Private; +var v14: Public | Private | Protected; +var v15: Default | Public | Private | Protected; + +v1.member; +v2.member; +v3.member; +v4.member; +v5.member; +v6.member; +v7.member; +v8.member; +v9.member; +v10.member; +v11.member; +v12.member; +v13.member; +v14.member; +v15.member; + + +//// [unionTypePropertyAccessibility.js] +var Default = (function () { + function Default() { + } + return Default; +})(); +var Public = (function () { + function Public() { + } + return Public; +})(); +var Protected = (function () { + function Protected() { + } + return Protected; +})(); +var Private = (function () { + function Private() { + } + return Private; +})(); +var v1; +var v2; +var v3; +var v4; +var v5; +var v6; +var v7; +var v8; +var v9; +var v10; +var v11; +var v12; +var v13; +var v14; +var v15; +v1.member; +v2.member; +v3.member; +v4.member; +v5.member; +v6.member; +v7.member; +v8.member; +v9.member; +v10.member; +v11.member; +v12.member; +v13.member; +v14.member; +v15.member; diff --git a/tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts b/tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts new file mode 100644 index 00000000000..531ffe96e83 --- /dev/null +++ b/tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts @@ -0,0 +1,47 @@ +class Default { + member: string; +} + +class Public { + public member: string; +} + +class Protected { + protected member: string; +} + +class Private { + private member: number; +} + +var v1: Default; +var v2: Public; +var v3: Protected; +var v4: Private; +var v5: Default | Public; +var v6: Default | Protected; +var v7: Default | Private; +var v8: Public | Protected; +var v9: Public | Private; +var v10: Protected | Private; +var v11: Default | Public | Protected; +var v12: Default | Public | Private; +var v13: Default | Protected | Private; +var v14: Public | Private | Protected; +var v15: Default | Public | Private | Protected; + +v1.member; +v2.member; +v3.member; +v4.member; +v5.member; +v6.member; +v7.member; +v8.member; +v9.member; +v10.member; +v11.member; +v12.member; +v13.member; +v14.member; +v15.member; From b6ef32346b7d563570f6741bfd526c23c8d34215 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Thu, 16 Apr 2015 16:35:48 -0700 Subject: [PATCH 08/45] Respond to code review comments --- src/compiler/diagnosticInformationMap.generated.ts | 2 +- src/compiler/diagnosticMessages.json | 2 +- src/compiler/program.ts | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 7c9d9b56c63..0b4200455b1 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -496,7 +496,7 @@ module ts { Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: DiagnosticCategory.Message, key: "Do not emit declarations for code that has an '@internal' annotation." }, Preserve_new_lines_when_emitting_code: { code: 6057, category: DiagnosticCategory.Message, key: "Preserve new-lines when emitting code." }, Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir: { code: 6058, category: DiagnosticCategory.Message, key: "Specifies the root directory of input files. Use to control the output directory structure with --outDir." }, - File_0_is_not_under_rootDir_1_RootDir_is_expected_to_contain_all_source_files: { code: 6059, category: DiagnosticCategory.Error, key: "File '{0}' is not under rootDir '{1}'. RootDir is expected to contain all source files." }, + File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files: { code: 6059, category: DiagnosticCategory.Error, key: "File '{0}' is not under 'rootDir' '{1}'. 'rootDir' is expected to contain all source files." }, 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." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 31fc9090a6f..38d8a43e4c1 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1972,7 +1972,7 @@ "category": "Message", "code": 6058 }, - "File '{0}' is not under rootDir '{1}'. RootDir is expected to contain all source files.": { + "File '{0}' is not under 'rootDir' '{1}'. 'rootDir' is expected to contain all source files.": { "category": "Error", "code": 6059 }, diff --git a/src/compiler/program.ts b/src/compiler/program.ts index e3fe08d04eb..0d0c5b16d32 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -453,7 +453,7 @@ module ts { } } - function computecommonSourceDirectory(sourceFiles: SourceFile[]): string { + function computeCommonSourceDirectory(sourceFiles: SourceFile[]): string { let commonPathComponents: string[]; let currentDirectory = host.getCurrentDirectory(); forEach(files, sourceFile => { @@ -465,7 +465,7 @@ module ts { let sourcePathComponents = getNormalizedPathComponents(sourceFile.fileName, currentDirectory); sourcePathComponents.pop(); // FileName is not part of directory if (commonPathComponents) { - for (let i = 0; i < Math.min(commonPathComponents.length, sourcePathComponents.length); i++) { + for (let i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { if (commonPathComponents[i] !== sourcePathComponents[i]) { if (i === 0) { diagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); @@ -486,8 +486,8 @@ module ts { else { // first file commonPathComponents = sourcePathComponents; + return; } - }); return getNormalizedPathFromPathComponents(commonPathComponents); @@ -495,15 +495,15 @@ module ts { function checkSourceFilesBelongToPath(soruceFiles: SourceFile[], rootDirectory: string): boolean { let allFilesBelongToPath = true; - if (files) { + if (soruceFiles) { let currentDirectory = host.getCurrentDirectory(); let absoluteRootDirectoryPath = host.getCanonicalFileName(getNormalizedAbsolutePath(rootDirectory, currentDirectory)); - for (var sourceFile of files) { + for (var sourceFile of soruceFiles) { if (!isDeclarationFile(sourceFile)) { let absoluteSourceFilePath = host.getCanonicalFileName(getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory)); if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.File_0_is_not_under_rootDir_1_RootDir_is_expected_to_contain_all_source_files, sourceFile.fileName, options.rootDir)); + diagnostics.add(createCompilerDiagnostic(Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, sourceFile.fileName, options.rootDir)); allFilesBelongToPath = false; } } @@ -581,7 +581,7 @@ module ts { } else { // Compute the commonSourceDirectory from the input files - commonSourceDirectory = computecommonSourceDirectory(files); + commonSourceDirectory = computeCommonSourceDirectory(files); } if (commonSourceDirectory && commonSourceDirectory[commonSourceDirectory.length - 1] !== directorySeparator) { From ccf410477936ccb268cddf4adadbdc6b42ab99a7 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Fri, 17 Apr 2015 18:28:05 -0700 Subject: [PATCH 09/45] Change TypeMapper to only take a type parameter, and fix combineTypeMappers to comply with that rule --- src/compiler/checker.ts | 4 +- src/compiler/types.ts | 2 +- .../baseTypeWrappingInstantiationChain.js | 72 +++++++++++++++++++ .../baseTypeWrappingInstantiationChain.types | 71 ++++++++++++++++++ .../baseTypeWrappingInstantiationChain.ts | 26 +++++++ 5 files changed, 172 insertions(+), 3 deletions(-) create mode 100644 tests/baselines/reference/baseTypeWrappingInstantiationChain.js create mode 100644 tests/baselines/reference/baseTypeWrappingInstantiationChain.types create mode 100644 tests/cases/compiler/baseTypeWrappingInstantiationChain.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index a6973bb273b..d5e5b5c67e4 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -3788,7 +3788,7 @@ module ts { } function combineTypeMappers(mapper1: TypeMapper, mapper2: TypeMapper): TypeMapper { - return t => mapper2(mapper1(t)); + return t => instantiateType(mapper1(t), mapper2); } function instantiateTypeParameter(typeParameter: TypeParameter, mapper: TypeMapper): TypeParameter { @@ -3859,7 +3859,7 @@ module ts { function instantiateType(type: Type, mapper: TypeMapper): Type { if (mapper !== identityMapper) { if (type.flags & TypeFlags.TypeParameter) { - return mapper(type); + return mapper(type); } if (type.flags & TypeFlags.Anonymous) { return type.symbol && type.symbol.flags & (SymbolFlags.Function | SymbolFlags.Method | SymbolFlags.TypeLiteral | SymbolFlags.ObjectLiteral) ? diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 078f3d060a6..9191a6999bf 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1577,7 +1577,7 @@ module ts { /* @internal */ export interface TypeMapper { - (t: Type): Type; + (t: TypeParameter): Type; } /* @internal */ diff --git a/tests/baselines/reference/baseTypeWrappingInstantiationChain.js b/tests/baselines/reference/baseTypeWrappingInstantiationChain.js new file mode 100644 index 00000000000..97180f42133 --- /dev/null +++ b/tests/baselines/reference/baseTypeWrappingInstantiationChain.js @@ -0,0 +1,72 @@ +//// [baseTypeWrappingInstantiationChain.ts] +class C extends CBase { + public works() { + new CBaseBase>(this); + } + public alsoWorks() { + new CBase(this); // Should not error, parameter is of type Parameter> + } + + public method(t: Wrapper) { } +} + +class CBase extends CBaseBase> { + +} + +class CBaseBase { + constructor(x: Parameter) { } +} + +class Parameter { + method(t: T4) { } +} + +class Wrapper { + property: T5; +} + +//// [baseTypeWrappingInstantiationChain.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + C.prototype.works = function () { + new CBaseBase(this); + }; + C.prototype.alsoWorks = function () { + new CBase(this); // Should not error, parameter is of type Parameter> + }; + C.prototype.method = function (t) { }; + return C; +})(CBase); +var CBase = (function (_super) { + __extends(CBase, _super); + function CBase() { + _super.apply(this, arguments); + } + return CBase; +})(CBaseBase); +var CBaseBase = (function () { + function CBaseBase(x) { + } + return CBaseBase; +})(); +var Parameter = (function () { + function Parameter() { + } + Parameter.prototype.method = function (t) { }; + return Parameter; +})(); +var Wrapper = (function () { + function Wrapper() { + } + return Wrapper; +})(); diff --git a/tests/baselines/reference/baseTypeWrappingInstantiationChain.types b/tests/baselines/reference/baseTypeWrappingInstantiationChain.types new file mode 100644 index 00000000000..61919bad212 --- /dev/null +++ b/tests/baselines/reference/baseTypeWrappingInstantiationChain.types @@ -0,0 +1,71 @@ +=== tests/cases/compiler/baseTypeWrappingInstantiationChain.ts === +class C extends CBase { +>C : C +>T1 : T1 +>CBase : CBase +>T1 : T1 + + public works() { +>works : () => void + + new CBaseBase>(this); +>new CBaseBase>(this) : CBaseBase> +>CBaseBase : typeof CBaseBase +>Wrapper : Wrapper +>T1 : T1 +>this : C + } + public alsoWorks() { +>alsoWorks : () => void + + new CBase(this); // Should not error, parameter is of type Parameter> +>new CBase(this) : CBase +>CBase : typeof CBase +>T1 : T1 +>this : C + } + + public method(t: Wrapper) { } +>method : (t: Wrapper) => void +>t : Wrapper +>Wrapper : Wrapper +>T1 : T1 +} + +class CBase extends CBaseBase> { +>CBase : CBase +>T2 : T2 +>CBaseBase : CBaseBase +>Wrapper : Wrapper +>T2 : T2 + +} + +class CBaseBase { +>CBaseBase : CBaseBase +>T3 : T3 + + constructor(x: Parameter) { } +>x : Parameter +>Parameter : Parameter +>T3 : T3 +} + +class Parameter { +>Parameter : Parameter +>T4 : T4 + + method(t: T4) { } +>method : (t: T4) => void +>t : T4 +>T4 : T4 +} + +class Wrapper { +>Wrapper : Wrapper +>T5 : T5 + + property: T5; +>property : T5 +>T5 : T5 +} diff --git a/tests/cases/compiler/baseTypeWrappingInstantiationChain.ts b/tests/cases/compiler/baseTypeWrappingInstantiationChain.ts new file mode 100644 index 00000000000..f630b908ec2 --- /dev/null +++ b/tests/cases/compiler/baseTypeWrappingInstantiationChain.ts @@ -0,0 +1,26 @@ +class C extends CBase { + public works() { + new CBaseBase>(this); + } + public alsoWorks() { + new CBase(this); // Should not error, parameter is of type Parameter> + } + + public method(t: Wrapper) { } +} + +class CBase extends CBaseBase> { + +} + +class CBaseBase { + constructor(x: Parameter) { } +} + +class Parameter { + method(t: T4) { } +} + +class Wrapper { + property: T5; +} \ No newline at end of file From 31b5e72ed48c5569a58e0c6850ffda63eef7e8b3 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Fri, 17 Apr 2015 18:36:44 -0700 Subject: [PATCH 10/45] Accept symbol baseline --- ...baseTypeWrappingInstantiationChain.symbols | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 tests/baselines/reference/baseTypeWrappingInstantiationChain.symbols diff --git a/tests/baselines/reference/baseTypeWrappingInstantiationChain.symbols b/tests/baselines/reference/baseTypeWrappingInstantiationChain.symbols new file mode 100644 index 00000000000..1e8ab089b90 --- /dev/null +++ b/tests/baselines/reference/baseTypeWrappingInstantiationChain.symbols @@ -0,0 +1,69 @@ +=== tests/cases/compiler/baseTypeWrappingInstantiationChain.ts === +class C extends CBase { +>C : Symbol(C, Decl(baseTypeWrappingInstantiationChain.ts, 0, 0)) +>T1 : Symbol(T1, Decl(baseTypeWrappingInstantiationChain.ts, 0, 8)) +>CBase : Symbol(CBase, Decl(baseTypeWrappingInstantiationChain.ts, 9, 1)) +>T1 : Symbol(T1, Decl(baseTypeWrappingInstantiationChain.ts, 0, 8)) + + public works() { +>works : Symbol(works, Decl(baseTypeWrappingInstantiationChain.ts, 0, 31)) + + new CBaseBase>(this); +>CBaseBase : Symbol(CBaseBase, Decl(baseTypeWrappingInstantiationChain.ts, 13, 1)) +>Wrapper : Symbol(Wrapper, Decl(baseTypeWrappingInstantiationChain.ts, 21, 1)) +>T1 : Symbol(T1, Decl(baseTypeWrappingInstantiationChain.ts, 0, 8)) +>this : Symbol(C, Decl(baseTypeWrappingInstantiationChain.ts, 0, 0)) + } + public alsoWorks() { +>alsoWorks : Symbol(alsoWorks, Decl(baseTypeWrappingInstantiationChain.ts, 3, 5)) + + new CBase(this); // Should not error, parameter is of type Parameter> +>CBase : Symbol(CBase, Decl(baseTypeWrappingInstantiationChain.ts, 9, 1)) +>T1 : Symbol(T1, Decl(baseTypeWrappingInstantiationChain.ts, 0, 8)) +>this : Symbol(C, Decl(baseTypeWrappingInstantiationChain.ts, 0, 0)) + } + + public method(t: Wrapper) { } +>method : Symbol(method, Decl(baseTypeWrappingInstantiationChain.ts, 6, 5)) +>t : Symbol(t, Decl(baseTypeWrappingInstantiationChain.ts, 8, 18)) +>Wrapper : Symbol(Wrapper, Decl(baseTypeWrappingInstantiationChain.ts, 21, 1)) +>T1 : Symbol(T1, Decl(baseTypeWrappingInstantiationChain.ts, 0, 8)) +} + +class CBase extends CBaseBase> { +>CBase : Symbol(CBase, Decl(baseTypeWrappingInstantiationChain.ts, 9, 1)) +>T2 : Symbol(T2, Decl(baseTypeWrappingInstantiationChain.ts, 11, 12)) +>CBaseBase : Symbol(CBaseBase, Decl(baseTypeWrappingInstantiationChain.ts, 13, 1)) +>Wrapper : Symbol(Wrapper, Decl(baseTypeWrappingInstantiationChain.ts, 21, 1)) +>T2 : Symbol(T2, Decl(baseTypeWrappingInstantiationChain.ts, 11, 12)) + +} + +class CBaseBase { +>CBaseBase : Symbol(CBaseBase, Decl(baseTypeWrappingInstantiationChain.ts, 13, 1)) +>T3 : Symbol(T3, Decl(baseTypeWrappingInstantiationChain.ts, 15, 16)) + + constructor(x: Parameter) { } +>x : Symbol(x, Decl(baseTypeWrappingInstantiationChain.ts, 16, 16)) +>Parameter : Symbol(Parameter, Decl(baseTypeWrappingInstantiationChain.ts, 17, 1)) +>T3 : Symbol(T3, Decl(baseTypeWrappingInstantiationChain.ts, 15, 16)) +} + +class Parameter { +>Parameter : Symbol(Parameter, Decl(baseTypeWrappingInstantiationChain.ts, 17, 1)) +>T4 : Symbol(T4, Decl(baseTypeWrappingInstantiationChain.ts, 19, 16)) + + method(t: T4) { } +>method : Symbol(method, Decl(baseTypeWrappingInstantiationChain.ts, 19, 21)) +>t : Symbol(t, Decl(baseTypeWrappingInstantiationChain.ts, 20, 11)) +>T4 : Symbol(T4, Decl(baseTypeWrappingInstantiationChain.ts, 19, 16)) +} + +class Wrapper { +>Wrapper : Symbol(Wrapper, Decl(baseTypeWrappingInstantiationChain.ts, 21, 1)) +>T5 : Symbol(T5, Decl(baseTypeWrappingInstantiationChain.ts, 23, 14)) + + property: T5; +>property : Symbol(property, Decl(baseTypeWrappingInstantiationChain.ts, 23, 19)) +>T5 : Symbol(T5, Decl(baseTypeWrappingInstantiationChain.ts, 23, 14)) +} From b3fcae88b9c7d3d9740f7a3d57c44a0ae6889e9c Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Sun, 19 Apr 2015 13:24:39 -0700 Subject: [PATCH 11/45] Fix typo --- src/compiler/program.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 10559208cb4..70e55000d85 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -494,13 +494,13 @@ module ts { return getNormalizedPathFromPathComponents(commonPathComponents); } - function checkSourceFilesBelongToPath(soruceFiles: SourceFile[], rootDirectory: string): boolean { + function checkSourceFilesBelongToPath(sourceFiles: SourceFile[], rootDirectory: string): boolean { let allFilesBelongToPath = true; - if (soruceFiles) { + if (sourceFiles) { let currentDirectory = host.getCurrentDirectory(); let absoluteRootDirectoryPath = host.getCanonicalFileName(getNormalizedAbsolutePath(rootDirectory, currentDirectory)); - for (var sourceFile of soruceFiles) { + for (var sourceFile of sourceFiles) { if (!isDeclarationFile(sourceFile)) { let absoluteSourceFilePath = host.getCanonicalFileName(getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory)); if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) { From 08a869212b67f86551586363aa703ef36bb46351 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Mon, 20 Apr 2015 14:23:24 -0700 Subject: [PATCH 12/45] Respond to code review commmetns --- src/compiler/program.ts | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/compiler/program.ts b/src/compiler/program.ts index bb88f332453..d49e01bd45d 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -465,31 +465,31 @@ module ts { } let sourcePathComponents = getNormalizedPathComponents(sourceFile.fileName, currentDirectory); - sourcePathComponents.pop(); // FileName is not part of directory - if (commonPathComponents) { - for (let i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { - if (commonPathComponents[i] !== sourcePathComponents[i]) { - if (i === 0) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); - return; - } + sourcePathComponents.pop(); // The base file name is not part of the common directory path - // New common path found that is 0 -> i-1 - commonPathComponents.length = i; - break; - } - } - - // If the fileComponent path completely matched and less than already found update the length - if (sourcePathComponents.length < commonPathComponents.length) { - commonPathComponents.length = sourcePathComponents.length; - } - } - else { + if (!commonPathComponents) { // first file commonPathComponents = sourcePathComponents; return; } + + for (let i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { + if (commonPathComponents[i] !== sourcePathComponents[i]) { + if (i === 0) { + diagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); + return; + } + + // New common path found that is 0 -> i-1 + commonPathComponents.length = i; + break; + } + } + + // If the sourcePathComponents was shorter than the commonPathComponents, truncate to the sourcePathComponents + if (sourcePathComponents.length < commonPathComponents.length) { + commonPathComponents.length = sourcePathComponents.length; + } }); return getNormalizedPathFromPathComponents(commonPathComponents); From ed9dceb50130f8ee562c76c1a665b5cc0179166d Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Tue, 21 Apr 2015 11:19:44 -0700 Subject: [PATCH 13/45] Defer resolution of declared members in classes and interfaces --- src/compiler/checker.ts | 65 +++++++++++++++++------------------------ src/compiler/types.ts | 10 +++---- 2 files changed, 31 insertions(+), 44 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index d5e5b5c67e4..261924dd9a4 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -2516,10 +2516,11 @@ module ts { } } - function getDeclaredTypeOfClass(symbol: Symbol): InterfaceType { + function getDeclaredTypeOfClassOrInterface(symbol: Symbol): InterfaceType { let links = getSymbolLinks(symbol); if (!links.declaredType) { - let type = links.declaredType = createObjectType(TypeFlags.Class, symbol); + let kind = symbol.flags & SymbolFlags.Class ? TypeFlags.Class : TypeFlags.Interface; + let type = links.declaredType = createObjectType(kind, symbol); let typeParameters = getTypeParametersOfClassOrInterface(symbol); if (typeParameters) { type.flags |= TypeFlags.Reference; @@ -2529,35 +2530,6 @@ module ts { (type).target = type; (type).typeArguments = type.typeParameters; } - - type.declaredProperties = getNamedMembers(symbol.members); - type.declaredCallSignatures = emptyArray; - type.declaredConstructSignatures = emptyArray; - type.declaredStringIndexType = getIndexTypeOfSymbol(symbol, IndexKind.String); - type.declaredNumberIndexType = getIndexTypeOfSymbol(symbol, IndexKind.Number); - } - return links.declaredType; - } - - function getDeclaredTypeOfInterface(symbol: Symbol): InterfaceType { - let links = getSymbolLinks(symbol); - if (!links.declaredType) { - let type = links.declaredType = createObjectType(TypeFlags.Interface, symbol); - let typeParameters = getTypeParametersOfClassOrInterface(symbol); - if (typeParameters) { - type.flags |= TypeFlags.Reference; - type.typeParameters = typeParameters; - (type).instantiations = {}; - (type).instantiations[getTypeListId(type.typeParameters)] = type; - (type).target = type; - (type).typeArguments = type.typeParameters; - } - - type.declaredProperties = getNamedMembers(symbol.members); - type.declaredCallSignatures = getSignaturesOfSymbol(symbol.members["__call"]); - type.declaredConstructSignatures = getSignaturesOfSymbol(symbol.members["__new"]); - type.declaredStringIndexType = getIndexTypeOfSymbol(symbol, IndexKind.String); - type.declaredNumberIndexType = getIndexTypeOfSymbol(symbol, IndexKind.Number); } return links.declaredType; } @@ -2613,11 +2585,8 @@ module ts { function getDeclaredTypeOfSymbol(symbol: Symbol): Type { Debug.assert((symbol.flags & SymbolFlags.Instantiated) === 0); - if (symbol.flags & SymbolFlags.Class) { - return getDeclaredTypeOfClass(symbol); - } - if (symbol.flags & SymbolFlags.Interface) { - return getDeclaredTypeOfInterface(symbol); + if (symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface)) { + return getDeclaredTypeOfClassOrInterface(symbol); } if (symbol.flags & SymbolFlags.TypeAlias) { return getDeclaredTypeOfTypeAlias(symbol); @@ -2666,7 +2635,24 @@ module ts { } } + function getDeclaredPropertiesOfClassOrInterface(type: InterfaceType): Symbol[] { + resolveDeclaredMembers(type); + return type.declaredProperties; + } + + function resolveDeclaredMembers(type: InterfaceType) { + if (!type.declaredProperties) { + var symbol = type.symbol; + type.declaredProperties = getNamedMembers(symbol.members); + type.declaredCallSignatures = getSignaturesOfSymbol(symbol.members["__call"]); + type.declaredConstructSignatures = getSignaturesOfSymbol(symbol.members["__new"]); + type.declaredStringIndexType = getIndexTypeOfSymbol(symbol, IndexKind.String); + type.declaredNumberIndexType = getIndexTypeOfSymbol(symbol, IndexKind.Number); + } + } + function resolveClassOrInterfaceMembers(type: InterfaceType): void { + resolveDeclaredMembers(type); let members = type.symbol.members; let callSignatures = type.declaredCallSignatures; let constructSignatures = type.declaredConstructSignatures; @@ -2688,6 +2674,7 @@ module ts { function resolveTypeReferenceMembers(type: TypeReference): void { let target = type.target; + resolveDeclaredMembers(target); let mapper = createTypeMapper(target.typeParameters, type.typeArguments); let members = createInstantiatedSymbolTable(target.declaredProperties, mapper); let callSignatures = instantiateList(target.declaredCallSignatures, mapper, instantiateSignature); @@ -2843,7 +2830,7 @@ module ts { callSignatures = getSignaturesOfSymbol(symbol); } if (symbol.flags & SymbolFlags.Class) { - let classType = getDeclaredTypeOfClass(symbol); + let classType = getDeclaredTypeOfClassOrInterface(symbol); constructSignatures = getSignaturesOfSymbol(symbol.members["__constructor"]); if (!constructSignatures.length) { constructSignatures = getDefaultConstructSignatures(classType); @@ -3084,7 +3071,7 @@ module ts { function getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature { let links = getNodeLinks(declaration); if (!links.resolvedSignature) { - let classType = declaration.kind === SyntaxKind.Constructor ? getDeclaredTypeOfClass((declaration.parent).symbol) : undefined; + let classType = declaration.kind === SyntaxKind.Constructor ? getDeclaredTypeOfClassOrInterface((declaration.parent).symbol) : undefined; let typeParameters = classType ? classType.typeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; let parameters: Symbol[] = []; @@ -10152,7 +10139,7 @@ module ts { } let seen: Map<{ prop: Symbol; containingType: Type }> = {}; - forEach(type.declaredProperties, p => { seen[p.name] = { prop: p, containingType: type }; }); + forEach(getDeclaredPropertiesOfClassOrInterface(type), p => { seen[p.name] = { prop: p, containingType: type }; }); let ok = true; for (let base of baseTypes) { diff --git a/src/compiler/types.ts b/src/compiler/types.ts index bff15a1ab9d..54f2e5e2bd4 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1485,11 +1485,11 @@ module ts { // Class and interface types (TypeFlags.Class and TypeFlags.Interface) export interface InterfaceType extends ObjectType { typeParameters: TypeParameter[]; // Type parameters (undefined if non-generic) - declaredProperties: Symbol[]; // Declared members - declaredCallSignatures: Signature[]; // Declared call signatures - declaredConstructSignatures: Signature[]; // Declared construct signatures - declaredStringIndexType: Type; // Declared string index type - declaredNumberIndexType: Type; // Declared numeric index type + declaredProperties: Symbol[]; // Declared members (computed by resolveDeclaredMembers) + declaredCallSignatures: Signature[]; // Declared call signatures (computed by resolveDeclaredMembers) + declaredConstructSignatures: Signature[]; // Declared construct signatures (computed by resolveDeclaredMembers) + declaredStringIndexType: Type; // Declared string index type (computed by resolveDeclaredMembers) + declaredNumberIndexType: Type; // Declared numeric index type (computed by resolveDeclaredMembers) } export interface InterfaceTypeWithBaseTypes extends InterfaceType { From 8182b7132ef0df3a0856793578296a6a6a1d1fac Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Tue, 21 Apr 2015 11:20:43 -0700 Subject: [PATCH 14/45] Adding tests --- .../circularTypeAliasForUnionWithClass.js | 39 +++++++++ .../circularTypeAliasForUnionWithClass.types | 49 ++++++++++++ .../circularTypeAliasForUnionWithInterface.js | 38 +++++++++ ...rcularTypeAliasForUnionWithInterface.types | 79 +++++++++++++++++++ .../circularTypeAliasForUnionWithClass.ts | 17 ++++ .../circularTypeAliasForUnionWithInterface.ts | 29 +++++++ 6 files changed, 251 insertions(+) create mode 100644 tests/baselines/reference/circularTypeAliasForUnionWithClass.js create mode 100644 tests/baselines/reference/circularTypeAliasForUnionWithClass.types create mode 100644 tests/baselines/reference/circularTypeAliasForUnionWithInterface.js create mode 100644 tests/baselines/reference/circularTypeAliasForUnionWithInterface.types create mode 100644 tests/cases/conformance/types/typeAliases/circularTypeAliasForUnionWithClass.ts create mode 100644 tests/cases/conformance/types/typeAliases/circularTypeAliasForUnionWithInterface.ts diff --git a/tests/baselines/reference/circularTypeAliasForUnionWithClass.js b/tests/baselines/reference/circularTypeAliasForUnionWithClass.js new file mode 100644 index 00000000000..90a11364897 --- /dev/null +++ b/tests/baselines/reference/circularTypeAliasForUnionWithClass.js @@ -0,0 +1,39 @@ +//// [circularTypeAliasForUnionWithClass.ts] +var v0: T0; +type T0 = string | I0; +class I0 { + x: T0; +} + +var v3: T3; +type T3 = string | I3; +class I3 { + [x: number]: T3; +} + +var v4: T4; +type T4 = string | I4; +class I4 { + [x: string]: T4; +} + + +//// [circularTypeAliasForUnionWithClass.js] +var v0; +var I0 = (function () { + function I0() { + } + return I0; +})(); +var v3; +var I3 = (function () { + function I3() { + } + return I3; +})(); +var v4; +var I4 = (function () { + function I4() { + } + return I4; +})(); diff --git a/tests/baselines/reference/circularTypeAliasForUnionWithClass.types b/tests/baselines/reference/circularTypeAliasForUnionWithClass.types new file mode 100644 index 00000000000..99a05f3d66a --- /dev/null +++ b/tests/baselines/reference/circularTypeAliasForUnionWithClass.types @@ -0,0 +1,49 @@ +=== tests/cases/conformance/types/typeAliases/circularTypeAliasForUnionWithClass.ts === +var v0: T0; +>v0 : string | I0 +>T0 : string | I0 + +type T0 = string | I0; +>T0 : string | I0 +>I0 : I0 + +class I0 { +>I0 : I0 + + x: T0; +>x : string | I0 +>T0 : string | I0 +} + +var v3: T3; +>v3 : string | I3 +>T3 : string | I3 + +type T3 = string | I3; +>T3 : string | I3 +>I3 : I3 + +class I3 { +>I3 : I3 + + [x: number]: T3; +>x : number +>T3 : string | I3 +} + +var v4: T4; +>v4 : string | I4 +>T4 : string | I4 + +type T4 = string | I4; +>T4 : string | I4 +>I4 : I4 + +class I4 { +>I4 : I4 + + [x: string]: T4; +>x : string +>T4 : string | I4 +} + diff --git a/tests/baselines/reference/circularTypeAliasForUnionWithInterface.js b/tests/baselines/reference/circularTypeAliasForUnionWithInterface.js new file mode 100644 index 00000000000..60f4df9a8b6 --- /dev/null +++ b/tests/baselines/reference/circularTypeAliasForUnionWithInterface.js @@ -0,0 +1,38 @@ +//// [circularTypeAliasForUnionWithInterface.ts] +var v0: T0; +type T0 = string | I0; +interface I0 { + x: T0; +} + +var v1: T1; +type T1 = string | I1; +interface I1 { + (): T1; +} + +var v2: T2; +type T2 = string | I2; +interface I2 { + new (): T2; +} + +var v3: T3; +type T3 = string | I3; +interface I3 { + [x: number]: T3; +} + +var v4: T4; +type T4 = string | I4; +interface I4 { + [x: string]: T4; +} + + +//// [circularTypeAliasForUnionWithInterface.js] +var v0; +var v1; +var v2; +var v3; +var v4; diff --git a/tests/baselines/reference/circularTypeAliasForUnionWithInterface.types b/tests/baselines/reference/circularTypeAliasForUnionWithInterface.types new file mode 100644 index 00000000000..4325f9c774a --- /dev/null +++ b/tests/baselines/reference/circularTypeAliasForUnionWithInterface.types @@ -0,0 +1,79 @@ +=== tests/cases/conformance/types/typeAliases/circularTypeAliasForUnionWithInterface.ts === +var v0: T0; +>v0 : string | I0 +>T0 : string | I0 + +type T0 = string | I0; +>T0 : string | I0 +>I0 : I0 + +interface I0 { +>I0 : I0 + + x: T0; +>x : string | I0 +>T0 : string | I0 +} + +var v1: T1; +>v1 : string | I1 +>T1 : string | I1 + +type T1 = string | I1; +>T1 : string | I1 +>I1 : I1 + +interface I1 { +>I1 : I1 + + (): T1; +>T1 : string | I1 +} + +var v2: T2; +>v2 : string | I2 +>T2 : string | I2 + +type T2 = string | I2; +>T2 : string | I2 +>I2 : I2 + +interface I2 { +>I2 : I2 + + new (): T2; +>T2 : string | I2 +} + +var v3: T3; +>v3 : string | I3 +>T3 : string | I3 + +type T3 = string | I3; +>T3 : string | I3 +>I3 : I3 + +interface I3 { +>I3 : I3 + + [x: number]: T3; +>x : number +>T3 : string | I3 +} + +var v4: T4; +>v4 : string | I4 +>T4 : string | I4 + +type T4 = string | I4; +>T4 : string | I4 +>I4 : I4 + +interface I4 { +>I4 : I4 + + [x: string]: T4; +>x : string +>T4 : string | I4 +} + diff --git a/tests/cases/conformance/types/typeAliases/circularTypeAliasForUnionWithClass.ts b/tests/cases/conformance/types/typeAliases/circularTypeAliasForUnionWithClass.ts new file mode 100644 index 00000000000..e7cca719f4b --- /dev/null +++ b/tests/cases/conformance/types/typeAliases/circularTypeAliasForUnionWithClass.ts @@ -0,0 +1,17 @@ +var v0: T0; +type T0 = string | I0; +class I0 { + x: T0; +} + +var v3: T3; +type T3 = string | I3; +class I3 { + [x: number]: T3; +} + +var v4: T4; +type T4 = string | I4; +class I4 { + [x: string]: T4; +} diff --git a/tests/cases/conformance/types/typeAliases/circularTypeAliasForUnionWithInterface.ts b/tests/cases/conformance/types/typeAliases/circularTypeAliasForUnionWithInterface.ts new file mode 100644 index 00000000000..c3eab454384 --- /dev/null +++ b/tests/cases/conformance/types/typeAliases/circularTypeAliasForUnionWithInterface.ts @@ -0,0 +1,29 @@ +var v0: T0; +type T0 = string | I0; +interface I0 { + x: T0; +} + +var v1: T1; +type T1 = string | I1; +interface I1 { + (): T1; +} + +var v2: T2; +type T2 = string | I2; +interface I2 { + new (): T2; +} + +var v3: T3; +type T3 = string | I3; +interface I3 { + [x: number]: T3; +} + +var v4: T4; +type T4 = string | I4; +interface I4 { + [x: string]: T4; +} From cd48b965f88223f39f019131ff22b4db08e56cfc Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Tue, 21 Apr 2015 12:08:42 -0700 Subject: [PATCH 15/45] Accepting new baselines --- ...circularTypeAliasForUnionWithClass.symbols | 49 ++++++++++++ ...ularTypeAliasForUnionWithInterface.symbols | 79 +++++++++++++++++++ 2 files changed, 128 insertions(+) create mode 100644 tests/baselines/reference/circularTypeAliasForUnionWithClass.symbols create mode 100644 tests/baselines/reference/circularTypeAliasForUnionWithInterface.symbols diff --git a/tests/baselines/reference/circularTypeAliasForUnionWithClass.symbols b/tests/baselines/reference/circularTypeAliasForUnionWithClass.symbols new file mode 100644 index 00000000000..ecfba63332d --- /dev/null +++ b/tests/baselines/reference/circularTypeAliasForUnionWithClass.symbols @@ -0,0 +1,49 @@ +=== tests/cases/conformance/types/typeAliases/circularTypeAliasForUnionWithClass.ts === +var v0: T0; +>v0 : Symbol(v0, Decl(circularTypeAliasForUnionWithClass.ts, 0, 3)) +>T0 : Symbol(T0, Decl(circularTypeAliasForUnionWithClass.ts, 0, 11)) + +type T0 = string | I0; +>T0 : Symbol(T0, Decl(circularTypeAliasForUnionWithClass.ts, 0, 11)) +>I0 : Symbol(I0, Decl(circularTypeAliasForUnionWithClass.ts, 1, 22)) + +class I0 { +>I0 : Symbol(I0, Decl(circularTypeAliasForUnionWithClass.ts, 1, 22)) + + x: T0; +>x : Symbol(x, Decl(circularTypeAliasForUnionWithClass.ts, 2, 10)) +>T0 : Symbol(T0, Decl(circularTypeAliasForUnionWithClass.ts, 0, 11)) +} + +var v3: T3; +>v3 : Symbol(v3, Decl(circularTypeAliasForUnionWithClass.ts, 6, 3)) +>T3 : Symbol(T3, Decl(circularTypeAliasForUnionWithClass.ts, 6, 11)) + +type T3 = string | I3; +>T3 : Symbol(T3, Decl(circularTypeAliasForUnionWithClass.ts, 6, 11)) +>I3 : Symbol(I3, Decl(circularTypeAliasForUnionWithClass.ts, 7, 22)) + +class I3 { +>I3 : Symbol(I3, Decl(circularTypeAliasForUnionWithClass.ts, 7, 22)) + + [x: number]: T3; +>x : Symbol(x, Decl(circularTypeAliasForUnionWithClass.ts, 9, 5)) +>T3 : Symbol(T3, Decl(circularTypeAliasForUnionWithClass.ts, 6, 11)) +} + +var v4: T4; +>v4 : Symbol(v4, Decl(circularTypeAliasForUnionWithClass.ts, 12, 3)) +>T4 : Symbol(T4, Decl(circularTypeAliasForUnionWithClass.ts, 12, 11)) + +type T4 = string | I4; +>T4 : Symbol(T4, Decl(circularTypeAliasForUnionWithClass.ts, 12, 11)) +>I4 : Symbol(I4, Decl(circularTypeAliasForUnionWithClass.ts, 13, 22)) + +class I4 { +>I4 : Symbol(I4, Decl(circularTypeAliasForUnionWithClass.ts, 13, 22)) + + [x: string]: T4; +>x : Symbol(x, Decl(circularTypeAliasForUnionWithClass.ts, 15, 5)) +>T4 : Symbol(T4, Decl(circularTypeAliasForUnionWithClass.ts, 12, 11)) +} + diff --git a/tests/baselines/reference/circularTypeAliasForUnionWithInterface.symbols b/tests/baselines/reference/circularTypeAliasForUnionWithInterface.symbols new file mode 100644 index 00000000000..29bc3098d91 --- /dev/null +++ b/tests/baselines/reference/circularTypeAliasForUnionWithInterface.symbols @@ -0,0 +1,79 @@ +=== tests/cases/conformance/types/typeAliases/circularTypeAliasForUnionWithInterface.ts === +var v0: T0; +>v0 : Symbol(v0, Decl(circularTypeAliasForUnionWithInterface.ts, 0, 3)) +>T0 : Symbol(T0, Decl(circularTypeAliasForUnionWithInterface.ts, 0, 11)) + +type T0 = string | I0; +>T0 : Symbol(T0, Decl(circularTypeAliasForUnionWithInterface.ts, 0, 11)) +>I0 : Symbol(I0, Decl(circularTypeAliasForUnionWithInterface.ts, 1, 22)) + +interface I0 { +>I0 : Symbol(I0, Decl(circularTypeAliasForUnionWithInterface.ts, 1, 22)) + + x: T0; +>x : Symbol(x, Decl(circularTypeAliasForUnionWithInterface.ts, 2, 14)) +>T0 : Symbol(T0, Decl(circularTypeAliasForUnionWithInterface.ts, 0, 11)) +} + +var v1: T1; +>v1 : Symbol(v1, Decl(circularTypeAliasForUnionWithInterface.ts, 6, 3)) +>T1 : Symbol(T1, Decl(circularTypeAliasForUnionWithInterface.ts, 6, 11)) + +type T1 = string | I1; +>T1 : Symbol(T1, Decl(circularTypeAliasForUnionWithInterface.ts, 6, 11)) +>I1 : Symbol(I1, Decl(circularTypeAliasForUnionWithInterface.ts, 7, 22)) + +interface I1 { +>I1 : Symbol(I1, Decl(circularTypeAliasForUnionWithInterface.ts, 7, 22)) + + (): T1; +>T1 : Symbol(T1, Decl(circularTypeAliasForUnionWithInterface.ts, 6, 11)) +} + +var v2: T2; +>v2 : Symbol(v2, Decl(circularTypeAliasForUnionWithInterface.ts, 12, 3)) +>T2 : Symbol(T2, Decl(circularTypeAliasForUnionWithInterface.ts, 12, 11)) + +type T2 = string | I2; +>T2 : Symbol(T2, Decl(circularTypeAliasForUnionWithInterface.ts, 12, 11)) +>I2 : Symbol(I2, Decl(circularTypeAliasForUnionWithInterface.ts, 13, 22)) + +interface I2 { +>I2 : Symbol(I2, Decl(circularTypeAliasForUnionWithInterface.ts, 13, 22)) + + new (): T2; +>T2 : Symbol(T2, Decl(circularTypeAliasForUnionWithInterface.ts, 12, 11)) +} + +var v3: T3; +>v3 : Symbol(v3, Decl(circularTypeAliasForUnionWithInterface.ts, 18, 3)) +>T3 : Symbol(T3, Decl(circularTypeAliasForUnionWithInterface.ts, 18, 11)) + +type T3 = string | I3; +>T3 : Symbol(T3, Decl(circularTypeAliasForUnionWithInterface.ts, 18, 11)) +>I3 : Symbol(I3, Decl(circularTypeAliasForUnionWithInterface.ts, 19, 22)) + +interface I3 { +>I3 : Symbol(I3, Decl(circularTypeAliasForUnionWithInterface.ts, 19, 22)) + + [x: number]: T3; +>x : Symbol(x, Decl(circularTypeAliasForUnionWithInterface.ts, 21, 5)) +>T3 : Symbol(T3, Decl(circularTypeAliasForUnionWithInterface.ts, 18, 11)) +} + +var v4: T4; +>v4 : Symbol(v4, Decl(circularTypeAliasForUnionWithInterface.ts, 24, 3)) +>T4 : Symbol(T4, Decl(circularTypeAliasForUnionWithInterface.ts, 24, 11)) + +type T4 = string | I4; +>T4 : Symbol(T4, Decl(circularTypeAliasForUnionWithInterface.ts, 24, 11)) +>I4 : Symbol(I4, Decl(circularTypeAliasForUnionWithInterface.ts, 25, 22)) + +interface I4 { +>I4 : Symbol(I4, Decl(circularTypeAliasForUnionWithInterface.ts, 25, 22)) + + [x: string]: T4; +>x : Symbol(x, Decl(circularTypeAliasForUnionWithInterface.ts, 27, 5)) +>T4 : Symbol(T4, Decl(circularTypeAliasForUnionWithInterface.ts, 24, 11)) +} + From 80ae52b7e9f70a2595cc64f9888d77ced4b58459 Mon Sep 17 00:00:00 2001 From: Paul van Brenk Date: Tue, 21 Apr 2015 13:24:02 -0700 Subject: [PATCH 16/45] expose the config file processing throught the LS and add a callback to enumerate files in a directory --- src/compiler/commandLineParser.ts | 4 +-- src/compiler/tsc.ts | 2 +- src/compiler/types.ts | 4 +++ src/harness/harnessLanguageService.ts | 8 ++++- src/server/editorServices.ts | 2 +- src/services/shims.ts | 49 ++++++++++++++++++++++++--- 6 files changed, 59 insertions(+), 10 deletions(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 8169421ca17..fc1293d6040 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -292,7 +292,7 @@ module ts { * @param basePath A root directory to resolve relative path entries in the config * file to. e.g. outDir */ - export function parseConfigFile(json: any, basePath?: string): ParsedCommandLine { + export function parseConfigFile(json: any, host: ParseConfigHost, basePath?: string): ParsedCommandLine { var errors: Diagnostic[] = []; return { @@ -351,7 +351,7 @@ module ts { } } else { - var sysFiles = sys.readDirectory(basePath, ".ts"); + var sysFiles = host.readDirectory(basePath, ".ts"); for (var i = 0; i < sysFiles.length; i++) { var name = sysFiles[i]; if (!fileExtensionIs(name, ".d.ts") || !contains(sysFiles, name.substr(0, name.length - 5) + ".ts")) { diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index 0cbeff8204a..7eb86efbfae 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -213,7 +213,7 @@ module ts { reportDiagnostic(createCompilerDiagnostic(Diagnostics.Unable_to_open_file_0, configFileName)); return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); } - var configParseResult = parseConfigFile(configObject, getDirectoryPath(configFileName)); + var configParseResult = parseConfigFile(configObject, sys, getDirectoryPath(configFileName)); if (configParseResult.errors.length > 0) { reportDiagnostics(configParseResult.errors); return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 9191a6999bf..7decd8bd215 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1032,6 +1032,10 @@ module ts { getCurrentDirectory(): string; } + export interface ParseConfigHost { + readDirectory(rootDir: string, extension: string): string[]; + } + export interface WriteFileCallback { (fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void; } diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index bce4c9828fa..e7c60e4d862 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -186,6 +186,7 @@ module Harness.LanguageService { var script = this.getScriptInfo(fileName); return script ? script.version.toString() : undefined; } + log(s: string): void { } trace(s: string): void { } error(s: string): void { } @@ -203,7 +204,7 @@ module Harness.LanguageService { } /// Shim adapter - class ShimLanguageServiceHost extends LanguageServiceAdapterHost implements ts.LanguageServiceShimHost { + class ShimLanguageServiceHost extends LanguageServiceAdapterHost implements ts.LanguageServiceShimHost, ts.CoreServicesShimHost { private nativeHost: NativeLanguageServiceHost; constructor(cancellationToken?: ts.CancellationToken, options?: ts.CompilerOptions) { super(cancellationToken, options); @@ -227,6 +228,11 @@ module Harness.LanguageService { } getScriptVersion(fileName: string): string { return this.nativeHost.getScriptVersion(fileName); } getLocalizedDiagnosticMessages(): string { return JSON.stringify({}); } + + readDirectory(rootDir: string, extension: string): string { + throw new Error("NYI"); + } + log(s: string): void { this.nativeHost.log(s); } trace(s: string): void { this.nativeHost.trace(s); } error(s: string): void { this.nativeHost.error(s); } diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 8b4ab2cffa8..9ed31c91968 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -910,7 +910,7 @@ module ts.server { return { errorMsg: "tsconfig syntax error" }; } else { - var parsedCommandLine = ts.parseConfigFile(rawConfig, dirPath); + var parsedCommandLine = ts.parseConfigFile(rawConfig, ts.sys, dirPath); if (parsedCommandLine.errors && (parsedCommandLine.errors.length > 0)) { return { errorMsg: "tsconfig option errors" }; } diff --git a/src/services/shims.ts b/src/services/shims.ts index 110090daf5c..a8de3b817c4 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -57,6 +57,12 @@ module ts { getNewLine?(): string; } + /** Public interface of the the of a config service shim instance.*/ + export interface CoreServicesShimHost extends Logger { + /** Returns a JSON-encoded value of the type: string[] */ + readDirectory(rootDir: string, extension: string): string; + } + /// /// Pre-processing /// @@ -77,7 +83,7 @@ module ts { export interface Shim { dispose(dummy: any): void; } - + export interface LanguageServiceShim extends Shim { languageService: LanguageService; @@ -188,6 +194,7 @@ module ts { export interface CoreServicesShim extends Shim { getPreProcessedFileInfo(fileName: string, sourceText: IScriptSnapshot): string; + getTSConfigFileInfo(fileName: string, sourceText: IScriptSnapshot): string; getDefaultCompilationSettings(): string; } @@ -302,6 +309,17 @@ module ts { } } } + + export class CoreServicesShimHostAdapter implements ParseConfigHost { + + constructor(private shimHost: CoreServicesShimHost) { + } + + public readDirectory(rootDir: string, extension: string): string[] { + var encoded = this.shimHost.readDirectory(rootDir, extension); + return JSON.parse(encoded); + } + } function simpleForwardCall(logger: Logger, actionDescription: string, action: () => any): any { logger.log(actionDescription); @@ -741,7 +759,8 @@ module ts { } class CoreServicesShimObject extends ShimBase implements CoreServicesShim { - constructor(factory: ShimFactory, public logger: Logger) { + + constructor(factory: ShimFactory, public logger: Logger, private host: CoreServicesShimHostAdapter) { super(factory); } @@ -779,6 +798,25 @@ module ts { }); } + public getTSConfigFileInfo(fileName: string, sourceTextSnapshot: IScriptSnapshot): string { + return this.forwardJSONCall( + "getTSConfigFileInfo('" + fileName + "')", + () => { + var text = sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength()); + var json = /\S/.test(text) ? JSON.parse(text) : {}; + + var configFile = parseConfigFile(json, this.host, getDirectoryPath(normalizeSlashes(fileName))); + + var realErrors = realizeDiagnostics(configFile.errors, '\r\n'); + + return { + options: configFile.options, + files: configFile.fileNames, + errors: realErrors + }; + }); + } + public getDefaultCompilationSettings(): string { return this.forwardJSONCall( "getDefaultCompilationSettings()", @@ -821,12 +859,13 @@ module ts { } } - public createCoreServicesShim(logger: Logger): CoreServicesShim { + public createCoreServicesShim(host: CoreServicesShimHost): CoreServicesShim { try { - return new CoreServicesShimObject(this, logger); + var adapter = new CoreServicesShimHostAdapter(host); + return new CoreServicesShimObject(this, host, adapter); } catch (err) { - logInternalError(logger, err); + logInternalError(host, err); throw err; } } From 1295519b8f397729e68b9cffec78094554a3a334 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Tue, 21 Apr 2015 14:10:37 -0700 Subject: [PATCH 17/45] Updated emit for __decorator and __metadata helpers --- src/compiler/emitter.ts | 7 +- .../classExpressionWithDecorator1.js | 3 +- .../decoratedClassFromExternalModule.js | 3 +- .../baselines/reference/decoratorOnClass1.js | 3 +- .../baselines/reference/decoratorOnClass2.js | 3 +- .../baselines/reference/decoratorOnClass3.js | 3 +- .../baselines/reference/decoratorOnClass4.js | 3 +- .../baselines/reference/decoratorOnClass5.js | 3 +- .../baselines/reference/decoratorOnClass8.js | 3 +- .../reference/decoratorOnClassAccessor1.js | 3 +- .../reference/decoratorOnClassAccessor2.js | 3 +- .../reference/decoratorOnClassAccessor3.js | 3 +- .../reference/decoratorOnClassAccessor4.js | 3 +- .../reference/decoratorOnClassAccessor5.js | 3 +- .../reference/decoratorOnClassAccessor6.js | 3 +- .../decoratorOnClassConstructorParameter1.js | 3 +- .../decoratorOnClassConstructorParameter4.js | 3 +- .../reference/decoratorOnClassMethod1.js | 3 +- .../reference/decoratorOnClassMethod10.js | 3 +- .../reference/decoratorOnClassMethod11.js | 3 +- .../reference/decoratorOnClassMethod12.js | 3 +- .../reference/decoratorOnClassMethod13.js | 3 +- .../reference/decoratorOnClassMethod2.js | 3 +- .../reference/decoratorOnClassMethod3.js | 3 +- .../reference/decoratorOnClassMethod4.js | 3 +- .../reference/decoratorOnClassMethod5.js | 3 +- .../reference/decoratorOnClassMethod6.js | 3 +- .../reference/decoratorOnClassMethod7.js | 3 +- .../reference/decoratorOnClassMethod8.js | 3 +- .../decoratorOnClassMethodParameter1.js | 3 +- .../reference/decoratorOnClassProperty1.js | 3 +- .../reference/decoratorOnClassProperty10.js | 3 +- .../reference/decoratorOnClassProperty11.js | 3 +- .../reference/decoratorOnClassProperty2.js | 3 +- .../reference/decoratorOnClassProperty3.js | 3 +- .../reference/decoratorOnClassProperty6.js | 3 +- .../reference/decoratorOnClassProperty7.js | 3 +- .../sourceMapValidationDecorators.js | 3 +- .../sourceMapValidationDecorators.js.map | 2 +- ...ourceMapValidationDecorators.sourcemap.txt | 405 +++++++++--------- 40 files changed, 283 insertions(+), 242 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 226c682d2d7..f4aa0fe1022 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -34,7 +34,8 @@ var __extends = this.__extends || function (d, b) { // emit output for the __decorate helper function const decorateHelper = ` -var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { +var __decorate = this.__decorate || function (decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); @@ -44,7 +45,9 @@ var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.deco // emit output for the __metadata helper function const metadataHelper = ` -var __metadata = this.__metadata || (typeof Reflect === "object" && Reflect.metadata) || function () { };`; +var __metadata = this.__metadata || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +};`; // emit output for the __param helper function const paramHelper = ` diff --git a/tests/baselines/reference/classExpressionWithDecorator1.js b/tests/baselines/reference/classExpressionWithDecorator1.js index 3e255398904..964a92bb277 100644 --- a/tests/baselines/reference/classExpressionWithDecorator1.js +++ b/tests/baselines/reference/classExpressionWithDecorator1.js @@ -2,7 +2,8 @@ var v = @decorate class C { static p = 1 }; //// [classExpressionWithDecorator1.js] -var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { +var __decorate = this.__decorate || function (decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); diff --git a/tests/baselines/reference/decoratedClassFromExternalModule.js b/tests/baselines/reference/decoratedClassFromExternalModule.js index a58eb01a426..62c03937a50 100644 --- a/tests/baselines/reference/decoratedClassFromExternalModule.js +++ b/tests/baselines/reference/decoratedClassFromExternalModule.js @@ -10,7 +10,8 @@ export default class Decorated { } import Decorated from 'decorated'; //// [decorated.js] -var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { +var __decorate = this.__decorate || function (decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); diff --git a/tests/baselines/reference/decoratorOnClass1.js b/tests/baselines/reference/decoratorOnClass1.js index cd5c51e7a93..679561e2b2f 100644 --- a/tests/baselines/reference/decoratorOnClass1.js +++ b/tests/baselines/reference/decoratorOnClass1.js @@ -6,7 +6,8 @@ class C { } //// [decoratorOnClass1.js] -var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { +var __decorate = this.__decorate || function (decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); diff --git a/tests/baselines/reference/decoratorOnClass2.js b/tests/baselines/reference/decoratorOnClass2.js index fbd9a106ddf..43a67745ae8 100644 --- a/tests/baselines/reference/decoratorOnClass2.js +++ b/tests/baselines/reference/decoratorOnClass2.js @@ -6,7 +6,8 @@ export class C { } //// [decoratorOnClass2.js] -var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { +var __decorate = this.__decorate || function (decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); diff --git a/tests/baselines/reference/decoratorOnClass3.js b/tests/baselines/reference/decoratorOnClass3.js index 21536028091..05e01f7c382 100644 --- a/tests/baselines/reference/decoratorOnClass3.js +++ b/tests/baselines/reference/decoratorOnClass3.js @@ -7,7 +7,8 @@ class C { } //// [decoratorOnClass3.js] -var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { +var __decorate = this.__decorate || function (decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); diff --git a/tests/baselines/reference/decoratorOnClass4.js b/tests/baselines/reference/decoratorOnClass4.js index 5099d16b5b4..747a68a790e 100644 --- a/tests/baselines/reference/decoratorOnClass4.js +++ b/tests/baselines/reference/decoratorOnClass4.js @@ -6,7 +6,8 @@ class C { } //// [decoratorOnClass4.js] -var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { +var __decorate = this.__decorate || function (decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); diff --git a/tests/baselines/reference/decoratorOnClass5.js b/tests/baselines/reference/decoratorOnClass5.js index 0555f618e7e..5c7799937d6 100644 --- a/tests/baselines/reference/decoratorOnClass5.js +++ b/tests/baselines/reference/decoratorOnClass5.js @@ -6,7 +6,8 @@ class C { } //// [decoratorOnClass5.js] -var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { +var __decorate = this.__decorate || function (decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); diff --git a/tests/baselines/reference/decoratorOnClass8.js b/tests/baselines/reference/decoratorOnClass8.js index fad73c0c8fc..86c52b50b44 100644 --- a/tests/baselines/reference/decoratorOnClass8.js +++ b/tests/baselines/reference/decoratorOnClass8.js @@ -6,7 +6,8 @@ class C { } //// [decoratorOnClass8.js] -var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { +var __decorate = this.__decorate || function (decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); diff --git a/tests/baselines/reference/decoratorOnClassAccessor1.js b/tests/baselines/reference/decoratorOnClassAccessor1.js index 68fa7ccec0a..5143f7daceb 100644 --- a/tests/baselines/reference/decoratorOnClassAccessor1.js +++ b/tests/baselines/reference/decoratorOnClassAccessor1.js @@ -6,7 +6,8 @@ class C { } //// [decoratorOnClassAccessor1.js] -var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { +var __decorate = this.__decorate || function (decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); diff --git a/tests/baselines/reference/decoratorOnClassAccessor2.js b/tests/baselines/reference/decoratorOnClassAccessor2.js index 17d3e2e422d..fc5da177eaa 100644 --- a/tests/baselines/reference/decoratorOnClassAccessor2.js +++ b/tests/baselines/reference/decoratorOnClassAccessor2.js @@ -6,7 +6,8 @@ class C { } //// [decoratorOnClassAccessor2.js] -var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { +var __decorate = this.__decorate || function (decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); diff --git a/tests/baselines/reference/decoratorOnClassAccessor3.js b/tests/baselines/reference/decoratorOnClassAccessor3.js index 23e689f3114..08032785683 100644 --- a/tests/baselines/reference/decoratorOnClassAccessor3.js +++ b/tests/baselines/reference/decoratorOnClassAccessor3.js @@ -6,7 +6,8 @@ class C { } //// [decoratorOnClassAccessor3.js] -var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { +var __decorate = this.__decorate || function (decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); diff --git a/tests/baselines/reference/decoratorOnClassAccessor4.js b/tests/baselines/reference/decoratorOnClassAccessor4.js index 77bcb568fe1..f43ad96771b 100644 --- a/tests/baselines/reference/decoratorOnClassAccessor4.js +++ b/tests/baselines/reference/decoratorOnClassAccessor4.js @@ -6,7 +6,8 @@ class C { } //// [decoratorOnClassAccessor4.js] -var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { +var __decorate = this.__decorate || function (decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); diff --git a/tests/baselines/reference/decoratorOnClassAccessor5.js b/tests/baselines/reference/decoratorOnClassAccessor5.js index 37fc33abefd..781585eb4d4 100644 --- a/tests/baselines/reference/decoratorOnClassAccessor5.js +++ b/tests/baselines/reference/decoratorOnClassAccessor5.js @@ -6,7 +6,8 @@ class C { } //// [decoratorOnClassAccessor5.js] -var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { +var __decorate = this.__decorate || function (decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); diff --git a/tests/baselines/reference/decoratorOnClassAccessor6.js b/tests/baselines/reference/decoratorOnClassAccessor6.js index 465e13ebb1d..74feb09088b 100644 --- a/tests/baselines/reference/decoratorOnClassAccessor6.js +++ b/tests/baselines/reference/decoratorOnClassAccessor6.js @@ -6,7 +6,8 @@ class C { } //// [decoratorOnClassAccessor6.js] -var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { +var __decorate = this.__decorate || function (decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); diff --git a/tests/baselines/reference/decoratorOnClassConstructorParameter1.js b/tests/baselines/reference/decoratorOnClassConstructorParameter1.js index a1748a725ba..efd290b0668 100644 --- a/tests/baselines/reference/decoratorOnClassConstructorParameter1.js +++ b/tests/baselines/reference/decoratorOnClassConstructorParameter1.js @@ -6,7 +6,8 @@ class C { } //// [decoratorOnClassConstructorParameter1.js] -var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { +var __decorate = this.__decorate || function (decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); diff --git a/tests/baselines/reference/decoratorOnClassConstructorParameter4.js b/tests/baselines/reference/decoratorOnClassConstructorParameter4.js index 9d2b4a690ab..c1869d6050b 100644 --- a/tests/baselines/reference/decoratorOnClassConstructorParameter4.js +++ b/tests/baselines/reference/decoratorOnClassConstructorParameter4.js @@ -6,7 +6,8 @@ class C { } //// [decoratorOnClassConstructorParameter4.js] -var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { +var __decorate = this.__decorate || function (decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); diff --git a/tests/baselines/reference/decoratorOnClassMethod1.js b/tests/baselines/reference/decoratorOnClassMethod1.js index 23be1094305..b13928ab75e 100644 --- a/tests/baselines/reference/decoratorOnClassMethod1.js +++ b/tests/baselines/reference/decoratorOnClassMethod1.js @@ -6,7 +6,8 @@ class C { } //// [decoratorOnClassMethod1.js] -var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { +var __decorate = this.__decorate || function (decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); diff --git a/tests/baselines/reference/decoratorOnClassMethod10.js b/tests/baselines/reference/decoratorOnClassMethod10.js index f87e3137777..5faf5f5adfd 100644 --- a/tests/baselines/reference/decoratorOnClassMethod10.js +++ b/tests/baselines/reference/decoratorOnClassMethod10.js @@ -6,7 +6,8 @@ class C { } //// [decoratorOnClassMethod10.js] -var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { +var __decorate = this.__decorate || function (decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); diff --git a/tests/baselines/reference/decoratorOnClassMethod11.js b/tests/baselines/reference/decoratorOnClassMethod11.js index f8276de2fe3..2250eef2d88 100644 --- a/tests/baselines/reference/decoratorOnClassMethod11.js +++ b/tests/baselines/reference/decoratorOnClassMethod11.js @@ -9,7 +9,8 @@ module M { } //// [decoratorOnClassMethod11.js] -var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { +var __decorate = this.__decorate || function (decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); diff --git a/tests/baselines/reference/decoratorOnClassMethod12.js b/tests/baselines/reference/decoratorOnClassMethod12.js index 7f23947929c..36874663abd 100644 --- a/tests/baselines/reference/decoratorOnClassMethod12.js +++ b/tests/baselines/reference/decoratorOnClassMethod12.js @@ -16,7 +16,8 @@ var __extends = this.__extends || function (d, b) { __.prototype = b.prototype; d.prototype = new __(); }; -var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { +var __decorate = this.__decorate || function (decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); diff --git a/tests/baselines/reference/decoratorOnClassMethod13.js b/tests/baselines/reference/decoratorOnClassMethod13.js index 4321bbb0156..36dfcf750c0 100644 --- a/tests/baselines/reference/decoratorOnClassMethod13.js +++ b/tests/baselines/reference/decoratorOnClassMethod13.js @@ -7,7 +7,8 @@ class C { } //// [decoratorOnClassMethod13.js] -var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { +var __decorate = this.__decorate || function (decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); diff --git a/tests/baselines/reference/decoratorOnClassMethod2.js b/tests/baselines/reference/decoratorOnClassMethod2.js index 33a22f419d4..7089c4701e4 100644 --- a/tests/baselines/reference/decoratorOnClassMethod2.js +++ b/tests/baselines/reference/decoratorOnClassMethod2.js @@ -6,7 +6,8 @@ class C { } //// [decoratorOnClassMethod2.js] -var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { +var __decorate = this.__decorate || function (decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); diff --git a/tests/baselines/reference/decoratorOnClassMethod3.js b/tests/baselines/reference/decoratorOnClassMethod3.js index f93b7d7a6b2..6c09a14c1a3 100644 --- a/tests/baselines/reference/decoratorOnClassMethod3.js +++ b/tests/baselines/reference/decoratorOnClassMethod3.js @@ -6,7 +6,8 @@ class C { } //// [decoratorOnClassMethod3.js] -var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { +var __decorate = this.__decorate || function (decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); diff --git a/tests/baselines/reference/decoratorOnClassMethod4.js b/tests/baselines/reference/decoratorOnClassMethod4.js index 038432f2cf0..1e5f03a0ad4 100644 --- a/tests/baselines/reference/decoratorOnClassMethod4.js +++ b/tests/baselines/reference/decoratorOnClassMethod4.js @@ -6,7 +6,8 @@ class C { } //// [decoratorOnClassMethod4.js] -var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { +var __decorate = this.__decorate || function (decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); diff --git a/tests/baselines/reference/decoratorOnClassMethod5.js b/tests/baselines/reference/decoratorOnClassMethod5.js index 460c11f145b..fd6520f99da 100644 --- a/tests/baselines/reference/decoratorOnClassMethod5.js +++ b/tests/baselines/reference/decoratorOnClassMethod5.js @@ -6,7 +6,8 @@ class C { } //// [decoratorOnClassMethod5.js] -var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { +var __decorate = this.__decorate || function (decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); diff --git a/tests/baselines/reference/decoratorOnClassMethod6.js b/tests/baselines/reference/decoratorOnClassMethod6.js index 9f120599183..b99cacd6ca0 100644 --- a/tests/baselines/reference/decoratorOnClassMethod6.js +++ b/tests/baselines/reference/decoratorOnClassMethod6.js @@ -6,7 +6,8 @@ class C { } //// [decoratorOnClassMethod6.js] -var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { +var __decorate = this.__decorate || function (decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); diff --git a/tests/baselines/reference/decoratorOnClassMethod7.js b/tests/baselines/reference/decoratorOnClassMethod7.js index 6ab01e68bba..e86480e9895 100644 --- a/tests/baselines/reference/decoratorOnClassMethod7.js +++ b/tests/baselines/reference/decoratorOnClassMethod7.js @@ -6,7 +6,8 @@ class C { } //// [decoratorOnClassMethod7.js] -var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { +var __decorate = this.__decorate || function (decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); diff --git a/tests/baselines/reference/decoratorOnClassMethod8.js b/tests/baselines/reference/decoratorOnClassMethod8.js index 3e88f8c2793..c9048ce30f3 100644 --- a/tests/baselines/reference/decoratorOnClassMethod8.js +++ b/tests/baselines/reference/decoratorOnClassMethod8.js @@ -6,7 +6,8 @@ class C { } //// [decoratorOnClassMethod8.js] -var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { +var __decorate = this.__decorate || function (decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); diff --git a/tests/baselines/reference/decoratorOnClassMethodParameter1.js b/tests/baselines/reference/decoratorOnClassMethodParameter1.js index d228ed9302b..3d62dfe3d96 100644 --- a/tests/baselines/reference/decoratorOnClassMethodParameter1.js +++ b/tests/baselines/reference/decoratorOnClassMethodParameter1.js @@ -6,7 +6,8 @@ class C { } //// [decoratorOnClassMethodParameter1.js] -var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { +var __decorate = this.__decorate || function (decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); diff --git a/tests/baselines/reference/decoratorOnClassProperty1.js b/tests/baselines/reference/decoratorOnClassProperty1.js index aa38252b995..45307cfc57e 100644 --- a/tests/baselines/reference/decoratorOnClassProperty1.js +++ b/tests/baselines/reference/decoratorOnClassProperty1.js @@ -6,7 +6,8 @@ class C { } //// [decoratorOnClassProperty1.js] -var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { +var __decorate = this.__decorate || function (decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); diff --git a/tests/baselines/reference/decoratorOnClassProperty10.js b/tests/baselines/reference/decoratorOnClassProperty10.js index bccbc0bb737..1479d2033c9 100644 --- a/tests/baselines/reference/decoratorOnClassProperty10.js +++ b/tests/baselines/reference/decoratorOnClassProperty10.js @@ -6,7 +6,8 @@ class C { } //// [decoratorOnClassProperty10.js] -var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { +var __decorate = this.__decorate || function (decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); diff --git a/tests/baselines/reference/decoratorOnClassProperty11.js b/tests/baselines/reference/decoratorOnClassProperty11.js index f31e40d3c40..e86c112f436 100644 --- a/tests/baselines/reference/decoratorOnClassProperty11.js +++ b/tests/baselines/reference/decoratorOnClassProperty11.js @@ -6,7 +6,8 @@ class C { } //// [decoratorOnClassProperty11.js] -var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { +var __decorate = this.__decorate || function (decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); diff --git a/tests/baselines/reference/decoratorOnClassProperty2.js b/tests/baselines/reference/decoratorOnClassProperty2.js index 477320b40fa..fed6e57116e 100644 --- a/tests/baselines/reference/decoratorOnClassProperty2.js +++ b/tests/baselines/reference/decoratorOnClassProperty2.js @@ -6,7 +6,8 @@ class C { } //// [decoratorOnClassProperty2.js] -var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { +var __decorate = this.__decorate || function (decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); diff --git a/tests/baselines/reference/decoratorOnClassProperty3.js b/tests/baselines/reference/decoratorOnClassProperty3.js index 05476c66e7d..0b81416b3fd 100644 --- a/tests/baselines/reference/decoratorOnClassProperty3.js +++ b/tests/baselines/reference/decoratorOnClassProperty3.js @@ -6,7 +6,8 @@ class C { } //// [decoratorOnClassProperty3.js] -var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { +var __decorate = this.__decorate || function (decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); diff --git a/tests/baselines/reference/decoratorOnClassProperty6.js b/tests/baselines/reference/decoratorOnClassProperty6.js index 46e2d5fc069..740ad346aa3 100644 --- a/tests/baselines/reference/decoratorOnClassProperty6.js +++ b/tests/baselines/reference/decoratorOnClassProperty6.js @@ -6,7 +6,8 @@ class C { } //// [decoratorOnClassProperty6.js] -var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { +var __decorate = this.__decorate || function (decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); diff --git a/tests/baselines/reference/decoratorOnClassProperty7.js b/tests/baselines/reference/decoratorOnClassProperty7.js index 14ca0612cb1..1b34d5dac07 100644 --- a/tests/baselines/reference/decoratorOnClassProperty7.js +++ b/tests/baselines/reference/decoratorOnClassProperty7.js @@ -6,7 +6,8 @@ class C { } //// [decoratorOnClassProperty7.js] -var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { +var __decorate = this.__decorate || function (decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); diff --git a/tests/baselines/reference/sourceMapValidationDecorators.js b/tests/baselines/reference/sourceMapValidationDecorators.js index 5577a6967cd..d5a63997ea7 100644 --- a/tests/baselines/reference/sourceMapValidationDecorators.js +++ b/tests/baselines/reference/sourceMapValidationDecorators.js @@ -55,7 +55,8 @@ class Greeter { } //// [sourceMapValidationDecorators.js] -var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { +var __decorate = this.__decorate || function (decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); diff --git a/tests/baselines/reference/sourceMapValidationDecorators.js.map b/tests/baselines/reference/sourceMapValidationDecorators.js.map index 84ebad316fa..d0e29441661 100644 --- a/tests/baselines/reference/sourceMapValidationDecorators.js.map +++ b/tests/baselines/reference/sourceMapValidationDecorators.js.map @@ -1,2 +1,2 @@ //// [sourceMapValidationDecorators.js.map] -{"version":3,"file":"sourceMapValidationDecorators.js","sourceRoot":"","sources":["sourceMapValidationDecorators.ts"],"names":["Greeter","Greeter.constructor","Greeter.greet","Greeter.fn","Greeter.greetings"],"mappings":";;;;;;;;AAOA;IAGIA,iBAGSA,QAAgBA;QAEvBC,WAEcA;aAFdA,WAEcA,CAFdA,sBAEcA,CAFdA,IAEcA;YAFdA,0BAEcA;;QAJPA,aAAQA,GAARA,QAAQA,CAAQA;IAKzBA,CAACA;IAIDD,uBAAKA,GAFLA;QAGIE,MAAMA,CAACA,MAAMA,GAAGA,IAAIA,CAACA,QAAQA,GAAGA,OAAOA,CAACA;IAC5CA,CAACA;IAUOF,oBAAEA,GAAVA,UAGEA,CAASA;QACPG,MAAMA,CAACA,IAAIA,CAACA,QAAQA,CAACA;IACzBA,CAACA;IAEDH,sBAEIA,8BAASA;aAFbA;YAGII,MAAMA,CAACA,IAAIA,CAACA,QAAQA,CAACA;QACzBA,CAACA;aAEDJ,UAGEA,SAAiBA;YACfI,IAAIA,CAACA,QAAQA,GAAGA,SAASA,CAACA;QAC9BA,CAACA;;;OAPAJ;IAbcA,UAAEA,GAAWA,EAAEA,CAACA;IAZ/BA,sBAEAA,0BAAKA;;YAFJA,kBAAkBA;YAClBA,kBAAkBA,CAACA,EAAEA,CAACA;WACvBA,0BAAKA,kCAALA,0BAAKA,IAEJA;IAEDA;QAACA,kBAAkBA;QAClBA,kBAAkBA,CAACA,EAAEA,CAACA;OACfA,sBAACA,EAASA;IAMlBA,sBAAQA,uBAAEA;;YACRA,WAACA,mBAAmBA,CAAAA;YACpBA,WAACA,mBAAmBA,CAACA,EAAEA,CAACA,CAAAA;WAFlBA,uBAAEA,kCAAFA,uBAAEA,IAKTA;IAEDA,sBAEIA,8BAASA;;YAFZA,kBAAkBA;YAClBA,kBAAkBA,CAACA,EAAEA,CAACA;YAMrBA,WAACA,mBAAmBA,CAAAA;YACpBA,WAACA,mBAAmBA,CAACA,EAAEA,CAACA,CAAAA;WANtBA,8BAASA,kCAATA,8BAASA,IAEZA;IAfDA;QAACA,kBAAkBA;QAClBA,kBAAkBA,CAACA,EAAEA,CAACA;OACRA,aAAEA,EAAcA;IAzBnCA;QAACA,eAAeA;QACfA,eAAeA,CAACA,EAAEA,CAACA;QAGdA,WAACA,mBAAmBA,CAAAA;QACpBA,WAACA,mBAAmBA,CAACA,EAAEA,CAACA,CAAAA;QAGxBA,WAACA,mBAAmBA,CAAAA;QACpBA,WAACA,mBAAmBA,CAACA,EAAEA,CAACA,CAAAA;gBAqC7BA;IAADA,cAACA;AAADA,CAACA,AA9CD,IA8CC"} \ No newline at end of file +{"version":3,"file":"sourceMapValidationDecorators.js","sourceRoot":"","sources":["sourceMapValidationDecorators.ts"],"names":["Greeter","Greeter.constructor","Greeter.greet","Greeter.fn","Greeter.greetings"],"mappings":";;;;;;;;;AAOA;IAGIA,iBAGSA,QAAgBA;QAEvBC,WAEcA;aAFdA,WAEcA,CAFdA,sBAEcA,CAFdA,IAEcA;YAFdA,0BAEcA;;QAJPA,aAAQA,GAARA,QAAQA,CAAQA;IAKzBA,CAACA;IAIDD,uBAAKA,GAFLA;QAGIE,MAAMA,CAACA,MAAMA,GAAGA,IAAIA,CAACA,QAAQA,GAAGA,OAAOA,CAACA;IAC5CA,CAACA;IAUOF,oBAAEA,GAAVA,UAGEA,CAASA;QACPG,MAAMA,CAACA,IAAIA,CAACA,QAAQA,CAACA;IACzBA,CAACA;IAEDH,sBAEIA,8BAASA;aAFbA;YAGII,MAAMA,CAACA,IAAIA,CAACA,QAAQA,CAACA;QACzBA,CAACA;aAEDJ,UAGEA,SAAiBA;YACfI,IAAIA,CAACA,QAAQA,GAAGA,SAASA,CAACA;QAC9BA,CAACA;;;OAPAJ;IAbcA,UAAEA,GAAWA,EAAEA,CAACA;IAZ/BA,sBAEAA,0BAAKA;;YAFJA,kBAAkBA;YAClBA,kBAAkBA,CAACA,EAAEA,CAACA;WACvBA,0BAAKA,kCAALA,0BAAKA,IAEJA;IAEDA;QAACA,kBAAkBA;QAClBA,kBAAkBA,CAACA,EAAEA,CAACA;OACfA,sBAACA,EAASA;IAMlBA,sBAAQA,uBAAEA;;YACRA,WAACA,mBAAmBA,CAAAA;YACpBA,WAACA,mBAAmBA,CAACA,EAAEA,CAACA,CAAAA;WAFlBA,uBAAEA,kCAAFA,uBAAEA,IAKTA;IAEDA,sBAEIA,8BAASA;;YAFZA,kBAAkBA;YAClBA,kBAAkBA,CAACA,EAAEA,CAACA;YAMrBA,WAACA,mBAAmBA,CAAAA;YACpBA,WAACA,mBAAmBA,CAACA,EAAEA,CAACA,CAAAA;WANtBA,8BAASA,kCAATA,8BAASA,IAEZA;IAfDA;QAACA,kBAAkBA;QAClBA,kBAAkBA,CAACA,EAAEA,CAACA;OACRA,aAAEA,EAAcA;IAzBnCA;QAACA,eAAeA;QACfA,eAAeA,CAACA,EAAEA,CAACA;QAGdA,WAACA,mBAAmBA,CAAAA;QACpBA,WAACA,mBAAmBA,CAACA,EAAEA,CAACA,CAAAA;QAGxBA,WAACA,mBAAmBA,CAAAA;QACpBA,WAACA,mBAAmBA,CAACA,EAAEA,CAACA,CAAAA;gBAqC7BA;IAADA,cAACA;AAADA,CAACA,AA9CD,IA8CC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDecorators.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDecorators.sourcemap.txt index f4c64c49579..cde46038669 100644 --- a/tests/baselines/reference/sourceMapValidationDecorators.sourcemap.txt +++ b/tests/baselines/reference/sourceMapValidationDecorators.sourcemap.txt @@ -8,7 +8,8 @@ sources: sourceMapValidationDecorators.ts emittedFile:tests/cases/compiler/sourceMapValidationDecorators.js sourceFile:sourceMapValidationDecorators.ts ------------------------------------------------------------------- ->>>var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { +>>>var __decorate = this.__decorate || function (decorators, target, key, desc) { +>>> if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); >>> switch (arguments.length) { >>> case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); >>> case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); @@ -27,7 +28,7 @@ sourceFile:sourceMapValidationDecorators.ts >declare function ParameterDecorator2(x: number): (target: Function, key: string | symbol, paramIndex: number) => void; > > -1 >Emitted(9, 1) Source(8, 1) + SourceIndex(0) +1 >Emitted(10, 1) Source(8, 1) + SourceIndex(0) --- >>> function Greeter(greeting) { 1->^^^^ @@ -42,9 +43,9 @@ sourceFile:sourceMapValidationDecorators.ts > @ParameterDecorator2(20) > public 3 > greeting: string -1->Emitted(10, 5) Source(11, 5) + SourceIndex(0) name (Greeter) -2 >Emitted(10, 22) Source(14, 14) + SourceIndex(0) name (Greeter) -3 >Emitted(10, 30) Source(14, 30) + SourceIndex(0) name (Greeter) +1->Emitted(11, 5) Source(11, 5) + SourceIndex(0) name (Greeter) +2 >Emitted(11, 22) Source(14, 14) + SourceIndex(0) name (Greeter) +3 >Emitted(11, 30) Source(14, 30) + SourceIndex(0) name (Greeter) --- >>> var b = []; 1 >^^^^^^^^ @@ -56,8 +57,8 @@ sourceFile:sourceMapValidationDecorators.ts 2 > @ParameterDecorator1 > @ParameterDecorator2(30) > ...b: string[] -1 >Emitted(11, 9) Source(16, 7) + SourceIndex(0) name (Greeter.constructor) -2 >Emitted(11, 20) Source(18, 21) + SourceIndex(0) name (Greeter.constructor) +1 >Emitted(12, 9) Source(16, 7) + SourceIndex(0) name (Greeter.constructor) +2 >Emitted(12, 20) Source(18, 21) + SourceIndex(0) name (Greeter.constructor) --- >>> for (var _i = 1; _i < arguments.length; _i++) { 1->^^^^^^^^^^^^^ @@ -78,12 +79,12 @@ sourceFile:sourceMapValidationDecorators.ts 6 > @ParameterDecorator1 > @ParameterDecorator2(30) > ...b: string[] -1->Emitted(12, 14) Source(16, 7) + SourceIndex(0) name (Greeter.constructor) -2 >Emitted(12, 25) Source(18, 21) + SourceIndex(0) name (Greeter.constructor) -3 >Emitted(12, 26) Source(16, 7) + SourceIndex(0) name (Greeter.constructor) -4 >Emitted(12, 48) Source(18, 21) + SourceIndex(0) name (Greeter.constructor) -5 >Emitted(12, 49) Source(16, 7) + SourceIndex(0) name (Greeter.constructor) -6 >Emitted(12, 53) Source(18, 21) + SourceIndex(0) name (Greeter.constructor) +1->Emitted(13, 14) Source(16, 7) + SourceIndex(0) name (Greeter.constructor) +2 >Emitted(13, 25) Source(18, 21) + SourceIndex(0) name (Greeter.constructor) +3 >Emitted(13, 26) Source(16, 7) + SourceIndex(0) name (Greeter.constructor) +4 >Emitted(13, 48) Source(18, 21) + SourceIndex(0) name (Greeter.constructor) +5 >Emitted(13, 49) Source(16, 7) + SourceIndex(0) name (Greeter.constructor) +6 >Emitted(13, 53) Source(18, 21) + SourceIndex(0) name (Greeter.constructor) --- >>> b[_i - 1] = arguments[_i]; 1 >^^^^^^^^^^^^ @@ -92,8 +93,8 @@ sourceFile:sourceMapValidationDecorators.ts 2 > @ParameterDecorator1 > @ParameterDecorator2(30) > ...b: string[] -1 >Emitted(13, 13) Source(16, 7) + SourceIndex(0) name (Greeter.constructor) -2 >Emitted(13, 39) Source(18, 21) + SourceIndex(0) name (Greeter.constructor) +1 >Emitted(14, 13) Source(16, 7) + SourceIndex(0) name (Greeter.constructor) +2 >Emitted(14, 39) Source(18, 21) + SourceIndex(0) name (Greeter.constructor) --- >>> } >>> this.greeting = greeting; @@ -107,11 +108,11 @@ sourceFile:sourceMapValidationDecorators.ts 3 > 4 > greeting 5 > : string -1 >Emitted(15, 9) Source(14, 14) + SourceIndex(0) name (Greeter.constructor) -2 >Emitted(15, 22) Source(14, 22) + SourceIndex(0) name (Greeter.constructor) -3 >Emitted(15, 25) Source(14, 14) + SourceIndex(0) name (Greeter.constructor) -4 >Emitted(15, 33) Source(14, 22) + SourceIndex(0) name (Greeter.constructor) -5 >Emitted(15, 34) Source(14, 30) + SourceIndex(0) name (Greeter.constructor) +1 >Emitted(16, 9) Source(14, 14) + SourceIndex(0) name (Greeter.constructor) +2 >Emitted(16, 22) Source(14, 22) + SourceIndex(0) name (Greeter.constructor) +3 >Emitted(16, 25) Source(14, 14) + SourceIndex(0) name (Greeter.constructor) +4 >Emitted(16, 33) Source(14, 22) + SourceIndex(0) name (Greeter.constructor) +5 >Emitted(16, 34) Source(14, 30) + SourceIndex(0) name (Greeter.constructor) --- >>> } 1 >^^^^ @@ -124,8 +125,8 @@ sourceFile:sourceMapValidationDecorators.ts > ...b: string[]) { > 2 > } -1 >Emitted(16, 5) Source(19, 5) + SourceIndex(0) name (Greeter.constructor) -2 >Emitted(16, 6) Source(19, 6) + SourceIndex(0) name (Greeter.constructor) +1 >Emitted(17, 5) Source(19, 5) + SourceIndex(0) name (Greeter.constructor) +2 >Emitted(17, 6) Source(19, 6) + SourceIndex(0) name (Greeter.constructor) --- >>> Greeter.prototype.greet = function () { 1->^^^^ @@ -139,9 +140,9 @@ sourceFile:sourceMapValidationDecorators.ts > 2 > greet 3 > -1->Emitted(17, 5) Source(23, 5) + SourceIndex(0) name (Greeter) -2 >Emitted(17, 28) Source(23, 10) + SourceIndex(0) name (Greeter) -3 >Emitted(17, 31) Source(21, 5) + SourceIndex(0) name (Greeter) +1->Emitted(18, 5) Source(23, 5) + SourceIndex(0) name (Greeter) +2 >Emitted(18, 28) Source(23, 10) + SourceIndex(0) name (Greeter) +3 >Emitted(18, 31) Source(21, 5) + SourceIndex(0) name (Greeter) --- >>> return "

" + this.greeting + "

"; 1->^^^^^^^^ @@ -169,17 +170,17 @@ sourceFile:sourceMapValidationDecorators.ts 9 > + 10> "" 11> ; -1->Emitted(18, 9) Source(24, 9) + SourceIndex(0) name (Greeter.greet) -2 >Emitted(18, 15) Source(24, 15) + SourceIndex(0) name (Greeter.greet) -3 >Emitted(18, 16) Source(24, 16) + SourceIndex(0) name (Greeter.greet) -4 >Emitted(18, 22) Source(24, 22) + SourceIndex(0) name (Greeter.greet) -5 >Emitted(18, 25) Source(24, 25) + SourceIndex(0) name (Greeter.greet) -6 >Emitted(18, 29) Source(24, 29) + SourceIndex(0) name (Greeter.greet) -7 >Emitted(18, 30) Source(24, 30) + SourceIndex(0) name (Greeter.greet) -8 >Emitted(18, 38) Source(24, 38) + SourceIndex(0) name (Greeter.greet) -9 >Emitted(18, 41) Source(24, 41) + SourceIndex(0) name (Greeter.greet) -10>Emitted(18, 48) Source(24, 48) + SourceIndex(0) name (Greeter.greet) -11>Emitted(18, 49) Source(24, 49) + SourceIndex(0) name (Greeter.greet) +1->Emitted(19, 9) Source(24, 9) + SourceIndex(0) name (Greeter.greet) +2 >Emitted(19, 15) Source(24, 15) + SourceIndex(0) name (Greeter.greet) +3 >Emitted(19, 16) Source(24, 16) + SourceIndex(0) name (Greeter.greet) +4 >Emitted(19, 22) Source(24, 22) + SourceIndex(0) name (Greeter.greet) +5 >Emitted(19, 25) Source(24, 25) + SourceIndex(0) name (Greeter.greet) +6 >Emitted(19, 29) Source(24, 29) + SourceIndex(0) name (Greeter.greet) +7 >Emitted(19, 30) Source(24, 30) + SourceIndex(0) name (Greeter.greet) +8 >Emitted(19, 38) Source(24, 38) + SourceIndex(0) name (Greeter.greet) +9 >Emitted(19, 41) Source(24, 41) + SourceIndex(0) name (Greeter.greet) +10>Emitted(19, 48) Source(24, 48) + SourceIndex(0) name (Greeter.greet) +11>Emitted(19, 49) Source(24, 49) + SourceIndex(0) name (Greeter.greet) --- >>> }; 1 >^^^^ @@ -188,8 +189,8 @@ sourceFile:sourceMapValidationDecorators.ts 1 > > 2 > } -1 >Emitted(19, 5) Source(25, 5) + SourceIndex(0) name (Greeter.greet) -2 >Emitted(19, 6) Source(25, 6) + SourceIndex(0) name (Greeter.greet) +1 >Emitted(20, 5) Source(25, 5) + SourceIndex(0) name (Greeter.greet) +2 >Emitted(20, 6) Source(25, 6) + SourceIndex(0) name (Greeter.greet) --- >>> Greeter.prototype.fn = function (x) { 1->^^^^ @@ -215,11 +216,11 @@ sourceFile:sourceMapValidationDecorators.ts > @ParameterDecorator2(70) > 5 > x: number -1->Emitted(20, 5) Source(35, 13) + SourceIndex(0) name (Greeter) -2 >Emitted(20, 25) Source(35, 15) + SourceIndex(0) name (Greeter) -3 >Emitted(20, 28) Source(35, 5) + SourceIndex(0) name (Greeter) -4 >Emitted(20, 38) Source(38, 7) + SourceIndex(0) name (Greeter) -5 >Emitted(20, 39) Source(38, 16) + SourceIndex(0) name (Greeter) +1->Emitted(21, 5) Source(35, 13) + SourceIndex(0) name (Greeter) +2 >Emitted(21, 25) Source(35, 15) + SourceIndex(0) name (Greeter) +3 >Emitted(21, 28) Source(35, 5) + SourceIndex(0) name (Greeter) +4 >Emitted(21, 38) Source(38, 7) + SourceIndex(0) name (Greeter) +5 >Emitted(21, 39) Source(38, 16) + SourceIndex(0) name (Greeter) --- >>> return this.greeting; 1 >^^^^^^^^ @@ -237,13 +238,13 @@ sourceFile:sourceMapValidationDecorators.ts 5 > . 6 > greeting 7 > ; -1 >Emitted(21, 9) Source(39, 9) + SourceIndex(0) name (Greeter.fn) -2 >Emitted(21, 15) Source(39, 15) + SourceIndex(0) name (Greeter.fn) -3 >Emitted(21, 16) Source(39, 16) + SourceIndex(0) name (Greeter.fn) -4 >Emitted(21, 20) Source(39, 20) + SourceIndex(0) name (Greeter.fn) -5 >Emitted(21, 21) Source(39, 21) + SourceIndex(0) name (Greeter.fn) -6 >Emitted(21, 29) Source(39, 29) + SourceIndex(0) name (Greeter.fn) -7 >Emitted(21, 30) Source(39, 30) + SourceIndex(0) name (Greeter.fn) +1 >Emitted(22, 9) Source(39, 9) + SourceIndex(0) name (Greeter.fn) +2 >Emitted(22, 15) Source(39, 15) + SourceIndex(0) name (Greeter.fn) +3 >Emitted(22, 16) Source(39, 16) + SourceIndex(0) name (Greeter.fn) +4 >Emitted(22, 20) Source(39, 20) + SourceIndex(0) name (Greeter.fn) +5 >Emitted(22, 21) Source(39, 21) + SourceIndex(0) name (Greeter.fn) +6 >Emitted(22, 29) Source(39, 29) + SourceIndex(0) name (Greeter.fn) +7 >Emitted(22, 30) Source(39, 30) + SourceIndex(0) name (Greeter.fn) --- >>> }; 1 >^^^^ @@ -252,8 +253,8 @@ sourceFile:sourceMapValidationDecorators.ts 1 > > 2 > } -1 >Emitted(22, 5) Source(40, 5) + SourceIndex(0) name (Greeter.fn) -2 >Emitted(22, 6) Source(40, 6) + SourceIndex(0) name (Greeter.fn) +1 >Emitted(23, 5) Source(40, 5) + SourceIndex(0) name (Greeter.fn) +2 >Emitted(23, 6) Source(40, 6) + SourceIndex(0) name (Greeter.fn) --- >>> Object.defineProperty(Greeter.prototype, "greetings", { 1->^^^^ @@ -266,15 +267,15 @@ sourceFile:sourceMapValidationDecorators.ts > @PropertyDecorator2(80) > get 3 > greetings -1->Emitted(23, 5) Source(42, 5) + SourceIndex(0) name (Greeter) -2 >Emitted(23, 27) Source(44, 9) + SourceIndex(0) name (Greeter) -3 >Emitted(23, 57) Source(44, 18) + SourceIndex(0) name (Greeter) +1->Emitted(24, 5) Source(42, 5) + SourceIndex(0) name (Greeter) +2 >Emitted(24, 27) Source(44, 9) + SourceIndex(0) name (Greeter) +3 >Emitted(24, 57) Source(44, 18) + SourceIndex(0) name (Greeter) --- >>> get: function () { 1 >^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^-> 1 > -1 >Emitted(24, 14) Source(42, 5) + SourceIndex(0) name (Greeter) +1 >Emitted(25, 14) Source(42, 5) + SourceIndex(0) name (Greeter) --- >>> return this.greeting; 1->^^^^^^^^^^^^ @@ -294,13 +295,13 @@ sourceFile:sourceMapValidationDecorators.ts 5 > . 6 > greeting 7 > ; -1->Emitted(25, 13) Source(45, 9) + SourceIndex(0) name (Greeter.greetings) -2 >Emitted(25, 19) Source(45, 15) + SourceIndex(0) name (Greeter.greetings) -3 >Emitted(25, 20) Source(45, 16) + SourceIndex(0) name (Greeter.greetings) -4 >Emitted(25, 24) Source(45, 20) + SourceIndex(0) name (Greeter.greetings) -5 >Emitted(25, 25) Source(45, 21) + SourceIndex(0) name (Greeter.greetings) -6 >Emitted(25, 33) Source(45, 29) + SourceIndex(0) name (Greeter.greetings) -7 >Emitted(25, 34) Source(45, 30) + SourceIndex(0) name (Greeter.greetings) +1->Emitted(26, 13) Source(45, 9) + SourceIndex(0) name (Greeter.greetings) +2 >Emitted(26, 19) Source(45, 15) + SourceIndex(0) name (Greeter.greetings) +3 >Emitted(26, 20) Source(45, 16) + SourceIndex(0) name (Greeter.greetings) +4 >Emitted(26, 24) Source(45, 20) + SourceIndex(0) name (Greeter.greetings) +5 >Emitted(26, 25) Source(45, 21) + SourceIndex(0) name (Greeter.greetings) +6 >Emitted(26, 33) Source(45, 29) + SourceIndex(0) name (Greeter.greetings) +7 >Emitted(26, 34) Source(45, 30) + SourceIndex(0) name (Greeter.greetings) --- >>> }, 1 >^^^^^^^^ @@ -309,8 +310,8 @@ sourceFile:sourceMapValidationDecorators.ts 1 > > 2 > } -1 >Emitted(26, 9) Source(46, 5) + SourceIndex(0) name (Greeter.greetings) -2 >Emitted(26, 10) Source(46, 6) + SourceIndex(0) name (Greeter.greetings) +1 >Emitted(27, 9) Source(46, 5) + SourceIndex(0) name (Greeter.greetings) +2 >Emitted(27, 10) Source(46, 6) + SourceIndex(0) name (Greeter.greetings) --- >>> set: function (greetings) { 1->^^^^^^^^^^^^^ @@ -325,9 +326,9 @@ sourceFile:sourceMapValidationDecorators.ts > @ParameterDecorator2(90) > 3 > greetings: string -1->Emitted(27, 14) Source(48, 5) + SourceIndex(0) name (Greeter) -2 >Emitted(27, 24) Source(51, 7) + SourceIndex(0) name (Greeter) -3 >Emitted(27, 33) Source(51, 24) + SourceIndex(0) name (Greeter) +1->Emitted(28, 14) Source(48, 5) + SourceIndex(0) name (Greeter) +2 >Emitted(28, 24) Source(51, 7) + SourceIndex(0) name (Greeter) +3 >Emitted(28, 33) Source(51, 24) + SourceIndex(0) name (Greeter) --- >>> this.greeting = greetings; 1->^^^^^^^^^^^^ @@ -345,13 +346,13 @@ sourceFile:sourceMapValidationDecorators.ts 5 > = 6 > greetings 7 > ; -1->Emitted(28, 13) Source(52, 9) + SourceIndex(0) name (Greeter.greetings) -2 >Emitted(28, 17) Source(52, 13) + SourceIndex(0) name (Greeter.greetings) -3 >Emitted(28, 18) Source(52, 14) + SourceIndex(0) name (Greeter.greetings) -4 >Emitted(28, 26) Source(52, 22) + SourceIndex(0) name (Greeter.greetings) -5 >Emitted(28, 29) Source(52, 25) + SourceIndex(0) name (Greeter.greetings) -6 >Emitted(28, 38) Source(52, 34) + SourceIndex(0) name (Greeter.greetings) -7 >Emitted(28, 39) Source(52, 35) + SourceIndex(0) name (Greeter.greetings) +1->Emitted(29, 13) Source(52, 9) + SourceIndex(0) name (Greeter.greetings) +2 >Emitted(29, 17) Source(52, 13) + SourceIndex(0) name (Greeter.greetings) +3 >Emitted(29, 18) Source(52, 14) + SourceIndex(0) name (Greeter.greetings) +4 >Emitted(29, 26) Source(52, 22) + SourceIndex(0) name (Greeter.greetings) +5 >Emitted(29, 29) Source(52, 25) + SourceIndex(0) name (Greeter.greetings) +6 >Emitted(29, 38) Source(52, 34) + SourceIndex(0) name (Greeter.greetings) +7 >Emitted(29, 39) Source(52, 35) + SourceIndex(0) name (Greeter.greetings) --- >>> }, 1 >^^^^^^^^ @@ -360,8 +361,8 @@ sourceFile:sourceMapValidationDecorators.ts 1 > > 2 > } -1 >Emitted(29, 9) Source(53, 5) + SourceIndex(0) name (Greeter.greetings) -2 >Emitted(29, 10) Source(53, 6) + SourceIndex(0) name (Greeter.greetings) +1 >Emitted(30, 9) Source(53, 5) + SourceIndex(0) name (Greeter.greetings) +2 >Emitted(30, 10) Source(53, 6) + SourceIndex(0) name (Greeter.greetings) --- >>> enumerable: true, >>> configurable: true @@ -369,7 +370,7 @@ sourceFile:sourceMapValidationDecorators.ts 1->^^^^^^^ 2 > ^^^^^^^^^^^^^^-> 1-> -1->Emitted(32, 8) Source(46, 6) + SourceIndex(0) name (Greeter) +1->Emitted(33, 8) Source(46, 6) + SourceIndex(0) name (Greeter) --- >>> Greeter.x1 = 10; 1->^^^^ @@ -383,11 +384,11 @@ sourceFile:sourceMapValidationDecorators.ts 3 > : number = 4 > 10 5 > ; -1->Emitted(33, 5) Source(33, 20) + SourceIndex(0) name (Greeter) -2 >Emitted(33, 15) Source(33, 22) + SourceIndex(0) name (Greeter) -3 >Emitted(33, 18) Source(33, 33) + SourceIndex(0) name (Greeter) -4 >Emitted(33, 20) Source(33, 35) + SourceIndex(0) name (Greeter) -5 >Emitted(33, 21) Source(33, 36) + SourceIndex(0) name (Greeter) +1->Emitted(34, 5) Source(33, 20) + SourceIndex(0) name (Greeter) +2 >Emitted(34, 15) Source(33, 22) + SourceIndex(0) name (Greeter) +3 >Emitted(34, 18) Source(33, 33) + SourceIndex(0) name (Greeter) +4 >Emitted(34, 20) Source(33, 35) + SourceIndex(0) name (Greeter) +5 >Emitted(34, 21) Source(33, 36) + SourceIndex(0) name (Greeter) --- >>> Object.defineProperty(Greeter.prototype, "greet", 1->^^^^ @@ -398,9 +399,9 @@ sourceFile:sourceMapValidationDecorators.ts > @PropertyDecorator2(40) > 3 > greet -1->Emitted(34, 5) Source(21, 5) + SourceIndex(0) name (Greeter) -2 >Emitted(34, 27) Source(23, 5) + SourceIndex(0) name (Greeter) -3 >Emitted(34, 53) Source(23, 10) + SourceIndex(0) name (Greeter) +1->Emitted(35, 5) Source(21, 5) + SourceIndex(0) name (Greeter) +2 >Emitted(35, 27) Source(23, 5) + SourceIndex(0) name (Greeter) +3 >Emitted(35, 53) Source(23, 10) + SourceIndex(0) name (Greeter) --- >>> __decorate([ >>> PropertyDecorator1, @@ -409,8 +410,8 @@ sourceFile:sourceMapValidationDecorators.ts 3 > ^^^^^-> 1 > 2 > PropertyDecorator1 -1 >Emitted(36, 13) Source(21, 6) + SourceIndex(0) name (Greeter) -2 >Emitted(36, 31) Source(21, 24) + SourceIndex(0) name (Greeter) +1 >Emitted(37, 13) Source(21, 6) + SourceIndex(0) name (Greeter) +2 >Emitted(37, 31) Source(21, 24) + SourceIndex(0) name (Greeter) --- >>> PropertyDecorator2(40) 1->^^^^^^^^^^^^ @@ -425,11 +426,11 @@ sourceFile:sourceMapValidationDecorators.ts 3 > ( 4 > 40 5 > ) -1->Emitted(37, 13) Source(22, 6) + SourceIndex(0) name (Greeter) -2 >Emitted(37, 31) Source(22, 24) + SourceIndex(0) name (Greeter) -3 >Emitted(37, 32) Source(22, 25) + SourceIndex(0) name (Greeter) -4 >Emitted(37, 34) Source(22, 27) + SourceIndex(0) name (Greeter) -5 >Emitted(37, 35) Source(22, 28) + SourceIndex(0) name (Greeter) +1->Emitted(38, 13) Source(22, 6) + SourceIndex(0) name (Greeter) +2 >Emitted(38, 31) Source(22, 24) + SourceIndex(0) name (Greeter) +3 >Emitted(38, 32) Source(22, 25) + SourceIndex(0) name (Greeter) +4 >Emitted(38, 34) Source(22, 27) + SourceIndex(0) name (Greeter) +5 >Emitted(38, 35) Source(22, 28) + SourceIndex(0) name (Greeter) --- >>> ], Greeter.prototype, "greet", Object.getOwnPropertyDescriptor(Greeter.prototype, "greet"))); 1->^^^^^^^^^^^ @@ -445,11 +446,11 @@ sourceFile:sourceMapValidationDecorators.ts 5 > () { > return "

" + this.greeting + "

"; > } -1->Emitted(38, 12) Source(23, 5) + SourceIndex(0) name (Greeter) -2 >Emitted(38, 38) Source(23, 10) + SourceIndex(0) name (Greeter) -3 >Emitted(38, 72) Source(23, 5) + SourceIndex(0) name (Greeter) -4 >Emitted(38, 98) Source(23, 10) + SourceIndex(0) name (Greeter) -5 >Emitted(38, 102) Source(25, 6) + SourceIndex(0) name (Greeter) +1->Emitted(39, 12) Source(23, 5) + SourceIndex(0) name (Greeter) +2 >Emitted(39, 38) Source(23, 10) + SourceIndex(0) name (Greeter) +3 >Emitted(39, 72) Source(23, 5) + SourceIndex(0) name (Greeter) +4 >Emitted(39, 98) Source(23, 10) + SourceIndex(0) name (Greeter) +5 >Emitted(39, 102) Source(25, 6) + SourceIndex(0) name (Greeter) --- >>> __decorate([ 1 >^^^^ @@ -457,7 +458,7 @@ sourceFile:sourceMapValidationDecorators.ts 1 > > > -1 >Emitted(39, 5) Source(27, 5) + SourceIndex(0) name (Greeter) +1 >Emitted(40, 5) Source(27, 5) + SourceIndex(0) name (Greeter) --- >>> PropertyDecorator1, 1->^^^^^^^^ @@ -465,8 +466,8 @@ sourceFile:sourceMapValidationDecorators.ts 3 > ^^^^^-> 1->@ 2 > PropertyDecorator1 -1->Emitted(40, 9) Source(27, 6) + SourceIndex(0) name (Greeter) -2 >Emitted(40, 27) Source(27, 24) + SourceIndex(0) name (Greeter) +1->Emitted(41, 9) Source(27, 6) + SourceIndex(0) name (Greeter) +2 >Emitted(41, 27) Source(27, 24) + SourceIndex(0) name (Greeter) --- >>> PropertyDecorator2(50) 1->^^^^^^^^ @@ -481,11 +482,11 @@ sourceFile:sourceMapValidationDecorators.ts 3 > ( 4 > 50 5 > ) -1->Emitted(41, 9) Source(28, 6) + SourceIndex(0) name (Greeter) -2 >Emitted(41, 27) Source(28, 24) + SourceIndex(0) name (Greeter) -3 >Emitted(41, 28) Source(28, 25) + SourceIndex(0) name (Greeter) -4 >Emitted(41, 30) Source(28, 27) + SourceIndex(0) name (Greeter) -5 >Emitted(41, 31) Source(28, 28) + SourceIndex(0) name (Greeter) +1->Emitted(42, 9) Source(28, 6) + SourceIndex(0) name (Greeter) +2 >Emitted(42, 27) Source(28, 24) + SourceIndex(0) name (Greeter) +3 >Emitted(42, 28) Source(28, 25) + SourceIndex(0) name (Greeter) +4 >Emitted(42, 30) Source(28, 27) + SourceIndex(0) name (Greeter) +5 >Emitted(42, 31) Source(28, 28) + SourceIndex(0) name (Greeter) --- >>> ], Greeter.prototype, "x"); 1->^^^^^^^ @@ -496,9 +497,9 @@ sourceFile:sourceMapValidationDecorators.ts > private 2 > x 3 > : string; -1->Emitted(42, 8) Source(29, 13) + SourceIndex(0) name (Greeter) -2 >Emitted(42, 30) Source(29, 14) + SourceIndex(0) name (Greeter) -3 >Emitted(42, 32) Source(29, 23) + SourceIndex(0) name (Greeter) +1->Emitted(43, 8) Source(29, 13) + SourceIndex(0) name (Greeter) +2 >Emitted(43, 30) Source(29, 14) + SourceIndex(0) name (Greeter) +3 >Emitted(43, 32) Source(29, 23) + SourceIndex(0) name (Greeter) --- >>> Object.defineProperty(Greeter.prototype, "fn", 1->^^^^ @@ -513,9 +514,9 @@ sourceFile:sourceMapValidationDecorators.ts > 2 > private 3 > fn -1->Emitted(43, 5) Source(35, 5) + SourceIndex(0) name (Greeter) -2 >Emitted(43, 27) Source(35, 13) + SourceIndex(0) name (Greeter) -3 >Emitted(43, 50) Source(35, 15) + SourceIndex(0) name (Greeter) +1->Emitted(44, 5) Source(35, 5) + SourceIndex(0) name (Greeter) +2 >Emitted(44, 27) Source(35, 13) + SourceIndex(0) name (Greeter) +3 >Emitted(44, 50) Source(35, 15) + SourceIndex(0) name (Greeter) --- >>> __decorate([ >>> __param(0, ParameterDecorator1), @@ -529,10 +530,10 @@ sourceFile:sourceMapValidationDecorators.ts 2 > @ 3 > ParameterDecorator1 4 > -1 >Emitted(45, 13) Source(36, 7) + SourceIndex(0) name (Greeter) -2 >Emitted(45, 24) Source(36, 8) + SourceIndex(0) name (Greeter) -3 >Emitted(45, 43) Source(36, 27) + SourceIndex(0) name (Greeter) -4 >Emitted(45, 44) Source(36, 27) + SourceIndex(0) name (Greeter) +1 >Emitted(46, 13) Source(36, 7) + SourceIndex(0) name (Greeter) +2 >Emitted(46, 24) Source(36, 8) + SourceIndex(0) name (Greeter) +3 >Emitted(46, 43) Source(36, 27) + SourceIndex(0) name (Greeter) +4 >Emitted(46, 44) Source(36, 27) + SourceIndex(0) name (Greeter) --- >>> __param(0, ParameterDecorator2(70)) 1->^^^^^^^^^^^^ @@ -551,13 +552,13 @@ sourceFile:sourceMapValidationDecorators.ts 5 > 70 6 > ) 7 > -1->Emitted(46, 13) Source(37, 7) + SourceIndex(0) name (Greeter) -2 >Emitted(46, 24) Source(37, 8) + SourceIndex(0) name (Greeter) -3 >Emitted(46, 43) Source(37, 27) + SourceIndex(0) name (Greeter) -4 >Emitted(46, 44) Source(37, 28) + SourceIndex(0) name (Greeter) -5 >Emitted(46, 46) Source(37, 30) + SourceIndex(0) name (Greeter) -6 >Emitted(46, 47) Source(37, 31) + SourceIndex(0) name (Greeter) -7 >Emitted(46, 48) Source(37, 31) + SourceIndex(0) name (Greeter) +1->Emitted(47, 13) Source(37, 7) + SourceIndex(0) name (Greeter) +2 >Emitted(47, 24) Source(37, 8) + SourceIndex(0) name (Greeter) +3 >Emitted(47, 43) Source(37, 27) + SourceIndex(0) name (Greeter) +4 >Emitted(47, 44) Source(37, 28) + SourceIndex(0) name (Greeter) +5 >Emitted(47, 46) Source(37, 30) + SourceIndex(0) name (Greeter) +6 >Emitted(47, 47) Source(37, 31) + SourceIndex(0) name (Greeter) +7 >Emitted(47, 48) Source(37, 31) + SourceIndex(0) name (Greeter) --- >>> ], Greeter.prototype, "fn", Object.getOwnPropertyDescriptor(Greeter.prototype, "fn"))); 1->^^^^^^^^^^^ @@ -575,11 +576,11 @@ sourceFile:sourceMapValidationDecorators.ts > x: number) { > return this.greeting; > } -1->Emitted(47, 12) Source(35, 13) + SourceIndex(0) name (Greeter) -2 >Emitted(47, 35) Source(35, 15) + SourceIndex(0) name (Greeter) -3 >Emitted(47, 69) Source(35, 13) + SourceIndex(0) name (Greeter) -4 >Emitted(47, 92) Source(35, 15) + SourceIndex(0) name (Greeter) -5 >Emitted(47, 96) Source(40, 6) + SourceIndex(0) name (Greeter) +1->Emitted(48, 12) Source(35, 13) + SourceIndex(0) name (Greeter) +2 >Emitted(48, 35) Source(35, 15) + SourceIndex(0) name (Greeter) +3 >Emitted(48, 69) Source(35, 13) + SourceIndex(0) name (Greeter) +4 >Emitted(48, 92) Source(35, 15) + SourceIndex(0) name (Greeter) +5 >Emitted(48, 96) Source(40, 6) + SourceIndex(0) name (Greeter) --- >>> Object.defineProperty(Greeter.prototype, "greetings", 1 >^^^^ @@ -592,9 +593,9 @@ sourceFile:sourceMapValidationDecorators.ts > @PropertyDecorator2(80) > get 3 > greetings -1 >Emitted(48, 5) Source(42, 5) + SourceIndex(0) name (Greeter) -2 >Emitted(48, 27) Source(44, 9) + SourceIndex(0) name (Greeter) -3 >Emitted(48, 57) Source(44, 18) + SourceIndex(0) name (Greeter) +1 >Emitted(49, 5) Source(42, 5) + SourceIndex(0) name (Greeter) +2 >Emitted(49, 27) Source(44, 9) + SourceIndex(0) name (Greeter) +3 >Emitted(49, 57) Source(44, 18) + SourceIndex(0) name (Greeter) --- >>> __decorate([ >>> PropertyDecorator1, @@ -603,8 +604,8 @@ sourceFile:sourceMapValidationDecorators.ts 3 > ^^^^^^-> 1 > 2 > PropertyDecorator1 -1 >Emitted(50, 13) Source(42, 6) + SourceIndex(0) name (Greeter) -2 >Emitted(50, 31) Source(42, 24) + SourceIndex(0) name (Greeter) +1 >Emitted(51, 13) Source(42, 6) + SourceIndex(0) name (Greeter) +2 >Emitted(51, 31) Source(42, 24) + SourceIndex(0) name (Greeter) --- >>> PropertyDecorator2(80), 1->^^^^^^^^^^^^ @@ -619,11 +620,11 @@ sourceFile:sourceMapValidationDecorators.ts 3 > ( 4 > 80 5 > ) -1->Emitted(51, 13) Source(43, 6) + SourceIndex(0) name (Greeter) -2 >Emitted(51, 31) Source(43, 24) + SourceIndex(0) name (Greeter) -3 >Emitted(51, 32) Source(43, 25) + SourceIndex(0) name (Greeter) -4 >Emitted(51, 34) Source(43, 27) + SourceIndex(0) name (Greeter) -5 >Emitted(51, 35) Source(43, 28) + SourceIndex(0) name (Greeter) +1->Emitted(52, 13) Source(43, 6) + SourceIndex(0) name (Greeter) +2 >Emitted(52, 31) Source(43, 24) + SourceIndex(0) name (Greeter) +3 >Emitted(52, 32) Source(43, 25) + SourceIndex(0) name (Greeter) +4 >Emitted(52, 34) Source(43, 27) + SourceIndex(0) name (Greeter) +5 >Emitted(52, 35) Source(43, 28) + SourceIndex(0) name (Greeter) --- >>> __param(0, ParameterDecorator1), 1->^^^^^^^^^^^^ @@ -641,10 +642,10 @@ sourceFile:sourceMapValidationDecorators.ts 2 > @ 3 > ParameterDecorator1 4 > -1->Emitted(52, 13) Source(49, 7) + SourceIndex(0) name (Greeter) -2 >Emitted(52, 24) Source(49, 8) + SourceIndex(0) name (Greeter) -3 >Emitted(52, 43) Source(49, 27) + SourceIndex(0) name (Greeter) -4 >Emitted(52, 44) Source(49, 27) + SourceIndex(0) name (Greeter) +1->Emitted(53, 13) Source(49, 7) + SourceIndex(0) name (Greeter) +2 >Emitted(53, 24) Source(49, 8) + SourceIndex(0) name (Greeter) +3 >Emitted(53, 43) Source(49, 27) + SourceIndex(0) name (Greeter) +4 >Emitted(53, 44) Source(49, 27) + SourceIndex(0) name (Greeter) --- >>> __param(0, ParameterDecorator2(90)) 1->^^^^^^^^^^^^ @@ -663,13 +664,13 @@ sourceFile:sourceMapValidationDecorators.ts 5 > 90 6 > ) 7 > -1->Emitted(53, 13) Source(50, 7) + SourceIndex(0) name (Greeter) -2 >Emitted(53, 24) Source(50, 8) + SourceIndex(0) name (Greeter) -3 >Emitted(53, 43) Source(50, 27) + SourceIndex(0) name (Greeter) -4 >Emitted(53, 44) Source(50, 28) + SourceIndex(0) name (Greeter) -5 >Emitted(53, 46) Source(50, 30) + SourceIndex(0) name (Greeter) -6 >Emitted(53, 47) Source(50, 31) + SourceIndex(0) name (Greeter) -7 >Emitted(53, 48) Source(50, 31) + SourceIndex(0) name (Greeter) +1->Emitted(54, 13) Source(50, 7) + SourceIndex(0) name (Greeter) +2 >Emitted(54, 24) Source(50, 8) + SourceIndex(0) name (Greeter) +3 >Emitted(54, 43) Source(50, 27) + SourceIndex(0) name (Greeter) +4 >Emitted(54, 44) Source(50, 28) + SourceIndex(0) name (Greeter) +5 >Emitted(54, 46) Source(50, 30) + SourceIndex(0) name (Greeter) +6 >Emitted(54, 47) Source(50, 31) + SourceIndex(0) name (Greeter) +7 >Emitted(54, 48) Source(50, 31) + SourceIndex(0) name (Greeter) --- >>> ], Greeter.prototype, "greetings", Object.getOwnPropertyDescriptor(Greeter.prototype, "greetings"))); 1->^^^^^^^^^^^ @@ -684,17 +685,17 @@ sourceFile:sourceMapValidationDecorators.ts 5 > () { > return this.greeting; > } -1->Emitted(54, 12) Source(44, 9) + SourceIndex(0) name (Greeter) -2 >Emitted(54, 42) Source(44, 18) + SourceIndex(0) name (Greeter) -3 >Emitted(54, 76) Source(44, 9) + SourceIndex(0) name (Greeter) -4 >Emitted(54, 106) Source(44, 18) + SourceIndex(0) name (Greeter) -5 >Emitted(54, 110) Source(46, 6) + SourceIndex(0) name (Greeter) +1->Emitted(55, 12) Source(44, 9) + SourceIndex(0) name (Greeter) +2 >Emitted(55, 42) Source(44, 18) + SourceIndex(0) name (Greeter) +3 >Emitted(55, 76) Source(44, 9) + SourceIndex(0) name (Greeter) +4 >Emitted(55, 106) Source(44, 18) + SourceIndex(0) name (Greeter) +5 >Emitted(55, 110) Source(46, 6) + SourceIndex(0) name (Greeter) --- >>> __decorate([ 1 >^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > -1 >Emitted(55, 5) Source(31, 5) + SourceIndex(0) name (Greeter) +1 >Emitted(56, 5) Source(31, 5) + SourceIndex(0) name (Greeter) --- >>> PropertyDecorator1, 1->^^^^^^^^ @@ -702,8 +703,8 @@ sourceFile:sourceMapValidationDecorators.ts 3 > ^^^^^-> 1->@ 2 > PropertyDecorator1 -1->Emitted(56, 9) Source(31, 6) + SourceIndex(0) name (Greeter) -2 >Emitted(56, 27) Source(31, 24) + SourceIndex(0) name (Greeter) +1->Emitted(57, 9) Source(31, 6) + SourceIndex(0) name (Greeter) +2 >Emitted(57, 27) Source(31, 24) + SourceIndex(0) name (Greeter) --- >>> PropertyDecorator2(60) 1->^^^^^^^^ @@ -717,11 +718,11 @@ sourceFile:sourceMapValidationDecorators.ts 3 > ( 4 > 60 5 > ) -1->Emitted(57, 9) Source(32, 6) + SourceIndex(0) name (Greeter) -2 >Emitted(57, 27) Source(32, 24) + SourceIndex(0) name (Greeter) -3 >Emitted(57, 28) Source(32, 25) + SourceIndex(0) name (Greeter) -4 >Emitted(57, 30) Source(32, 27) + SourceIndex(0) name (Greeter) -5 >Emitted(57, 31) Source(32, 28) + SourceIndex(0) name (Greeter) +1->Emitted(58, 9) Source(32, 6) + SourceIndex(0) name (Greeter) +2 >Emitted(58, 27) Source(32, 24) + SourceIndex(0) name (Greeter) +3 >Emitted(58, 28) Source(32, 25) + SourceIndex(0) name (Greeter) +4 >Emitted(58, 30) Source(32, 27) + SourceIndex(0) name (Greeter) +5 >Emitted(58, 31) Source(32, 28) + SourceIndex(0) name (Greeter) --- >>> ], Greeter, "x1"); 1 >^^^^^^^ @@ -732,15 +733,15 @@ sourceFile:sourceMapValidationDecorators.ts > private static 2 > x1 3 > : number = 10; -1 >Emitted(58, 8) Source(33, 20) + SourceIndex(0) name (Greeter) -2 >Emitted(58, 21) Source(33, 22) + SourceIndex(0) name (Greeter) -3 >Emitted(58, 23) Source(33, 36) + SourceIndex(0) name (Greeter) +1 >Emitted(59, 8) Source(33, 20) + SourceIndex(0) name (Greeter) +2 >Emitted(59, 21) Source(33, 22) + SourceIndex(0) name (Greeter) +3 >Emitted(59, 23) Source(33, 36) + SourceIndex(0) name (Greeter) --- >>> Greeter = __decorate([ 1->^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^-> 1-> -1->Emitted(59, 5) Source(8, 1) + SourceIndex(0) name (Greeter) +1->Emitted(60, 5) Source(8, 1) + SourceIndex(0) name (Greeter) --- >>> ClassDecorator1, 1->^^^^^^^^ @@ -748,8 +749,8 @@ sourceFile:sourceMapValidationDecorators.ts 3 > ^^^^^^-> 1->@ 2 > ClassDecorator1 -1->Emitted(60, 9) Source(8, 2) + SourceIndex(0) name (Greeter) -2 >Emitted(60, 24) Source(8, 17) + SourceIndex(0) name (Greeter) +1->Emitted(61, 9) Source(8, 2) + SourceIndex(0) name (Greeter) +2 >Emitted(61, 24) Source(8, 17) + SourceIndex(0) name (Greeter) --- >>> ClassDecorator2(10), 1->^^^^^^^^ @@ -764,11 +765,11 @@ sourceFile:sourceMapValidationDecorators.ts 3 > ( 4 > 10 5 > ) -1->Emitted(61, 9) Source(9, 2) + SourceIndex(0) name (Greeter) -2 >Emitted(61, 24) Source(9, 17) + SourceIndex(0) name (Greeter) -3 >Emitted(61, 25) Source(9, 18) + SourceIndex(0) name (Greeter) -4 >Emitted(61, 27) Source(9, 20) + SourceIndex(0) name (Greeter) -5 >Emitted(61, 28) Source(9, 21) + SourceIndex(0) name (Greeter) +1->Emitted(62, 9) Source(9, 2) + SourceIndex(0) name (Greeter) +2 >Emitted(62, 24) Source(9, 17) + SourceIndex(0) name (Greeter) +3 >Emitted(62, 25) Source(9, 18) + SourceIndex(0) name (Greeter) +4 >Emitted(62, 27) Source(9, 20) + SourceIndex(0) name (Greeter) +5 >Emitted(62, 28) Source(9, 21) + SourceIndex(0) name (Greeter) --- >>> __param(0, ParameterDecorator1), 1->^^^^^^^^ @@ -783,10 +784,10 @@ sourceFile:sourceMapValidationDecorators.ts 2 > @ 3 > ParameterDecorator1 4 > -1->Emitted(62, 9) Source(12, 7) + SourceIndex(0) name (Greeter) -2 >Emitted(62, 20) Source(12, 8) + SourceIndex(0) name (Greeter) -3 >Emitted(62, 39) Source(12, 27) + SourceIndex(0) name (Greeter) -4 >Emitted(62, 40) Source(12, 27) + SourceIndex(0) name (Greeter) +1->Emitted(63, 9) Source(12, 7) + SourceIndex(0) name (Greeter) +2 >Emitted(63, 20) Source(12, 8) + SourceIndex(0) name (Greeter) +3 >Emitted(63, 39) Source(12, 27) + SourceIndex(0) name (Greeter) +4 >Emitted(63, 40) Source(12, 27) + SourceIndex(0) name (Greeter) --- >>> __param(0, ParameterDecorator2(20)), 1->^^^^^^^^ @@ -804,13 +805,13 @@ sourceFile:sourceMapValidationDecorators.ts 5 > 20 6 > ) 7 > -1->Emitted(63, 9) Source(13, 7) + SourceIndex(0) name (Greeter) -2 >Emitted(63, 20) Source(13, 8) + SourceIndex(0) name (Greeter) -3 >Emitted(63, 39) Source(13, 27) + SourceIndex(0) name (Greeter) -4 >Emitted(63, 40) Source(13, 28) + SourceIndex(0) name (Greeter) -5 >Emitted(63, 42) Source(13, 30) + SourceIndex(0) name (Greeter) -6 >Emitted(63, 43) Source(13, 31) + SourceIndex(0) name (Greeter) -7 >Emitted(63, 44) Source(13, 31) + SourceIndex(0) name (Greeter) +1->Emitted(64, 9) Source(13, 7) + SourceIndex(0) name (Greeter) +2 >Emitted(64, 20) Source(13, 8) + SourceIndex(0) name (Greeter) +3 >Emitted(64, 39) Source(13, 27) + SourceIndex(0) name (Greeter) +4 >Emitted(64, 40) Source(13, 28) + SourceIndex(0) name (Greeter) +5 >Emitted(64, 42) Source(13, 30) + SourceIndex(0) name (Greeter) +6 >Emitted(64, 43) Source(13, 31) + SourceIndex(0) name (Greeter) +7 >Emitted(64, 44) Source(13, 31) + SourceIndex(0) name (Greeter) --- >>> __param(1, ParameterDecorator1), 1 >^^^^^^^^ @@ -825,10 +826,10 @@ sourceFile:sourceMapValidationDecorators.ts 2 > @ 3 > ParameterDecorator1 4 > -1 >Emitted(64, 9) Source(16, 7) + SourceIndex(0) name (Greeter) -2 >Emitted(64, 20) Source(16, 8) + SourceIndex(0) name (Greeter) -3 >Emitted(64, 39) Source(16, 27) + SourceIndex(0) name (Greeter) -4 >Emitted(64, 40) Source(16, 27) + SourceIndex(0) name (Greeter) +1 >Emitted(65, 9) Source(16, 7) + SourceIndex(0) name (Greeter) +2 >Emitted(65, 20) Source(16, 8) + SourceIndex(0) name (Greeter) +3 >Emitted(65, 39) Source(16, 27) + SourceIndex(0) name (Greeter) +4 >Emitted(65, 40) Source(16, 27) + SourceIndex(0) name (Greeter) --- >>> __param(1, ParameterDecorator2(30)) 1->^^^^^^^^ @@ -846,13 +847,13 @@ sourceFile:sourceMapValidationDecorators.ts 5 > 30 6 > ) 7 > -1->Emitted(65, 9) Source(17, 7) + SourceIndex(0) name (Greeter) -2 >Emitted(65, 20) Source(17, 8) + SourceIndex(0) name (Greeter) -3 >Emitted(65, 39) Source(17, 27) + SourceIndex(0) name (Greeter) -4 >Emitted(65, 40) Source(17, 28) + SourceIndex(0) name (Greeter) -5 >Emitted(65, 42) Source(17, 30) + SourceIndex(0) name (Greeter) -6 >Emitted(65, 43) Source(17, 31) + SourceIndex(0) name (Greeter) -7 >Emitted(65, 44) Source(17, 31) + SourceIndex(0) name (Greeter) +1->Emitted(66, 9) Source(17, 7) + SourceIndex(0) name (Greeter) +2 >Emitted(66, 20) Source(17, 8) + SourceIndex(0) name (Greeter) +3 >Emitted(66, 39) Source(17, 27) + SourceIndex(0) name (Greeter) +4 >Emitted(66, 40) Source(17, 28) + SourceIndex(0) name (Greeter) +5 >Emitted(66, 42) Source(17, 30) + SourceIndex(0) name (Greeter) +6 >Emitted(66, 43) Source(17, 31) + SourceIndex(0) name (Greeter) +7 >Emitted(66, 44) Source(17, 31) + SourceIndex(0) name (Greeter) --- >>> ], Greeter); 1 >^^^^^^^^^^^^^^^^ @@ -895,15 +896,15 @@ sourceFile:sourceMapValidationDecorators.ts > this.greeting = greetings; > } >} -1 >Emitted(66, 17) Source(54, 2) + SourceIndex(0) name (Greeter) +1 >Emitted(67, 17) Source(54, 2) + SourceIndex(0) name (Greeter) --- >>> return Greeter; 1->^^^^ 2 > ^^^^^^^^^^^^^^ 1-> 2 > } -1->Emitted(67, 5) Source(54, 1) + SourceIndex(0) name (Greeter) -2 >Emitted(67, 19) Source(54, 2) + SourceIndex(0) name (Greeter) +1->Emitted(68, 5) Source(54, 1) + SourceIndex(0) name (Greeter) +2 >Emitted(68, 19) Source(54, 2) + SourceIndex(0) name (Greeter) --- >>>})(); 1 > @@ -961,9 +962,9 @@ sourceFile:sourceMapValidationDecorators.ts > this.greeting = greetings; > } > } -1 >Emitted(68, 1) Source(54, 1) + SourceIndex(0) name (Greeter) -2 >Emitted(68, 2) Source(54, 2) + SourceIndex(0) name (Greeter) -3 >Emitted(68, 2) Source(8, 1) + SourceIndex(0) -4 >Emitted(68, 6) Source(54, 2) + SourceIndex(0) +1 >Emitted(69, 1) Source(54, 1) + SourceIndex(0) name (Greeter) +2 >Emitted(69, 2) Source(54, 2) + SourceIndex(0) name (Greeter) +3 >Emitted(69, 2) Source(8, 1) + SourceIndex(0) +4 >Emitted(69, 6) Source(54, 2) + SourceIndex(0) --- >>>//# sourceMappingURL=sourceMapValidationDecorators.js.map \ No newline at end of file From 3657d99a5e68f4e0df18ccb6640164e5862723de Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Tue, 21 Apr 2015 16:46:37 -0700 Subject: [PATCH 18/45] Updated LKG --- bin/lib.d.ts | 46 +++++++------- bin/lib.dom.d.ts | 46 +++++++------- bin/lib.es6.d.ts | 46 +++++++------- bin/tsc.js | 107 ++++++++++++++++++++++----------- bin/tsserver.js | 110 ++++++++++++++++++++++----------- bin/typescript.d.ts | 1 + bin/typescript.js | 117 ++++++++++++++++++++++++------------ bin/typescriptServices.d.ts | 1 + bin/typescriptServices.js | 117 ++++++++++++++++++++++++------------ 9 files changed, 370 insertions(+), 221 deletions(-) diff --git a/bin/lib.d.ts b/bin/lib.d.ts index 82a6fa8345c..5eaa933d164 100644 --- a/bin/lib.d.ts +++ b/bin/lib.d.ts @@ -13878,7 +13878,7 @@ interface SourceBuffer extends EventTarget { videoTracks: VideoTrackList; abort(): void; appendBuffer(data: ArrayBuffer): void; - appendBuffer(data: any): void; + appendBuffer(data: ArrayBufferView): void; appendStream(stream: MSStream, maxSize?: number): void; remove(start: number, end: number): void; } @@ -13986,31 +13986,31 @@ declare var StyleSheetPageList: { } interface SubtleCrypto { - decrypt(algorithm: string, key: CryptoKey, data: any): any; - decrypt(algorithm: Algorithm, key: CryptoKey, data: any): any; + decrypt(algorithm: string, key: CryptoKey, data: ArrayBufferView): any; + decrypt(algorithm: Algorithm, key: CryptoKey, data: ArrayBufferView): any; deriveBits(algorithm: string, baseKey: CryptoKey, length: number): any; deriveBits(algorithm: Algorithm, baseKey: CryptoKey, length: number): any; deriveKey(algorithm: string, baseKey: CryptoKey, derivedKeyType: string, extractable: boolean, keyUsages: string[]): any; deriveKey(algorithm: string, baseKey: CryptoKey, derivedKeyType: Algorithm, extractable: boolean, keyUsages: string[]): any; deriveKey(algorithm: Algorithm, baseKey: CryptoKey, derivedKeyType: string, extractable: boolean, keyUsages: string[]): any; deriveKey(algorithm: Algorithm, baseKey: CryptoKey, derivedKeyType: Algorithm, extractable: boolean, keyUsages: string[]): any; - digest(algorithm: string, data: any): any; - digest(algorithm: Algorithm, data: any): any; - encrypt(algorithm: string, key: CryptoKey, data: any): any; - encrypt(algorithm: Algorithm, key: CryptoKey, data: any): any; + digest(algorithm: string, data: ArrayBufferView): any; + digest(algorithm: Algorithm, data: ArrayBufferView): any; + encrypt(algorithm: string, key: CryptoKey, data: ArrayBufferView): any; + encrypt(algorithm: Algorithm, key: CryptoKey, data: ArrayBufferView): any; exportKey(format: string, key: CryptoKey): any; generateKey(algorithm: string, extractable: boolean, keyUsages: string[]): any; generateKey(algorithm: Algorithm, extractable: boolean, keyUsages: string[]): any; - importKey(format: string, keyData: any, algorithm: string, extractable: boolean, keyUsages: string[]): any; - importKey(format: string, keyData: any, algorithm: Algorithm, extractable: boolean, keyUsages: string[]): any; - sign(algorithm: string, key: CryptoKey, data: any): any; - sign(algorithm: Algorithm, key: CryptoKey, data: any): any; - unwrapKey(format: string, wrappedKey: any, unwrappingKey: CryptoKey, unwrapAlgorithm: string, unwrappedKeyAlgorithm: string, extractable: boolean, keyUsages: string[]): any; - unwrapKey(format: string, wrappedKey: any, unwrappingKey: CryptoKey, unwrapAlgorithm: string, unwrappedKeyAlgorithm: Algorithm, extractable: boolean, keyUsages: string[]): any; - unwrapKey(format: string, wrappedKey: any, unwrappingKey: CryptoKey, unwrapAlgorithm: Algorithm, unwrappedKeyAlgorithm: string, extractable: boolean, keyUsages: string[]): any; - unwrapKey(format: string, wrappedKey: any, unwrappingKey: CryptoKey, unwrapAlgorithm: Algorithm, unwrappedKeyAlgorithm: Algorithm, extractable: boolean, keyUsages: string[]): any; - verify(algorithm: string, key: CryptoKey, signature: any, data: any): any; - verify(algorithm: Algorithm, key: CryptoKey, signature: any, data: any): any; + importKey(format: string, keyData: ArrayBufferView, algorithm: string, extractable: boolean, keyUsages: string[]): any; + importKey(format: string, keyData: ArrayBufferView, algorithm: Algorithm, extractable: boolean, keyUsages: string[]): any; + sign(algorithm: string, key: CryptoKey, data: ArrayBufferView): any; + sign(algorithm: Algorithm, key: CryptoKey, data: ArrayBufferView): any; + unwrapKey(format: string, wrappedKey: ArrayBufferView, unwrappingKey: CryptoKey, unwrapAlgorithm: string, unwrappedKeyAlgorithm: string, extractable: boolean, keyUsages: string[]): any; + unwrapKey(format: string, wrappedKey: ArrayBufferView, unwrappingKey: CryptoKey, unwrapAlgorithm: string, unwrappedKeyAlgorithm: Algorithm, extractable: boolean, keyUsages: string[]): any; + unwrapKey(format: string, wrappedKey: ArrayBufferView, unwrappingKey: CryptoKey, unwrapAlgorithm: Algorithm, unwrappedKeyAlgorithm: string, extractable: boolean, keyUsages: string[]): any; + unwrapKey(format: string, wrappedKey: ArrayBufferView, unwrappingKey: CryptoKey, unwrapAlgorithm: Algorithm, unwrappedKeyAlgorithm: Algorithm, extractable: boolean, keyUsages: string[]): any; + verify(algorithm: string, key: CryptoKey, signature: ArrayBufferView, data: ArrayBufferView): any; + verify(algorithm: Algorithm, key: CryptoKey, signature: ArrayBufferView, data: ArrayBufferView): any; wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: string): any; wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: Algorithm): any; } @@ -14522,9 +14522,9 @@ interface WebGLRenderingContext { blendFunc(sfactor: number, dfactor: number): void; blendFuncSeparate(srcRGB: number, dstRGB: number, srcAlpha: number, dstAlpha: number): void; bufferData(target: number, size: number, usage: number): void; + bufferData(target: number, size: ArrayBufferView, usage: number): void; bufferData(target: number, size: any, usage: number): void; - bufferData(target: number, size: any, usage: number): void; - bufferSubData(target: number, offset: number, data: any): void; + bufferSubData(target: number, offset: number, data: ArrayBufferView): void; bufferSubData(target: number, offset: number, data: any): void; checkFramebufferStatus(target: number): number; clear(mask: number): void; @@ -14533,8 +14533,8 @@ interface WebGLRenderingContext { clearStencil(s: number): void; colorMask(red: boolean, green: boolean, blue: boolean, alpha: boolean): void; compileShader(shader: WebGLShader): void; - compressedTexImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, data: any): void; - compressedTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, data: any): void; + compressedTexImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, data: ArrayBufferView): void; + compressedTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, data: ArrayBufferView): void; copyTexImage2D(target: number, level: number, internalformat: number, x: number, y: number, width: number, height: number, border: number): void; copyTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, x: number, y: number, width: number, height: number): void; createBuffer(): WebGLBuffer; @@ -14602,7 +14602,7 @@ interface WebGLRenderingContext { linkProgram(program: WebGLProgram): void; pixelStorei(pname: number, param: number): void; polygonOffset(factor: number, units: number): void; - readPixels(x: number, y: number, width: number, height: number, format: number, type: number, pixels: any): void; + readPixels(x: number, y: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView): void; renderbufferStorage(target: number, internalformat: number, width: number, height: number): void; sampleCoverage(value: number, invert: boolean): void; scissor(x: number, y: number, width: number, height: number): void; @@ -16026,7 +16026,7 @@ interface NodeSelector { } interface RandomSource { - getRandomValues(array: any): any; + getRandomValues(array: ArrayBufferView): ArrayBufferView; } interface SVGAnimatedPathData { diff --git a/bin/lib.dom.d.ts b/bin/lib.dom.d.ts index d66afb9b27f..2c970a1cf52 100644 --- a/bin/lib.dom.d.ts +++ b/bin/lib.dom.d.ts @@ -12708,7 +12708,7 @@ interface SourceBuffer extends EventTarget { videoTracks: VideoTrackList; abort(): void; appendBuffer(data: ArrayBuffer): void; - appendBuffer(data: any): void; + appendBuffer(data: ArrayBufferView): void; appendStream(stream: MSStream, maxSize?: number): void; remove(start: number, end: number): void; } @@ -12816,31 +12816,31 @@ declare var StyleSheetPageList: { } interface SubtleCrypto { - decrypt(algorithm: string, key: CryptoKey, data: any): any; - decrypt(algorithm: Algorithm, key: CryptoKey, data: any): any; + decrypt(algorithm: string, key: CryptoKey, data: ArrayBufferView): any; + decrypt(algorithm: Algorithm, key: CryptoKey, data: ArrayBufferView): any; deriveBits(algorithm: string, baseKey: CryptoKey, length: number): any; deriveBits(algorithm: Algorithm, baseKey: CryptoKey, length: number): any; deriveKey(algorithm: string, baseKey: CryptoKey, derivedKeyType: string, extractable: boolean, keyUsages: string[]): any; deriveKey(algorithm: string, baseKey: CryptoKey, derivedKeyType: Algorithm, extractable: boolean, keyUsages: string[]): any; deriveKey(algorithm: Algorithm, baseKey: CryptoKey, derivedKeyType: string, extractable: boolean, keyUsages: string[]): any; deriveKey(algorithm: Algorithm, baseKey: CryptoKey, derivedKeyType: Algorithm, extractable: boolean, keyUsages: string[]): any; - digest(algorithm: string, data: any): any; - digest(algorithm: Algorithm, data: any): any; - encrypt(algorithm: string, key: CryptoKey, data: any): any; - encrypt(algorithm: Algorithm, key: CryptoKey, data: any): any; + digest(algorithm: string, data: ArrayBufferView): any; + digest(algorithm: Algorithm, data: ArrayBufferView): any; + encrypt(algorithm: string, key: CryptoKey, data: ArrayBufferView): any; + encrypt(algorithm: Algorithm, key: CryptoKey, data: ArrayBufferView): any; exportKey(format: string, key: CryptoKey): any; generateKey(algorithm: string, extractable: boolean, keyUsages: string[]): any; generateKey(algorithm: Algorithm, extractable: boolean, keyUsages: string[]): any; - importKey(format: string, keyData: any, algorithm: string, extractable: boolean, keyUsages: string[]): any; - importKey(format: string, keyData: any, algorithm: Algorithm, extractable: boolean, keyUsages: string[]): any; - sign(algorithm: string, key: CryptoKey, data: any): any; - sign(algorithm: Algorithm, key: CryptoKey, data: any): any; - unwrapKey(format: string, wrappedKey: any, unwrappingKey: CryptoKey, unwrapAlgorithm: string, unwrappedKeyAlgorithm: string, extractable: boolean, keyUsages: string[]): any; - unwrapKey(format: string, wrappedKey: any, unwrappingKey: CryptoKey, unwrapAlgorithm: string, unwrappedKeyAlgorithm: Algorithm, extractable: boolean, keyUsages: string[]): any; - unwrapKey(format: string, wrappedKey: any, unwrappingKey: CryptoKey, unwrapAlgorithm: Algorithm, unwrappedKeyAlgorithm: string, extractable: boolean, keyUsages: string[]): any; - unwrapKey(format: string, wrappedKey: any, unwrappingKey: CryptoKey, unwrapAlgorithm: Algorithm, unwrappedKeyAlgorithm: Algorithm, extractable: boolean, keyUsages: string[]): any; - verify(algorithm: string, key: CryptoKey, signature: any, data: any): any; - verify(algorithm: Algorithm, key: CryptoKey, signature: any, data: any): any; + importKey(format: string, keyData: ArrayBufferView, algorithm: string, extractable: boolean, keyUsages: string[]): any; + importKey(format: string, keyData: ArrayBufferView, algorithm: Algorithm, extractable: boolean, keyUsages: string[]): any; + sign(algorithm: string, key: CryptoKey, data: ArrayBufferView): any; + sign(algorithm: Algorithm, key: CryptoKey, data: ArrayBufferView): any; + unwrapKey(format: string, wrappedKey: ArrayBufferView, unwrappingKey: CryptoKey, unwrapAlgorithm: string, unwrappedKeyAlgorithm: string, extractable: boolean, keyUsages: string[]): any; + unwrapKey(format: string, wrappedKey: ArrayBufferView, unwrappingKey: CryptoKey, unwrapAlgorithm: string, unwrappedKeyAlgorithm: Algorithm, extractable: boolean, keyUsages: string[]): any; + unwrapKey(format: string, wrappedKey: ArrayBufferView, unwrappingKey: CryptoKey, unwrapAlgorithm: Algorithm, unwrappedKeyAlgorithm: string, extractable: boolean, keyUsages: string[]): any; + unwrapKey(format: string, wrappedKey: ArrayBufferView, unwrappingKey: CryptoKey, unwrapAlgorithm: Algorithm, unwrappedKeyAlgorithm: Algorithm, extractable: boolean, keyUsages: string[]): any; + verify(algorithm: string, key: CryptoKey, signature: ArrayBufferView, data: ArrayBufferView): any; + verify(algorithm: Algorithm, key: CryptoKey, signature: ArrayBufferView, data: ArrayBufferView): any; wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: string): any; wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: Algorithm): any; } @@ -13352,9 +13352,9 @@ interface WebGLRenderingContext { blendFunc(sfactor: number, dfactor: number): void; blendFuncSeparate(srcRGB: number, dstRGB: number, srcAlpha: number, dstAlpha: number): void; bufferData(target: number, size: number, usage: number): void; + bufferData(target: number, size: ArrayBufferView, usage: number): void; bufferData(target: number, size: any, usage: number): void; - bufferData(target: number, size: any, usage: number): void; - bufferSubData(target: number, offset: number, data: any): void; + bufferSubData(target: number, offset: number, data: ArrayBufferView): void; bufferSubData(target: number, offset: number, data: any): void; checkFramebufferStatus(target: number): number; clear(mask: number): void; @@ -13363,8 +13363,8 @@ interface WebGLRenderingContext { clearStencil(s: number): void; colorMask(red: boolean, green: boolean, blue: boolean, alpha: boolean): void; compileShader(shader: WebGLShader): void; - compressedTexImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, data: any): void; - compressedTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, data: any): void; + compressedTexImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, data: ArrayBufferView): void; + compressedTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, data: ArrayBufferView): void; copyTexImage2D(target: number, level: number, internalformat: number, x: number, y: number, width: number, height: number, border: number): void; copyTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, x: number, y: number, width: number, height: number): void; createBuffer(): WebGLBuffer; @@ -13432,7 +13432,7 @@ interface WebGLRenderingContext { linkProgram(program: WebGLProgram): void; pixelStorei(pname: number, param: number): void; polygonOffset(factor: number, units: number): void; - readPixels(x: number, y: number, width: number, height: number, format: number, type: number, pixels: any): void; + readPixels(x: number, y: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView): void; renderbufferStorage(target: number, internalformat: number, width: number, height: number): void; sampleCoverage(value: number, invert: boolean): void; scissor(x: number, y: number, width: number, height: number): void; @@ -14856,7 +14856,7 @@ interface NodeSelector { } interface RandomSource { - getRandomValues(array: any): any; + getRandomValues(array: ArrayBufferView): ArrayBufferView; } interface SVGAnimatedPathData { diff --git a/bin/lib.es6.d.ts b/bin/lib.es6.d.ts index e2a76a04ae2..297cac973e3 100644 --- a/bin/lib.es6.d.ts +++ b/bin/lib.es6.d.ts @@ -15356,7 +15356,7 @@ interface SourceBuffer extends EventTarget { videoTracks: VideoTrackList; abort(): void; appendBuffer(data: ArrayBuffer): void; - appendBuffer(data: any): void; + appendBuffer(data: ArrayBufferView): void; appendStream(stream: MSStream, maxSize?: number): void; remove(start: number, end: number): void; } @@ -15464,31 +15464,31 @@ declare var StyleSheetPageList: { } interface SubtleCrypto { - decrypt(algorithm: string, key: CryptoKey, data: any): any; - decrypt(algorithm: Algorithm, key: CryptoKey, data: any): any; + decrypt(algorithm: string, key: CryptoKey, data: ArrayBufferView): any; + decrypt(algorithm: Algorithm, key: CryptoKey, data: ArrayBufferView): any; deriveBits(algorithm: string, baseKey: CryptoKey, length: number): any; deriveBits(algorithm: Algorithm, baseKey: CryptoKey, length: number): any; deriveKey(algorithm: string, baseKey: CryptoKey, derivedKeyType: string, extractable: boolean, keyUsages: string[]): any; deriveKey(algorithm: string, baseKey: CryptoKey, derivedKeyType: Algorithm, extractable: boolean, keyUsages: string[]): any; deriveKey(algorithm: Algorithm, baseKey: CryptoKey, derivedKeyType: string, extractable: boolean, keyUsages: string[]): any; deriveKey(algorithm: Algorithm, baseKey: CryptoKey, derivedKeyType: Algorithm, extractable: boolean, keyUsages: string[]): any; - digest(algorithm: string, data: any): any; - digest(algorithm: Algorithm, data: any): any; - encrypt(algorithm: string, key: CryptoKey, data: any): any; - encrypt(algorithm: Algorithm, key: CryptoKey, data: any): any; + digest(algorithm: string, data: ArrayBufferView): any; + digest(algorithm: Algorithm, data: ArrayBufferView): any; + encrypt(algorithm: string, key: CryptoKey, data: ArrayBufferView): any; + encrypt(algorithm: Algorithm, key: CryptoKey, data: ArrayBufferView): any; exportKey(format: string, key: CryptoKey): any; generateKey(algorithm: string, extractable: boolean, keyUsages: string[]): any; generateKey(algorithm: Algorithm, extractable: boolean, keyUsages: string[]): any; - importKey(format: string, keyData: any, algorithm: string, extractable: boolean, keyUsages: string[]): any; - importKey(format: string, keyData: any, algorithm: Algorithm, extractable: boolean, keyUsages: string[]): any; - sign(algorithm: string, key: CryptoKey, data: any): any; - sign(algorithm: Algorithm, key: CryptoKey, data: any): any; - unwrapKey(format: string, wrappedKey: any, unwrappingKey: CryptoKey, unwrapAlgorithm: string, unwrappedKeyAlgorithm: string, extractable: boolean, keyUsages: string[]): any; - unwrapKey(format: string, wrappedKey: any, unwrappingKey: CryptoKey, unwrapAlgorithm: string, unwrappedKeyAlgorithm: Algorithm, extractable: boolean, keyUsages: string[]): any; - unwrapKey(format: string, wrappedKey: any, unwrappingKey: CryptoKey, unwrapAlgorithm: Algorithm, unwrappedKeyAlgorithm: string, extractable: boolean, keyUsages: string[]): any; - unwrapKey(format: string, wrappedKey: any, unwrappingKey: CryptoKey, unwrapAlgorithm: Algorithm, unwrappedKeyAlgorithm: Algorithm, extractable: boolean, keyUsages: string[]): any; - verify(algorithm: string, key: CryptoKey, signature: any, data: any): any; - verify(algorithm: Algorithm, key: CryptoKey, signature: any, data: any): any; + importKey(format: string, keyData: ArrayBufferView, algorithm: string, extractable: boolean, keyUsages: string[]): any; + importKey(format: string, keyData: ArrayBufferView, algorithm: Algorithm, extractable: boolean, keyUsages: string[]): any; + sign(algorithm: string, key: CryptoKey, data: ArrayBufferView): any; + sign(algorithm: Algorithm, key: CryptoKey, data: ArrayBufferView): any; + unwrapKey(format: string, wrappedKey: ArrayBufferView, unwrappingKey: CryptoKey, unwrapAlgorithm: string, unwrappedKeyAlgorithm: string, extractable: boolean, keyUsages: string[]): any; + unwrapKey(format: string, wrappedKey: ArrayBufferView, unwrappingKey: CryptoKey, unwrapAlgorithm: string, unwrappedKeyAlgorithm: Algorithm, extractable: boolean, keyUsages: string[]): any; + unwrapKey(format: string, wrappedKey: ArrayBufferView, unwrappingKey: CryptoKey, unwrapAlgorithm: Algorithm, unwrappedKeyAlgorithm: string, extractable: boolean, keyUsages: string[]): any; + unwrapKey(format: string, wrappedKey: ArrayBufferView, unwrappingKey: CryptoKey, unwrapAlgorithm: Algorithm, unwrappedKeyAlgorithm: Algorithm, extractable: boolean, keyUsages: string[]): any; + verify(algorithm: string, key: CryptoKey, signature: ArrayBufferView, data: ArrayBufferView): any; + verify(algorithm: Algorithm, key: CryptoKey, signature: ArrayBufferView, data: ArrayBufferView): any; wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: string): any; wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: Algorithm): any; } @@ -16000,9 +16000,9 @@ interface WebGLRenderingContext { blendFunc(sfactor: number, dfactor: number): void; blendFuncSeparate(srcRGB: number, dstRGB: number, srcAlpha: number, dstAlpha: number): void; bufferData(target: number, size: number, usage: number): void; + bufferData(target: number, size: ArrayBufferView, usage: number): void; bufferData(target: number, size: any, usage: number): void; - bufferData(target: number, size: any, usage: number): void; - bufferSubData(target: number, offset: number, data: any): void; + bufferSubData(target: number, offset: number, data: ArrayBufferView): void; bufferSubData(target: number, offset: number, data: any): void; checkFramebufferStatus(target: number): number; clear(mask: number): void; @@ -16011,8 +16011,8 @@ interface WebGLRenderingContext { clearStencil(s: number): void; colorMask(red: boolean, green: boolean, blue: boolean, alpha: boolean): void; compileShader(shader: WebGLShader): void; - compressedTexImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, data: any): void; - compressedTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, data: any): void; + compressedTexImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, data: ArrayBufferView): void; + compressedTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, data: ArrayBufferView): void; copyTexImage2D(target: number, level: number, internalformat: number, x: number, y: number, width: number, height: number, border: number): void; copyTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, x: number, y: number, width: number, height: number): void; createBuffer(): WebGLBuffer; @@ -16080,7 +16080,7 @@ interface WebGLRenderingContext { linkProgram(program: WebGLProgram): void; pixelStorei(pname: number, param: number): void; polygonOffset(factor: number, units: number): void; - readPixels(x: number, y: number, width: number, height: number, format: number, type: number, pixels: any): void; + readPixels(x: number, y: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView): void; renderbufferStorage(target: number, internalformat: number, width: number, height: number): void; sampleCoverage(value: number, invert: boolean): void; scissor(x: number, y: number, width: number, height: number): void; @@ -17504,7 +17504,7 @@ interface NodeSelector { } interface RandomSource { - getRandomValues(array: any): any; + getRandomValues(array: ArrayBufferView): ArrayBufferView; } interface SVGAnimatedPathData { diff --git a/bin/tsc.js b/bin/tsc.js index 3323c446649..49960ff3e50 100644 --- a/bin/tsc.js +++ b/bin/tsc.js @@ -1399,6 +1399,8 @@ var ts; Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: ts.DiagnosticCategory.Message, key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." }, Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: ts.DiagnosticCategory.Message, key: "Do not emit declarations for code that has an '@internal' annotation." }, Preserve_new_lines_when_emitting_code: { code: 6057, category: ts.DiagnosticCategory.Message, key: "Preserve new-lines when emitting code." }, + Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir: { code: 6058, category: ts.DiagnosticCategory.Message, key: "Specifies the root directory of input files. Use to control the output directory structure with --outDir." }, + File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files: { code: 6059, category: ts.DiagnosticCategory.Error, key: "File '{0}' is not under 'rootDir' '{1}'. 'rootDir' is expected to contain all source files." }, Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable '{0}' implicitly has an '{1}' type." }, Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter '{0}' implicitly has an '{1}' type." }, Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member '{0}' implicitly has an '{1}' type." }, @@ -11553,7 +11555,7 @@ var ts; return type; } function combineTypeMappers(mapper1, mapper2) { - return function (t) { return mapper2(mapper1(t)); }; + return function (t) { return instantiateType(mapper1(t), mapper2); }; } function instantiateTypeParameter(typeParameter, mapper) { var result = createType(512); @@ -20156,8 +20158,8 @@ var ts; ts.isExternalModuleOrDeclarationFile = isExternalModuleOrDeclarationFile; function emitFiles(resolver, host, targetSourceFile) { var extendsHelper = "\nvar __extends = this.__extends || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n __.prototype = b.prototype;\n d.prototype = new __();\n};"; - var decorateHelper = "\nvar __decorate = this.__decorate || (typeof Reflect === \"object\" && Reflect.decorate) || function (decorators, target, key, desc) {\n switch (arguments.length) {\n case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);\n case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);\n case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);\n }\n};"; - var metadataHelper = "\nvar __metadata = this.__metadata || (typeof Reflect === \"object\" && Reflect.metadata) || function () { };"; + var decorateHelper = "\nvar __decorate = this.__decorate || function (decorators, target, key, desc) {\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") return Reflect.decorate(decorators, target, key, desc);\n switch (arguments.length) {\n case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);\n case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);\n case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);\n }\n};"; + var metadataHelper = "\nvar __metadata = this.__metadata || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};"; var paramHelper = "\nvar __param = this.__param || function(index, decorator) { return function (target, key) { decorator(target, key, index); } };"; var compilerOptions = host.getCompilerOptions(); var languageVersion = compilerOptions.target || 0; @@ -24441,7 +24443,7 @@ var ts; getDiagnosticsProducingTypeChecker: getDiagnosticsProducingTypeChecker, getCommonSourceDirectory: function () { return commonSourceDirectory; }, emit: emit, - getCurrentDirectory: host.getCurrentDirectory, + getCurrentDirectory: function () { return host.getCurrentDirectory(); }, getNodeCount: function () { return getDiagnosticsProducingTypeChecker().getNodeCount(); }, getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); }, getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); }, @@ -24450,14 +24452,14 @@ var ts; return program; function getEmitHost(writeFileCallback) { return { - getCanonicalFileName: host.getCanonicalFileName, + getCanonicalFileName: function (fileName) { return host.getCanonicalFileName(fileName); }, getCommonSourceDirectory: program.getCommonSourceDirectory, getCompilerOptions: program.getCompilerOptions, - getCurrentDirectory: host.getCurrentDirectory, - getNewLine: host.getNewLine, + getCurrentDirectory: function () { return host.getCurrentDirectory(); }, + getNewLine: function () { return host.getNewLine(); }, getSourceFile: program.getSourceFile, getSourceFiles: program.getSourceFiles, - writeFile: writeFileCallback || host.writeFile + writeFile: writeFileCallback || (function (fileName, data, writeByteOrderMark, onError) { return host.writeFile(fileName, data, writeByteOrderMark, onError); }) }; } function getDiagnosticsProducingTypeChecker() { @@ -24663,6 +24665,53 @@ var ts; return findSourceFile(fileName, false, file, nameLiteral.pos, nameLiteral.end - nameLiteral.pos); } } + function computeCommonSourceDirectory(sourceFiles) { + var commonPathComponents; + var currentDirectory = host.getCurrentDirectory(); + ts.forEach(files, function (sourceFile) { + if (ts.isDeclarationFile(sourceFile)) { + return; + } + var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile.fileName, currentDirectory); + sourcePathComponents.pop(); + if (!commonPathComponents) { + commonPathComponents = sourcePathComponents; + return; + } + for (var i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { + if (commonPathComponents[i] !== sourcePathComponents[i]) { + if (i === 0) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); + return; + } + commonPathComponents.length = i; + break; + } + } + if (sourcePathComponents.length < commonPathComponents.length) { + commonPathComponents.length = sourcePathComponents.length; + } + }); + return ts.getNormalizedPathFromPathComponents(commonPathComponents); + } + function checkSourceFilesBelongToPath(sourceFiles, rootDirectory) { + var allFilesBelongToPath = true; + if (sourceFiles) { + var currentDirectory = host.getCurrentDirectory(); + var absoluteRootDirectoryPath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(rootDirectory, currentDirectory)); + for (var _i = 0; _i < sourceFiles.length; _i++) { + var sourceFile = sourceFiles[_i]; + if (!ts.isDeclarationFile(sourceFile)) { + var absoluteSourceFilePath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory)); + if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, sourceFile.fileName, options.rootDir)); + allFilesBelongToPath = false; + } + } + } + } + return allFilesBelongToPath; + } function verifyCompilerOptions() { if (options.separateCompilation) { if (options.sourceMap) { @@ -24710,34 +24759,13 @@ var ts; options.sourceRoot || (options.mapRoot && (!options.out || firstExternalModuleSourceFile !== undefined))) { - var commonPathComponents; - ts.forEach(files, function (sourceFile) { - if (!(sourceFile.flags & 2048) - && !ts.fileExtensionIs(sourceFile.fileName, ".js")) { - var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile.fileName, host.getCurrentDirectory()); - sourcePathComponents.pop(); - if (commonPathComponents) { - for (var i = 0; i < Math.min(commonPathComponents.length, sourcePathComponents.length); i++) { - if (commonPathComponents[i] !== sourcePathComponents[i]) { - if (i === 0) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); - return; - } - commonPathComponents.length = i; - break; - } - } - if (sourcePathComponents.length < commonPathComponents.length) { - commonPathComponents.length = sourcePathComponents.length; - } - } - else { - commonPathComponents = sourcePathComponents; - } - } - }); - commonSourceDirectory = ts.getNormalizedPathFromPathComponents(commonPathComponents); - if (commonSourceDirectory) { + if (options.rootDir && checkSourceFilesBelongToPath(files, options.rootDir)) { + commonSourceDirectory = ts.getNormalizedAbsolutePath(options.rootDir, host.getCurrentDirectory()); + } + else { + commonSourceDirectory = computeCommonSourceDirectory(files); + } + if (commonSourceDirectory && commonSourceDirectory[commonSourceDirectory.length - 1] !== ts.directorySeparator) { commonSourceDirectory += ts.directorySeparator; } } @@ -24864,6 +24892,13 @@ var ts; type: "boolean", description: ts.Diagnostics.Do_not_emit_comments_to_output }, + { + name: "rootDir", + type: "string", + isFilePath: true, + description: ts.Diagnostics.Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir, + paramType: ts.Diagnostics.LOCATION + }, { name: "separateCompilation", type: "boolean" diff --git a/bin/tsserver.js b/bin/tsserver.js index b54ac96e5d0..782f4471799 100644 --- a/bin/tsserver.js +++ b/bin/tsserver.js @@ -1399,6 +1399,8 @@ var ts; Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: ts.DiagnosticCategory.Message, key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." }, Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: ts.DiagnosticCategory.Message, key: "Do not emit declarations for code that has an '@internal' annotation." }, Preserve_new_lines_when_emitting_code: { code: 6057, category: ts.DiagnosticCategory.Message, key: "Preserve new-lines when emitting code." }, + Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir: { code: 6058, category: ts.DiagnosticCategory.Message, key: "Specifies the root directory of input files. Use to control the output directory structure with --outDir." }, + File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files: { code: 6059, category: ts.DiagnosticCategory.Error, key: "File '{0}' is not under 'rootDir' '{1}'. 'rootDir' is expected to contain all source files." }, Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable '{0}' implicitly has an '{1}' type." }, Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter '{0}' implicitly has an '{1}' type." }, Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member '{0}' implicitly has an '{1}' type." }, @@ -2796,6 +2798,13 @@ var ts; type: "boolean", description: ts.Diagnostics.Do_not_emit_comments_to_output }, + { + name: "rootDir", + type: "string", + isFilePath: true, + description: ts.Diagnostics.Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir, + paramType: ts.Diagnostics.LOCATION + }, { name: "separateCompilation", type: "boolean" @@ -11896,7 +11905,7 @@ var ts; return type; } function combineTypeMappers(mapper1, mapper2) { - return function (t) { return mapper2(mapper1(t)); }; + return function (t) { return instantiateType(mapper1(t), mapper2); }; } function instantiateTypeParameter(typeParameter, mapper) { var result = createType(512); @@ -20499,8 +20508,8 @@ var ts; ts.isExternalModuleOrDeclarationFile = isExternalModuleOrDeclarationFile; function emitFiles(resolver, host, targetSourceFile) { var extendsHelper = "\nvar __extends = this.__extends || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n __.prototype = b.prototype;\n d.prototype = new __();\n};"; - var decorateHelper = "\nvar __decorate = this.__decorate || (typeof Reflect === \"object\" && Reflect.decorate) || function (decorators, target, key, desc) {\n switch (arguments.length) {\n case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);\n case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);\n case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);\n }\n};"; - var metadataHelper = "\nvar __metadata = this.__metadata || (typeof Reflect === \"object\" && Reflect.metadata) || function () { };"; + var decorateHelper = "\nvar __decorate = this.__decorate || function (decorators, target, key, desc) {\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") return Reflect.decorate(decorators, target, key, desc);\n switch (arguments.length) {\n case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);\n case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);\n case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);\n }\n};"; + var metadataHelper = "\nvar __metadata = this.__metadata || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};"; var paramHelper = "\nvar __param = this.__param || function(index, decorator) { return function (target, key) { decorator(target, key, index); } };"; var compilerOptions = host.getCompilerOptions(); var languageVersion = compilerOptions.target || 0; @@ -24784,7 +24793,7 @@ var ts; getDiagnosticsProducingTypeChecker: getDiagnosticsProducingTypeChecker, getCommonSourceDirectory: function () { return commonSourceDirectory; }, emit: emit, - getCurrentDirectory: host.getCurrentDirectory, + getCurrentDirectory: function () { return host.getCurrentDirectory(); }, getNodeCount: function () { return getDiagnosticsProducingTypeChecker().getNodeCount(); }, getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); }, getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); }, @@ -24793,14 +24802,14 @@ var ts; return program; function getEmitHost(writeFileCallback) { return { - getCanonicalFileName: host.getCanonicalFileName, + getCanonicalFileName: function (fileName) { return host.getCanonicalFileName(fileName); }, getCommonSourceDirectory: program.getCommonSourceDirectory, getCompilerOptions: program.getCompilerOptions, - getCurrentDirectory: host.getCurrentDirectory, - getNewLine: host.getNewLine, + getCurrentDirectory: function () { return host.getCurrentDirectory(); }, + getNewLine: function () { return host.getNewLine(); }, getSourceFile: program.getSourceFile, getSourceFiles: program.getSourceFiles, - writeFile: writeFileCallback || host.writeFile + writeFile: writeFileCallback || (function (fileName, data, writeByteOrderMark, onError) { return host.writeFile(fileName, data, writeByteOrderMark, onError); }) }; } function getDiagnosticsProducingTypeChecker() { @@ -25006,6 +25015,53 @@ var ts; return findSourceFile(fileName, false, file, nameLiteral.pos, nameLiteral.end - nameLiteral.pos); } } + function computeCommonSourceDirectory(sourceFiles) { + var commonPathComponents; + var currentDirectory = host.getCurrentDirectory(); + ts.forEach(files, function (sourceFile) { + if (ts.isDeclarationFile(sourceFile)) { + return; + } + var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile.fileName, currentDirectory); + sourcePathComponents.pop(); + if (!commonPathComponents) { + commonPathComponents = sourcePathComponents; + return; + } + for (var i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { + if (commonPathComponents[i] !== sourcePathComponents[i]) { + if (i === 0) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); + return; + } + commonPathComponents.length = i; + break; + } + } + if (sourcePathComponents.length < commonPathComponents.length) { + commonPathComponents.length = sourcePathComponents.length; + } + }); + return ts.getNormalizedPathFromPathComponents(commonPathComponents); + } + function checkSourceFilesBelongToPath(sourceFiles, rootDirectory) { + var allFilesBelongToPath = true; + if (sourceFiles) { + var currentDirectory = host.getCurrentDirectory(); + var absoluteRootDirectoryPath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(rootDirectory, currentDirectory)); + for (var _i = 0; _i < sourceFiles.length; _i++) { + var sourceFile = sourceFiles[_i]; + if (!ts.isDeclarationFile(sourceFile)) { + var absoluteSourceFilePath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory)); + if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, sourceFile.fileName, options.rootDir)); + allFilesBelongToPath = false; + } + } + } + } + return allFilesBelongToPath; + } function verifyCompilerOptions() { if (options.separateCompilation) { if (options.sourceMap) { @@ -25053,34 +25109,13 @@ var ts; options.sourceRoot || (options.mapRoot && (!options.out || firstExternalModuleSourceFile !== undefined))) { - var commonPathComponents; - ts.forEach(files, function (sourceFile) { - if (!(sourceFile.flags & 2048) - && !ts.fileExtensionIs(sourceFile.fileName, ".js")) { - var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile.fileName, host.getCurrentDirectory()); - sourcePathComponents.pop(); - if (commonPathComponents) { - for (var i = 0; i < Math.min(commonPathComponents.length, sourcePathComponents.length); i++) { - if (commonPathComponents[i] !== sourcePathComponents[i]) { - if (i === 0) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); - return; - } - commonPathComponents.length = i; - break; - } - } - if (sourcePathComponents.length < commonPathComponents.length) { - commonPathComponents.length = sourcePathComponents.length; - } - } - else { - commonPathComponents = sourcePathComponents; - } - } - }); - commonSourceDirectory = ts.getNormalizedPathFromPathComponents(commonPathComponents); - if (commonSourceDirectory) { + if (options.rootDir && checkSourceFilesBelongToPath(files, options.rootDir)) { + commonSourceDirectory = ts.getNormalizedAbsolutePath(options.rootDir, host.getCurrentDirectory()); + } + else { + commonSourceDirectory = computeCommonSourceDirectory(files); + } + if (commonSourceDirectory && commonSourceDirectory[commonSourceDirectory.length - 1] !== ts.directorySeparator) { commonSourceDirectory += ts.directorySeparator; } } @@ -34835,6 +34870,9 @@ var ts; if (lineText.charAt(i) == " ") { indentPosition--; } + else if (lineText.charAt(i) == "\t") { + indentPosition -= editorOptions.IndentSize; + } else { break; } diff --git a/bin/typescript.d.ts b/bin/typescript.d.ts index 2ce77b9fb70..f86da199763 100644 --- a/bin/typescript.d.ts +++ b/bin/typescript.d.ts @@ -1095,6 +1095,7 @@ declare module "typescript" { preserveConstEnums?: boolean; project?: string; removeComments?: boolean; + rootDir?: string; sourceMap?: boolean; sourceRoot?: string; suppressImplicitAnyIndexErrors?: boolean; diff --git a/bin/typescript.js b/bin/typescript.js index 8b29d8d0252..e012dbafb5b 100644 --- a/bin/typescript.js +++ b/bin/typescript.js @@ -2133,6 +2133,8 @@ var ts; Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: ts.DiagnosticCategory.Message, key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." }, Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: ts.DiagnosticCategory.Message, key: "Do not emit declarations for code that has an '@internal' annotation." }, Preserve_new_lines_when_emitting_code: { code: 6057, category: ts.DiagnosticCategory.Message, key: "Preserve new-lines when emitting code." }, + Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir: { code: 6058, category: ts.DiagnosticCategory.Message, key: "Specifies the root directory of input files. Use to control the output directory structure with --outDir." }, + File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files: { code: 6059, category: ts.DiagnosticCategory.Error, key: "File '{0}' is not under 'rootDir' '{1}'. 'rootDir' is expected to contain all source files." }, Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable '{0}' implicitly has an '{1}' type." }, Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter '{0}' implicitly has an '{1}' type." }, Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member '{0}' implicitly has an '{1}' type." }, @@ -14105,7 +14107,7 @@ var ts; return type; } function combineTypeMappers(mapper1, mapper2) { - return function (t) { return mapper2(mapper1(t)); }; + return function (t) { return instantiateType(mapper1(t), mapper2); }; } function instantiateTypeParameter(typeParameter, mapper) { var result = createType(512 /* TypeParameter */); @@ -24025,9 +24027,9 @@ var ts; // emit output for the __extends helper function var extendsHelper = "\nvar __extends = this.__extends || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n __.prototype = b.prototype;\n d.prototype = new __();\n};"; // emit output for the __decorate helper function - var decorateHelper = "\nvar __decorate = this.__decorate || (typeof Reflect === \"object\" && Reflect.decorate) || function (decorators, target, key, desc) {\n switch (arguments.length) {\n case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);\n case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);\n case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);\n }\n};"; + var decorateHelper = "\nvar __decorate = this.__decorate || function (decorators, target, key, desc) {\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") return Reflect.decorate(decorators, target, key, desc);\n switch (arguments.length) {\n case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);\n case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);\n case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);\n }\n};"; // emit output for the __metadata helper function - var metadataHelper = "\nvar __metadata = this.__metadata || (typeof Reflect === \"object\" && Reflect.metadata) || function () { };"; + var metadataHelper = "\nvar __metadata = this.__metadata || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};"; // emit output for the __param helper function var paramHelper = "\nvar __param = this.__param || function(index, decorator) { return function (target, key) { decorator(target, key, index); } };"; var compilerOptions = host.getCompilerOptions(); @@ -28855,7 +28857,7 @@ var ts; getDiagnosticsProducingTypeChecker: getDiagnosticsProducingTypeChecker, getCommonSourceDirectory: function () { return commonSourceDirectory; }, emit: emit, - getCurrentDirectory: host.getCurrentDirectory, + getCurrentDirectory: function () { return host.getCurrentDirectory(); }, getNodeCount: function () { return getDiagnosticsProducingTypeChecker().getNodeCount(); }, getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); }, getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); }, @@ -28864,14 +28866,14 @@ var ts; return program; function getEmitHost(writeFileCallback) { return { - getCanonicalFileName: host.getCanonicalFileName, + getCanonicalFileName: function (fileName) { return host.getCanonicalFileName(fileName); }, getCommonSourceDirectory: program.getCommonSourceDirectory, getCompilerOptions: program.getCompilerOptions, - getCurrentDirectory: host.getCurrentDirectory, - getNewLine: host.getNewLine, + getCurrentDirectory: function () { return host.getCurrentDirectory(); }, + getNewLine: function () { return host.getNewLine(); }, getSourceFile: program.getSourceFile, getSourceFiles: program.getSourceFiles, - writeFile: writeFileCallback || host.writeFile + writeFile: writeFileCallback || (function (fileName, data, writeByteOrderMark, onError) { return host.writeFile(fileName, data, writeByteOrderMark, onError); }) }; } function getDiagnosticsProducingTypeChecker() { @@ -29095,6 +29097,57 @@ var ts; return findSourceFile(fileName, false, file, nameLiteral.pos, nameLiteral.end - nameLiteral.pos); } } + function computeCommonSourceDirectory(sourceFiles) { + var commonPathComponents; + var currentDirectory = host.getCurrentDirectory(); + ts.forEach(files, function (sourceFile) { + // Each file contributes into common source file path + if (ts.isDeclarationFile(sourceFile)) { + return; + } + var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile.fileName, currentDirectory); + sourcePathComponents.pop(); // The base file name is not part of the common directory path + if (!commonPathComponents) { + // first file + commonPathComponents = sourcePathComponents; + return; + } + for (var i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { + if (commonPathComponents[i] !== sourcePathComponents[i]) { + if (i === 0) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); + return; + } + // New common path found that is 0 -> i-1 + commonPathComponents.length = i; + break; + } + } + // If the sourcePathComponents was shorter than the commonPathComponents, truncate to the sourcePathComponents + if (sourcePathComponents.length < commonPathComponents.length) { + commonPathComponents.length = sourcePathComponents.length; + } + }); + return ts.getNormalizedPathFromPathComponents(commonPathComponents); + } + function checkSourceFilesBelongToPath(sourceFiles, rootDirectory) { + var allFilesBelongToPath = true; + if (sourceFiles) { + var currentDirectory = host.getCurrentDirectory(); + var absoluteRootDirectoryPath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(rootDirectory, currentDirectory)); + for (var _i = 0; _i < sourceFiles.length; _i++) { + var sourceFile = sourceFiles[_i]; + if (!ts.isDeclarationFile(sourceFile)) { + var absoluteSourceFilePath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory)); + if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, sourceFile.fileName, options.rootDir)); + allFilesBelongToPath = false; + } + } + } + } + return allFilesBelongToPath; + } function verifyCompilerOptions() { if (options.separateCompilation) { if (options.sourceMap) { @@ -29147,38 +29200,15 @@ var ts; options.sourceRoot || (options.mapRoot && (!options.out || firstExternalModuleSourceFile !== undefined))) { - var commonPathComponents; - ts.forEach(files, function (sourceFile) { - // Each file contributes into common source file path - if (!(sourceFile.flags & 2048 /* DeclarationFile */) - && !ts.fileExtensionIs(sourceFile.fileName, ".js")) { - var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile.fileName, host.getCurrentDirectory()); - sourcePathComponents.pop(); // FileName is not part of directory - if (commonPathComponents) { - for (var i = 0; i < Math.min(commonPathComponents.length, sourcePathComponents.length); i++) { - if (commonPathComponents[i] !== sourcePathComponents[i]) { - if (i === 0) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); - return; - } - // New common path found that is 0 -> i-1 - commonPathComponents.length = i; - break; - } - } - // If the fileComponent path completely matched and less than already found update the length - if (sourcePathComponents.length < commonPathComponents.length) { - commonPathComponents.length = sourcePathComponents.length; - } - } - else { - // first file - commonPathComponents = sourcePathComponents; - } - } - }); - commonSourceDirectory = ts.getNormalizedPathFromPathComponents(commonPathComponents); - if (commonSourceDirectory) { + if (options.rootDir && checkSourceFilesBelongToPath(files, options.rootDir)) { + // If a rootDir is specified and is valid use it as the commonSourceDirectory + commonSourceDirectory = ts.getNormalizedAbsolutePath(options.rootDir, host.getCurrentDirectory()); + } + else { + // Compute the commonSourceDirectory from the input files + commonSourceDirectory = computeCommonSourceDirectory(files); + } + if (commonSourceDirectory && commonSourceDirectory[commonSourceDirectory.length - 1] !== ts.directorySeparator) { // Make sure directory path ends with directory separator so this string can directly // used to replace with "" to get the relative path of the source file and the relative path doesn't // start with / making it rooted path @@ -29309,6 +29339,13 @@ var ts; type: "boolean", description: ts.Diagnostics.Do_not_emit_comments_to_output }, + { + name: "rootDir", + type: "string", + isFilePath: true, + description: ts.Diagnostics.Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir, + paramType: ts.Diagnostics.LOCATION + }, { name: "separateCompilation", type: "boolean" diff --git a/bin/typescriptServices.d.ts b/bin/typescriptServices.d.ts index e6d06765c27..cd8ee05add4 100644 --- a/bin/typescriptServices.d.ts +++ b/bin/typescriptServices.d.ts @@ -1095,6 +1095,7 @@ declare module ts { preserveConstEnums?: boolean; project?: string; removeComments?: boolean; + rootDir?: string; sourceMap?: boolean; sourceRoot?: string; suppressImplicitAnyIndexErrors?: boolean; diff --git a/bin/typescriptServices.js b/bin/typescriptServices.js index 8b29d8d0252..e012dbafb5b 100644 --- a/bin/typescriptServices.js +++ b/bin/typescriptServices.js @@ -2133,6 +2133,8 @@ var ts; Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: ts.DiagnosticCategory.Message, key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." }, Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: ts.DiagnosticCategory.Message, key: "Do not emit declarations for code that has an '@internal' annotation." }, Preserve_new_lines_when_emitting_code: { code: 6057, category: ts.DiagnosticCategory.Message, key: "Preserve new-lines when emitting code." }, + Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir: { code: 6058, category: ts.DiagnosticCategory.Message, key: "Specifies the root directory of input files. Use to control the output directory structure with --outDir." }, + File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files: { code: 6059, category: ts.DiagnosticCategory.Error, key: "File '{0}' is not under 'rootDir' '{1}'. 'rootDir' is expected to contain all source files." }, Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable '{0}' implicitly has an '{1}' type." }, Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter '{0}' implicitly has an '{1}' type." }, Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member '{0}' implicitly has an '{1}' type." }, @@ -14105,7 +14107,7 @@ var ts; return type; } function combineTypeMappers(mapper1, mapper2) { - return function (t) { return mapper2(mapper1(t)); }; + return function (t) { return instantiateType(mapper1(t), mapper2); }; } function instantiateTypeParameter(typeParameter, mapper) { var result = createType(512 /* TypeParameter */); @@ -24025,9 +24027,9 @@ var ts; // emit output for the __extends helper function var extendsHelper = "\nvar __extends = this.__extends || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n __.prototype = b.prototype;\n d.prototype = new __();\n};"; // emit output for the __decorate helper function - var decorateHelper = "\nvar __decorate = this.__decorate || (typeof Reflect === \"object\" && Reflect.decorate) || function (decorators, target, key, desc) {\n switch (arguments.length) {\n case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);\n case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);\n case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);\n }\n};"; + var decorateHelper = "\nvar __decorate = this.__decorate || function (decorators, target, key, desc) {\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") return Reflect.decorate(decorators, target, key, desc);\n switch (arguments.length) {\n case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);\n case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);\n case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);\n }\n};"; // emit output for the __metadata helper function - var metadataHelper = "\nvar __metadata = this.__metadata || (typeof Reflect === \"object\" && Reflect.metadata) || function () { };"; + var metadataHelper = "\nvar __metadata = this.__metadata || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};"; // emit output for the __param helper function var paramHelper = "\nvar __param = this.__param || function(index, decorator) { return function (target, key) { decorator(target, key, index); } };"; var compilerOptions = host.getCompilerOptions(); @@ -28855,7 +28857,7 @@ var ts; getDiagnosticsProducingTypeChecker: getDiagnosticsProducingTypeChecker, getCommonSourceDirectory: function () { return commonSourceDirectory; }, emit: emit, - getCurrentDirectory: host.getCurrentDirectory, + getCurrentDirectory: function () { return host.getCurrentDirectory(); }, getNodeCount: function () { return getDiagnosticsProducingTypeChecker().getNodeCount(); }, getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); }, getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); }, @@ -28864,14 +28866,14 @@ var ts; return program; function getEmitHost(writeFileCallback) { return { - getCanonicalFileName: host.getCanonicalFileName, + getCanonicalFileName: function (fileName) { return host.getCanonicalFileName(fileName); }, getCommonSourceDirectory: program.getCommonSourceDirectory, getCompilerOptions: program.getCompilerOptions, - getCurrentDirectory: host.getCurrentDirectory, - getNewLine: host.getNewLine, + getCurrentDirectory: function () { return host.getCurrentDirectory(); }, + getNewLine: function () { return host.getNewLine(); }, getSourceFile: program.getSourceFile, getSourceFiles: program.getSourceFiles, - writeFile: writeFileCallback || host.writeFile + writeFile: writeFileCallback || (function (fileName, data, writeByteOrderMark, onError) { return host.writeFile(fileName, data, writeByteOrderMark, onError); }) }; } function getDiagnosticsProducingTypeChecker() { @@ -29095,6 +29097,57 @@ var ts; return findSourceFile(fileName, false, file, nameLiteral.pos, nameLiteral.end - nameLiteral.pos); } } + function computeCommonSourceDirectory(sourceFiles) { + var commonPathComponents; + var currentDirectory = host.getCurrentDirectory(); + ts.forEach(files, function (sourceFile) { + // Each file contributes into common source file path + if (ts.isDeclarationFile(sourceFile)) { + return; + } + var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile.fileName, currentDirectory); + sourcePathComponents.pop(); // The base file name is not part of the common directory path + if (!commonPathComponents) { + // first file + commonPathComponents = sourcePathComponents; + return; + } + for (var i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { + if (commonPathComponents[i] !== sourcePathComponents[i]) { + if (i === 0) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); + return; + } + // New common path found that is 0 -> i-1 + commonPathComponents.length = i; + break; + } + } + // If the sourcePathComponents was shorter than the commonPathComponents, truncate to the sourcePathComponents + if (sourcePathComponents.length < commonPathComponents.length) { + commonPathComponents.length = sourcePathComponents.length; + } + }); + return ts.getNormalizedPathFromPathComponents(commonPathComponents); + } + function checkSourceFilesBelongToPath(sourceFiles, rootDirectory) { + var allFilesBelongToPath = true; + if (sourceFiles) { + var currentDirectory = host.getCurrentDirectory(); + var absoluteRootDirectoryPath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(rootDirectory, currentDirectory)); + for (var _i = 0; _i < sourceFiles.length; _i++) { + var sourceFile = sourceFiles[_i]; + if (!ts.isDeclarationFile(sourceFile)) { + var absoluteSourceFilePath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory)); + if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, sourceFile.fileName, options.rootDir)); + allFilesBelongToPath = false; + } + } + } + } + return allFilesBelongToPath; + } function verifyCompilerOptions() { if (options.separateCompilation) { if (options.sourceMap) { @@ -29147,38 +29200,15 @@ var ts; options.sourceRoot || (options.mapRoot && (!options.out || firstExternalModuleSourceFile !== undefined))) { - var commonPathComponents; - ts.forEach(files, function (sourceFile) { - // Each file contributes into common source file path - if (!(sourceFile.flags & 2048 /* DeclarationFile */) - && !ts.fileExtensionIs(sourceFile.fileName, ".js")) { - var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile.fileName, host.getCurrentDirectory()); - sourcePathComponents.pop(); // FileName is not part of directory - if (commonPathComponents) { - for (var i = 0; i < Math.min(commonPathComponents.length, sourcePathComponents.length); i++) { - if (commonPathComponents[i] !== sourcePathComponents[i]) { - if (i === 0) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); - return; - } - // New common path found that is 0 -> i-1 - commonPathComponents.length = i; - break; - } - } - // If the fileComponent path completely matched and less than already found update the length - if (sourcePathComponents.length < commonPathComponents.length) { - commonPathComponents.length = sourcePathComponents.length; - } - } - else { - // first file - commonPathComponents = sourcePathComponents; - } - } - }); - commonSourceDirectory = ts.getNormalizedPathFromPathComponents(commonPathComponents); - if (commonSourceDirectory) { + if (options.rootDir && checkSourceFilesBelongToPath(files, options.rootDir)) { + // If a rootDir is specified and is valid use it as the commonSourceDirectory + commonSourceDirectory = ts.getNormalizedAbsolutePath(options.rootDir, host.getCurrentDirectory()); + } + else { + // Compute the commonSourceDirectory from the input files + commonSourceDirectory = computeCommonSourceDirectory(files); + } + if (commonSourceDirectory && commonSourceDirectory[commonSourceDirectory.length - 1] !== ts.directorySeparator) { // Make sure directory path ends with directory separator so this string can directly // used to replace with "" to get the relative path of the source file and the relative path doesn't // start with / making it rooted path @@ -29309,6 +29339,13 @@ var ts; type: "boolean", description: ts.Diagnostics.Do_not_emit_comments_to_output }, + { + name: "rootDir", + type: "string", + isFilePath: true, + description: ts.Diagnostics.Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir, + paramType: ts.Diagnostics.LOCATION + }, { name: "separateCompilation", type: "boolean" From a17d1cd38c2f475431deac851e7095770b12c79b Mon Sep 17 00:00:00 2001 From: Pedro Maltez Date: Wed, 22 Apr 2015 00:57:59 +0100 Subject: [PATCH 19/45] Add SVG version of logo as per #1375 --- doc/logo.svg | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 doc/logo.svg diff --git a/doc/logo.svg b/doc/logo.svg new file mode 100644 index 00000000000..fc7e0fadd66 --- /dev/null +++ b/doc/logo.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + From 92756e135b08a6d1481c238256d3859c968d0ce0 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 21 Apr 2015 17:01:34 -0700 Subject: [PATCH 20/45] Blocks with locals should be added to the container chain so we can detect name collisions in them. --- src/compiler/binder.ts | 15 +++++++---- src/compiler/scanner.ts | 2 +- .../nameCollisionWithBlockScopedVariable1.js | 25 +++++++++++++++++++ ...eCollisionWithBlockScopedVariable1.symbols | 17 +++++++++++++ ...ameCollisionWithBlockScopedVariable1.types | 19 ++++++++++++++ .../nameCollisionWithBlockScopedVariable1.ts | 10 ++++++++ 6 files changed, 82 insertions(+), 6 deletions(-) create mode 100644 tests/baselines/reference/nameCollisionWithBlockScopedVariable1.js create mode 100644 tests/baselines/reference/nameCollisionWithBlockScopedVariable1.symbols create mode 100644 tests/baselines/reference/nameCollisionWithBlockScopedVariable1.types create mode 100644 tests/cases/compiler/nameCollisionWithBlockScopedVariable1.ts diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 9d6d9fab35b..170f3d3c830 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -239,11 +239,7 @@ module ts { if (symbolKind & SymbolFlags.IsContainer) { container = node; - if (lastContainer) { - lastContainer.nextContainer = container; - } - - lastContainer = container; + addToContainerChain(container); } if (isBlockScopeContainer) { @@ -262,6 +258,14 @@ module ts { blockScopeContainer = savedBlockScopeContainer; } + function addToContainerChain(node: Node) { + if (lastContainer) { + lastContainer.nextContainer = node; + } + + lastContainer = node; + } + function bindDeclaration(node: Declaration, symbolKind: SymbolFlags, symbolExcludes: SymbolFlags, isBlockScopeContainer: boolean) { switch (container.kind) { case SyntaxKind.ModuleDeclaration: @@ -403,6 +407,7 @@ module ts { default: if (!blockScopeContainer.locals) { blockScopeContainer.locals = {}; + addToContainerChain(blockScopeContainer); } declareSymbol(blockScopeContainer.locals, undefined, node, symbolKind, symbolExcludes); } diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index c2b693d6772..df6c20a8107 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -352,7 +352,7 @@ module ts { export function isLineBreak(ch: number): boolean { // ES5 7.3: // The ECMAScript line terminator characters are listed in Table 3. - // Table 3 — Line Terminator Characters + // Table 3: Line Terminator Characters // Code Unit Value Name Formal Name // \u000A Line Feed // \u000D Carriage Return diff --git a/tests/baselines/reference/nameCollisionWithBlockScopedVariable1.js b/tests/baselines/reference/nameCollisionWithBlockScopedVariable1.js new file mode 100644 index 00000000000..6a7041a6733 --- /dev/null +++ b/tests/baselines/reference/nameCollisionWithBlockScopedVariable1.js @@ -0,0 +1,25 @@ +//// [nameCollisionWithBlockScopedVariable1.ts] +module M { + export class C { } +} +module M { + { + let M = 0; + new C(); + } +} + +//// [nameCollisionWithBlockScopedVariable1.js] +var M; +(function (M) { + class C { + } + M.C = C; +})(M || (M = {})); +var M; +(function (M_1) { + { + let M = 0; + new M_1.C(); + } +})(M || (M = {})); diff --git a/tests/baselines/reference/nameCollisionWithBlockScopedVariable1.symbols b/tests/baselines/reference/nameCollisionWithBlockScopedVariable1.symbols new file mode 100644 index 00000000000..9c0d01bd8e9 --- /dev/null +++ b/tests/baselines/reference/nameCollisionWithBlockScopedVariable1.symbols @@ -0,0 +1,17 @@ +=== tests/cases/compiler/nameCollisionWithBlockScopedVariable1.ts === +module M { +>M : Symbol(M, Decl(nameCollisionWithBlockScopedVariable1.ts, 0, 0), Decl(nameCollisionWithBlockScopedVariable1.ts, 2, 1)) + + export class C { } +>C : Symbol(C, Decl(nameCollisionWithBlockScopedVariable1.ts, 0, 10)) +} +module M { +>M : Symbol(M, Decl(nameCollisionWithBlockScopedVariable1.ts, 0, 0), Decl(nameCollisionWithBlockScopedVariable1.ts, 2, 1)) + { + let M = 0; +>M : Symbol(M, Decl(nameCollisionWithBlockScopedVariable1.ts, 5, 11)) + + new C(); +>C : Symbol(C, Decl(nameCollisionWithBlockScopedVariable1.ts, 0, 10)) + } +} diff --git a/tests/baselines/reference/nameCollisionWithBlockScopedVariable1.types b/tests/baselines/reference/nameCollisionWithBlockScopedVariable1.types new file mode 100644 index 00000000000..7a3c07af187 --- /dev/null +++ b/tests/baselines/reference/nameCollisionWithBlockScopedVariable1.types @@ -0,0 +1,19 @@ +=== tests/cases/compiler/nameCollisionWithBlockScopedVariable1.ts === +module M { +>M : typeof M + + export class C { } +>C : C +} +module M { +>M : typeof M + { + let M = 0; +>M : number +>0 : number + + new C(); +>new C() : C +>C : typeof C + } +} diff --git a/tests/cases/compiler/nameCollisionWithBlockScopedVariable1.ts b/tests/cases/compiler/nameCollisionWithBlockScopedVariable1.ts new file mode 100644 index 00000000000..231476ee339 --- /dev/null +++ b/tests/cases/compiler/nameCollisionWithBlockScopedVariable1.ts @@ -0,0 +1,10 @@ +// @target: es6 +module M { + export class C { } +} +module M { + { + let M = 0; + new C(); + } +} \ No newline at end of file From 81ebac5d77b90f616a687bd6a0b8466fd09f65ff Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 21 Apr 2015 17:05:03 -0700 Subject: [PATCH 21/45] Produce type and symbol baseslines when running tests. --- src/harness/compilerRunner.ts | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/harness/compilerRunner.ts b/src/harness/compilerRunner.ts index 42a0cabe48c..3dbd67190e9 100644 --- a/src/harness/compilerRunner.ts +++ b/src/harness/compilerRunner.ts @@ -97,7 +97,7 @@ class CompilerBaselineRunner extends RunnerBase { program = _program; }, function (settings) { harnessCompiler.setCompilerSettings(tcSettings); - }); + }); }); beforeEach(() => { @@ -252,7 +252,7 @@ class CompilerBaselineRunner extends RunnerBase { } }); - it('Correct type baselines for ' + fileName, () => { + it('Correct type/symbol baselines for ' + fileName, () => { if (fileName.indexOf("APISample") >= 0) { return; } @@ -289,8 +289,26 @@ class CompilerBaselineRunner extends RunnerBase { // Produce baselines. The first gives the types for all expressions. // The second gives symbols for all identifiers. - checkBaseLines(/*isSymbolBaseLine:*/ false); - checkBaseLines(/*isSymbolBaseLine:*/ true); + var e1: Error, e2: Error; + try { + checkBaseLines(/*isSymbolBaseLine:*/ false); + } + catch (e) { + e1 = e; + } + + try { + checkBaseLines(/*isSymbolBaseLine:*/ true); + } + catch (e) { + e2 = e; + } + + if (e1 || e2) { + throw e1 || e2; + } + + return; function checkBaseLines(isSymbolBaseLine: boolean) { let fullBaseLine = generateBaseLine(fullResults, isSymbolBaseLine); From 782c55f7711573106461161a12657f6df901c75e Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Tue, 21 Apr 2015 17:39:50 -0700 Subject: [PATCH 22/45] Addressing CR feedback --- src/compiler/checker.ts | 41 ++++++++++++++++++----------------------- src/compiler/types.ts | 13 ++++++++----- 2 files changed, 26 insertions(+), 28 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 261924dd9a4..9b54f771f21 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -2635,32 +2635,28 @@ module ts { } } - function getDeclaredPropertiesOfClassOrInterface(type: InterfaceType): Symbol[] { - resolveDeclaredMembers(type); - return type.declaredProperties; - } - - function resolveDeclaredMembers(type: InterfaceType) { - if (!type.declaredProperties) { + function resolveDeclaredMembers(type: InterfaceType): InterfaceTypeWithDeclaredMembers { + if (!(type).declaredProperties) { var symbol = type.symbol; - type.declaredProperties = getNamedMembers(symbol.members); - type.declaredCallSignatures = getSignaturesOfSymbol(symbol.members["__call"]); - type.declaredConstructSignatures = getSignaturesOfSymbol(symbol.members["__new"]); - type.declaredStringIndexType = getIndexTypeOfSymbol(symbol, IndexKind.String); - type.declaredNumberIndexType = getIndexTypeOfSymbol(symbol, IndexKind.Number); + (type).declaredProperties = getNamedMembers(symbol.members); + (type).declaredCallSignatures = getSignaturesOfSymbol(symbol.members["__call"]); + (type).declaredConstructSignatures = getSignaturesOfSymbol(symbol.members["__new"]); + (type).declaredStringIndexType = getIndexTypeOfSymbol(symbol, IndexKind.String); + (type).declaredNumberIndexType = getIndexTypeOfSymbol(symbol, IndexKind.Number); } + return type; } function resolveClassOrInterfaceMembers(type: InterfaceType): void { - resolveDeclaredMembers(type); - let members = type.symbol.members; - let callSignatures = type.declaredCallSignatures; - let constructSignatures = type.declaredConstructSignatures; - let stringIndexType = type.declaredStringIndexType; - let numberIndexType = type.declaredNumberIndexType; - let baseTypes = getBaseTypes(type); + let target = resolveDeclaredMembers(type); + let members = target.symbol.members; + let callSignatures = target.declaredCallSignatures; + let constructSignatures = target.declaredConstructSignatures; + let stringIndexType = target.declaredStringIndexType; + let numberIndexType = target.declaredNumberIndexType; + let baseTypes = getBaseTypes(target); if (baseTypes.length) { - members = createSymbolTable(type.declaredProperties); + members = createSymbolTable(target.declaredProperties); for (let baseType of baseTypes) { addInheritedMembers(members, getPropertiesOfObjectType(baseType)); callSignatures = concatenate(callSignatures, getSignaturesOfType(baseType, SignatureKind.Call)); @@ -2673,8 +2669,7 @@ module ts { } function resolveTypeReferenceMembers(type: TypeReference): void { - let target = type.target; - resolveDeclaredMembers(target); + let target = resolveDeclaredMembers(type.target); let mapper = createTypeMapper(target.typeParameters, type.typeArguments); let members = createInstantiatedSymbolTable(target.declaredProperties, mapper); let callSignatures = instantiateList(target.declaredCallSignatures, mapper, instantiateSignature); @@ -10139,7 +10134,7 @@ module ts { } let seen: Map<{ prop: Symbol; containingType: Type }> = {}; - forEach(getDeclaredPropertiesOfClassOrInterface(type), p => { seen[p.name] = { prop: p, containingType: type }; }); + forEach(resolveDeclaredMembers(type).declaredProperties, p => { seen[p.name] = { prop: p, containingType: type }; }); let ok = true; for (let base of baseTypes) { diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 54f2e5e2bd4..353f63e4287 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1485,17 +1485,20 @@ module ts { // Class and interface types (TypeFlags.Class and TypeFlags.Interface) export interface InterfaceType extends ObjectType { typeParameters: TypeParameter[]; // Type parameters (undefined if non-generic) - declaredProperties: Symbol[]; // Declared members (computed by resolveDeclaredMembers) - declaredCallSignatures: Signature[]; // Declared call signatures (computed by resolveDeclaredMembers) - declaredConstructSignatures: Signature[]; // Declared construct signatures (computed by resolveDeclaredMembers) - declaredStringIndexType: Type; // Declared string index type (computed by resolveDeclaredMembers) - declaredNumberIndexType: Type; // Declared numeric index type (computed by resolveDeclaredMembers) } export interface InterfaceTypeWithBaseTypes extends InterfaceType { baseTypes: ObjectType[]; } + export interface InterfaceTypeWithDeclaredMembers extends InterfaceType { + declaredProperties: Symbol[]; // Declared members + declaredCallSignatures: Signature[]; // Declared call signatures + declaredConstructSignatures: Signature[]; // Declared construct signatures + declaredStringIndexType: Type; // Declared string index type + declaredNumberIndexType: Type; // Declared numeric index type + } + // Type references (TypeFlags.Reference) export interface TypeReference extends ObjectType { target: GenericType; // Type reference target From 378b5ffd1af2249658c8b7a3dc7465d911af93ff Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Fri, 3 Apr 2015 06:05:58 +0000 Subject: [PATCH 23/45] Add support for UMD-like module export format The new module format enables global-less universal modules, compatible with both AMD and CJS module loaders. Fixes #2036. --- src/compiler/commandLineParser.ts | 7 +- .../diagnosticInformationMap.generated.ts | 4 +- src/compiler/diagnosticMessages.json | 4 +- src/compiler/emitter.ts | 68 ++++++++--- src/compiler/types.ts | 1 + src/harness/harness.ts | 2 + tests/baselines/reference/es5-umd.js | 32 +++++ tests/baselines/reference/es5-umd.js.map | 2 + .../baselines/reference/es5-umd.sourcemap.txt | 115 ++++++++++++++++++ tests/baselines/reference/es5-umd.symbols | 17 +++ tests/baselines/reference/es5-umd.types | 18 +++ .../umdDependencyComment2.errors.txt | 11 ++ .../reference/umdDependencyComment2.js | 20 +++ .../umdDependencyCommentName1.errors.txt | 11 ++ .../reference/umdDependencyCommentName1.js | 20 +++ .../umdDependencyCommentName2.errors.txt | 13 ++ .../reference/umdDependencyCommentName2.js | 24 ++++ tests/cases/compiler/es5-umd.ts | 17 +++ tests/cases/compiler/umdDependencyComment2.ts | 5 + .../compiler/umdDependencyCommentName1.ts | 5 + .../compiler/umdDependencyCommentName2.ts | 7 ++ 21 files changed, 378 insertions(+), 25 deletions(-) create mode 100644 tests/baselines/reference/es5-umd.js create mode 100644 tests/baselines/reference/es5-umd.js.map create mode 100644 tests/baselines/reference/es5-umd.sourcemap.txt create mode 100644 tests/baselines/reference/es5-umd.symbols create mode 100644 tests/baselines/reference/es5-umd.types create mode 100644 tests/baselines/reference/umdDependencyComment2.errors.txt create mode 100644 tests/baselines/reference/umdDependencyComment2.js create mode 100644 tests/baselines/reference/umdDependencyCommentName1.errors.txt create mode 100644 tests/baselines/reference/umdDependencyCommentName1.js create mode 100644 tests/baselines/reference/umdDependencyCommentName2.errors.txt create mode 100644 tests/baselines/reference/umdDependencyCommentName2.js create mode 100644 tests/cases/compiler/es5-umd.ts create mode 100644 tests/cases/compiler/umdDependencyComment2.ts create mode 100644 tests/cases/compiler/umdDependencyCommentName1.ts create mode 100644 tests/cases/compiler/umdDependencyCommentName2.ts diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 47f0594a76e..adb0e2d37c5 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -50,11 +50,12 @@ module ts { shortName: "m", type: { "commonjs": ModuleKind.CommonJS, - "amd": ModuleKind.AMD + "amd": ModuleKind.AMD, + "umd": ModuleKind.UMD }, - description: Diagnostics.Specify_module_code_generation_Colon_commonjs_or_amd, + description: Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_or_umd, paramType: Diagnostics.KIND, - error: Diagnostics.Argument_for_module_option_must_be_commonjs_or_amd + error: Diagnostics.Argument_for_module_option_must_be_commonjs_amd_or_umd }, { name: "noEmit", diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 90f0ed0a0df..f03b2ea16b3 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -463,7 +463,7 @@ module ts { Do_not_emit_comments_to_output: { code: 6009, category: DiagnosticCategory.Message, key: "Do not emit comments to output." }, Do_not_emit_outputs: { code: 6010, category: DiagnosticCategory.Message, key: "Do not emit outputs." }, Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, - Specify_module_code_generation_Colon_commonjs_or_amd: { code: 6016, category: DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs' or 'amd'" }, + Specify_module_code_generation_Colon_commonjs_amd_or_umd: { code: 6016, category: DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs', 'amd', or 'umd'" }, Print_this_message: { code: 6017, category: DiagnosticCategory.Message, key: "Print this message." }, Print_the_compiler_s_version: { code: 6019, category: DiagnosticCategory.Message, key: "Print the compiler's version." }, Compile_the_project_in_the_given_directory: { code: 6020, category: DiagnosticCategory.Message, key: "Compile the project in the given directory." }, @@ -484,7 +484,7 @@ module ts { Generates_corresponding_map_file: { code: 6043, category: DiagnosticCategory.Message, key: "Generates corresponding '.map' file." }, Compiler_option_0_expects_an_argument: { code: 6044, category: DiagnosticCategory.Error, key: "Compiler option '{0}' expects an argument." }, Unterminated_quoted_string_in_response_file_0: { code: 6045, category: DiagnosticCategory.Error, key: "Unterminated quoted string in response file '{0}'." }, - Argument_for_module_option_must_be_commonjs_or_amd: { code: 6046, category: DiagnosticCategory.Error, key: "Argument for '--module' option must be 'commonjs' or 'amd'." }, + Argument_for_module_option_must_be_commonjs_amd_or_umd: { code: 6046, category: DiagnosticCategory.Error, key: "Argument for '--module' option must be 'commonjs', 'amd', or 'umd'." }, Argument_for_target_option_must_be_es3_es5_or_es6: { code: 6047, category: DiagnosticCategory.Error, key: "Argument for '--target' option must be 'es3', 'es5', or 'es6'." }, Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: DiagnosticCategory.Error, key: "Locale must be of the form or -. For example '{0}' or '{1}'." }, Unsupported_locale_0: { code: 6049, category: DiagnosticCategory.Error, key: "Unsupported locale '{0}'." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 48ef245c766..7192987f810 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1840,7 +1840,7 @@ "category": "Message", "code": 6015 }, - "Specify module code generation: 'commonjs' or 'amd'": { + "Specify module code generation: 'commonjs', 'amd', or 'umd'": { "category": "Message", "code": 6016 }, @@ -1924,7 +1924,7 @@ "category": "Error", "code": 6045 }, - "Argument for '--module' option must be 'commonjs' or 'amd'.": { + "Argument for '--module' option must be 'commonjs', 'amd', or 'umd'.": { "category": "Error", "code": 6046 }, diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index f4aa0fe1022..5a3c227931c 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -4645,27 +4645,25 @@ var __param = this.__param || function(index, decorator) { return function (targ } } - function emitAMDModule(node: SourceFile, startIndex: number) { - collectExternalModuleInfo(node); - + function emitAMDDependencies(node: SourceFile, includeNonAmdDependencies: boolean) { // An AMD define function has the following shape: // define(id?, dependencies?, factory); // // This has the shape of // define(name, ["module1", "module2"], function (module1Alias) { - // The location of the alias in the parameter list in the factory function needs to + // The location of the alias in the parameter list in the factory function needs to // match the position of the module name in the dependency list. // - // To ensure this is true in cases of modules with no aliases, e.g.: - // `import "module"` or `` + // To ensure this is true in cases of modules with no aliases, e.g.: + // `import "module"` or `` // we need to add modules without alias names to the end of the dependencies list - - let aliasedModuleNames: string[] = []; // names of modules with corresponding parameter in the + + let aliasedModuleNames: string[] = []; // names of modules with corresponding parameter in the // factory function. let unaliasedModuleNames: string[] = []; // names of modules with no corresponding parameters in // factory function. - let importAliasNames: string[] = []; // names of the parameters in the factory function; these - // paramters need to match the indexes of the corresponding + let importAliasNames: string[] = []; // names of the parameters in the factory function; these + // parameters need to match the indexes of the corresponding // module names in aliasedModuleNames. // Fill in amd-dependency tags @@ -4687,7 +4685,7 @@ var __param = this.__param || function(index, decorator) { return function (targ externalModuleName = getLiteralText(moduleName); } - // Find the name of the module alais, if there is one + // Find the name of the module alias, if there is one let importAliasName: string; let namespaceDeclaration = getNamespaceDeclarationNode(importNode); if (namespaceDeclaration && !isDefaultImport(importNode)) { @@ -4697,7 +4695,7 @@ var __param = this.__param || function(index, decorator) { return function (targ importAliasName = getGeneratedNameForNode(importNode); } - if (importAliasName) { + if (includeNonAmdDependencies && importAliasName) { aliasedModuleNames.push(externalModuleName); importAliasNames.push(importAliasName); } @@ -4705,12 +4703,7 @@ var __param = this.__param || function(index, decorator) { return function (targ unaliasedModuleNames.push(externalModuleName); } } - - writeLine(); - write("define("); - if (node.amdModuleName) { - write("\"" + node.amdModuleName + "\", "); - } + write("[\"require\", \"exports\""); if (aliasedModuleNames.length) { write(", "); @@ -4725,6 +4718,17 @@ var __param = this.__param || function(index, decorator) { return function (targ write(", "); write(importAliasNames.join(", ")); } + } + + function emitAMDModule(node: SourceFile, startIndex: number) { + collectExternalModuleInfo(node); + + writeLine(); + write("define("); + if (node.amdModuleName) { + write("\"" + node.amdModuleName + "\", "); + } + emitAMDDependencies(node, /*includeNonAmdDependencies*/ true); write(") {"); increaseIndent(); emitExportStarHelper(); @@ -4746,6 +4750,31 @@ var __param = this.__param || function(index, decorator) { return function (targ emitExportEquals(/*emitAsReturn*/ false); } + function emitUMDModule(node: SourceFile, startIndex: number) { + collectExternalModuleInfo(node); + + // Module is detected first to support Browserify users that load into a browser with an AMD loader + writeLines(`(function (deps, factory) { + if (typeof module === 'object' && typeof module.exports === 'object') { + var v = factory(require, exports); if (v !== undefined) module.exports = v; + } + else if (typeof define === 'function' && define.amd) { + define(deps, factory); + } +})(`); + emitAMDDependencies(node, false); + write(") {"); + increaseIndent(); + emitExportStarHelper(); + emitCaptureThisForNodeIfNecessary(node); + emitLinesStartingAt(node.statements, startIndex); + emitTempDeclarations(/*newLine*/ true); + emitExportEquals(/*emitAsReturn*/ true); + decreaseIndent(); + writeLine(); + write("});"); + } + function emitES6Module(node: SourceFile, startIndex: number) { externalImports = undefined; exportSpecifiers = undefined; @@ -4830,6 +4859,9 @@ var __param = this.__param || function(index, decorator) { return function (targ else if (compilerOptions.module === ModuleKind.AMD) { emitAMDModule(node, startIndex); } + else if (compilerOptions.module === ModuleKind.UMD) { + emitUMDModule(node, startIndex); + } else { emitCommonJSModule(node, startIndex); } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index bff15a1ab9d..deb8cafc095 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1671,6 +1671,7 @@ module ts { None = 0, CommonJS = 1, AMD = 2, + UMD = 3, } export interface LineAndCharacter { diff --git a/src/harness/harness.ts b/src/harness/harness.ts index 784d8312d69..bec929b7dbf 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -957,6 +957,8 @@ module Harness { if (typeof setting.value === 'string') { if (setting.value.toLowerCase() === 'amd') { options.module = ts.ModuleKind.AMD; + } else if (setting.value.toLowerCase() === 'umd') { + options.module = ts.ModuleKind.UMD; } else if (setting.value.toLowerCase() === 'commonjs') { options.module = ts.ModuleKind.CommonJS; } else if (setting.value.toLowerCase() === 'unspecified') { diff --git a/tests/baselines/reference/es5-umd.js b/tests/baselines/reference/es5-umd.js new file mode 100644 index 00000000000..2fe8d686242 --- /dev/null +++ b/tests/baselines/reference/es5-umd.js @@ -0,0 +1,32 @@ +//// [es5-umd.ts] + +class A +{ + constructor () + { + + } + + public B() + { + return 42; + } +} + + +//// [es5-umd.js] +var A = (function () { + function A() { + } + A.prototype.B = function () { + return 42; + }; + return A; +})(); +//# sourceMappingURL=es5-umd.js.map + +//// [es5-umd.d.ts] +declare class A { + constructor(); + B(): number; +} diff --git a/tests/baselines/reference/es5-umd.js.map b/tests/baselines/reference/es5-umd.js.map new file mode 100644 index 00000000000..785990dc2cb --- /dev/null +++ b/tests/baselines/reference/es5-umd.js.map @@ -0,0 +1,2 @@ +//// [es5-umd.js.map] +{"version":3,"file":"es5-umd.js","sourceRoot":"","sources":["es5-umd.ts"],"names":["A","A.constructor","A.B"],"mappings":"AACA;IAEIA;IAGAC,CAACA;IAEMD,aAACA,GAARA;QAEIE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;IACLF,QAACA;AAADA,CAACA,AAXD,IAWC"} \ No newline at end of file diff --git a/tests/baselines/reference/es5-umd.sourcemap.txt b/tests/baselines/reference/es5-umd.sourcemap.txt new file mode 100644 index 00000000000..55413ee1eb2 --- /dev/null +++ b/tests/baselines/reference/es5-umd.sourcemap.txt @@ -0,0 +1,115 @@ +=================================================================== +JsFile: es5-umd.js +mapUrl: es5-umd.js.map +sourceRoot: +sources: es5-umd.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/es5-umd.js +sourceFile:es5-umd.ts +------------------------------------------------------------------- +>>>var A = (function () { +1 > +2 >^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) +--- +>>> function A() { +1->^^^^ +2 > ^^-> +1->class A + >{ + > +1->Emitted(2, 5) Source(4, 5) + SourceIndex(0) name (A) +--- +>>> } +1->^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1->constructor () + > { + > + > +2 > } +1->Emitted(3, 5) Source(7, 5) + SourceIndex(0) name (A.constructor) +2 >Emitted(3, 6) Source(7, 6) + SourceIndex(0) name (A.constructor) +--- +>>> A.prototype.B = function () { +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +1-> + > + > public +2 > B +3 > +1->Emitted(4, 5) Source(9, 12) + SourceIndex(0) name (A) +2 >Emitted(4, 18) Source(9, 13) + SourceIndex(0) name (A) +3 >Emitted(4, 21) Source(9, 5) + SourceIndex(0) name (A) +--- +>>> return 42; +1 >^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^ +5 > ^ +1 >public B() + > { + > +2 > return +3 > +4 > 42 +5 > ; +1 >Emitted(5, 9) Source(11, 9) + SourceIndex(0) name (A.B) +2 >Emitted(5, 15) Source(11, 15) + SourceIndex(0) name (A.B) +3 >Emitted(5, 16) Source(11, 16) + SourceIndex(0) name (A.B) +4 >Emitted(5, 18) Source(11, 18) + SourceIndex(0) name (A.B) +5 >Emitted(5, 19) Source(11, 19) + SourceIndex(0) name (A.B) +--- +>>> }; +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(6, 5) Source(12, 5) + SourceIndex(0) name (A.B) +2 >Emitted(6, 6) Source(12, 6) + SourceIndex(0) name (A.B) +--- +>>> return A; +1->^^^^ +2 > ^^^^^^^^ +1-> + > +2 > } +1->Emitted(7, 5) Source(13, 1) + SourceIndex(0) name (A) +2 >Emitted(7, 13) Source(13, 2) + SourceIndex(0) name (A) +--- +>>>})(); +1 > +2 >^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >} +3 > +4 > class A + > { + > constructor () + > { + > + > } + > + > public B() + > { + > return 42; + > } + > } +1 >Emitted(8, 1) Source(13, 1) + SourceIndex(0) name (A) +2 >Emitted(8, 2) Source(13, 2) + SourceIndex(0) name (A) +3 >Emitted(8, 2) Source(2, 1) + SourceIndex(0) +4 >Emitted(8, 6) Source(13, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=es5-umd.js.map \ No newline at end of file diff --git a/tests/baselines/reference/es5-umd.symbols b/tests/baselines/reference/es5-umd.symbols new file mode 100644 index 00000000000..1914a7877c1 --- /dev/null +++ b/tests/baselines/reference/es5-umd.symbols @@ -0,0 +1,17 @@ +=== tests/cases/compiler/es5-umd.ts === + +class A +>A : Symbol(A, Decl(es5-umd.ts, 0, 0)) +{ + constructor () + { + + } + + public B() +>B : Symbol(B, Decl(es5-umd.ts, 6, 5)) + { + return 42; + } +} + diff --git a/tests/baselines/reference/es5-umd.types b/tests/baselines/reference/es5-umd.types new file mode 100644 index 00000000000..f0e513e8b88 --- /dev/null +++ b/tests/baselines/reference/es5-umd.types @@ -0,0 +1,18 @@ +=== tests/cases/compiler/es5-umd.ts === + +class A +>A : A +{ + constructor () + { + + } + + public B() +>B : () => number + { + return 42; +>42 : number + } +} + diff --git a/tests/baselines/reference/umdDependencyComment2.errors.txt b/tests/baselines/reference/umdDependencyComment2.errors.txt new file mode 100644 index 00000000000..1e85844af64 --- /dev/null +++ b/tests/baselines/reference/umdDependencyComment2.errors.txt @@ -0,0 +1,11 @@ +tests/cases/compiler/umdDependencyComment2.ts(3,21): error TS2307: Cannot find external module 'm2'. + + +==== tests/cases/compiler/umdDependencyComment2.ts (1 errors) ==== + /// + + import m1 = require("m2") + ~~~~ +!!! error TS2307: Cannot find external module 'm2'. + m1.f(); + \ No newline at end of file diff --git a/tests/baselines/reference/umdDependencyComment2.js b/tests/baselines/reference/umdDependencyComment2.js new file mode 100644 index 00000000000..462dad2daca --- /dev/null +++ b/tests/baselines/reference/umdDependencyComment2.js @@ -0,0 +1,20 @@ +//// [umdDependencyComment2.ts] +/// + +import m1 = require("m2") +m1.f(); + + +//// [umdDependencyComment2.js] +/// +(function (deps, factory) { + if (typeof module === 'object' && typeof module.exports === 'object') { + var v = factory(require, exports); if (v !== undefined) module.exports = v; + } + else if (typeof define === 'function' && define.amd) { + define(deps, factory); + } +})(["require", "exports", "bar", "m2"], function (require, exports) { + var m1 = require("m2"); + m1.f(); +}); diff --git a/tests/baselines/reference/umdDependencyCommentName1.errors.txt b/tests/baselines/reference/umdDependencyCommentName1.errors.txt new file mode 100644 index 00000000000..080ae2d852a --- /dev/null +++ b/tests/baselines/reference/umdDependencyCommentName1.errors.txt @@ -0,0 +1,11 @@ +tests/cases/compiler/umdDependencyCommentName1.ts(3,21): error TS2307: Cannot find external module 'm2'. + + +==== tests/cases/compiler/umdDependencyCommentName1.ts (1 errors) ==== + /// + + import m1 = require("m2") + ~~~~ +!!! error TS2307: Cannot find external module 'm2'. + m1.f(); + \ No newline at end of file diff --git a/tests/baselines/reference/umdDependencyCommentName1.js b/tests/baselines/reference/umdDependencyCommentName1.js new file mode 100644 index 00000000000..20ef7c1326f --- /dev/null +++ b/tests/baselines/reference/umdDependencyCommentName1.js @@ -0,0 +1,20 @@ +//// [umdDependencyCommentName1.ts] +/// + +import m1 = require("m2") +m1.f(); + + +//// [umdDependencyCommentName1.js] +/// +(function (deps, factory) { + if (typeof module === 'object' && typeof module.exports === 'object') { + var v = factory(require, exports); if (v !== undefined) module.exports = v; + } + else if (typeof define === 'function' && define.amd) { + define(deps, factory); + } +})(["require", "exports", "bar", "m2"], function (require, exports, b) { + var m1 = require("m2"); + m1.f(); +}); diff --git a/tests/baselines/reference/umdDependencyCommentName2.errors.txt b/tests/baselines/reference/umdDependencyCommentName2.errors.txt new file mode 100644 index 00000000000..903ca4ecfaf --- /dev/null +++ b/tests/baselines/reference/umdDependencyCommentName2.errors.txt @@ -0,0 +1,13 @@ +tests/cases/compiler/umdDependencyCommentName2.ts(5,21): error TS2307: Cannot find external module 'm2'. + + +==== tests/cases/compiler/umdDependencyCommentName2.ts (1 errors) ==== + /// + /// + /// + + import m1 = require("m2") + ~~~~ +!!! error TS2307: Cannot find external module 'm2'. + m1.f(); + \ No newline at end of file diff --git a/tests/baselines/reference/umdDependencyCommentName2.js b/tests/baselines/reference/umdDependencyCommentName2.js new file mode 100644 index 00000000000..22a0cc709bc --- /dev/null +++ b/tests/baselines/reference/umdDependencyCommentName2.js @@ -0,0 +1,24 @@ +//// [umdDependencyCommentName2.ts] +/// +/// +/// + +import m1 = require("m2") +m1.f(); + + +//// [umdDependencyCommentName2.js] +/// +/// +/// +(function (deps, factory) { + if (typeof module === 'object' && typeof module.exports === 'object') { + var v = factory(require, exports); if (v !== undefined) module.exports = v; + } + else if (typeof define === 'function' && define.amd) { + define(deps, factory); + } +})(["require", "exports", "bar", "goo", "foo", "m2"], function (require, exports, b, c) { + var m1 = require("m2"); + m1.f(); +}); diff --git a/tests/cases/compiler/es5-umd.ts b/tests/cases/compiler/es5-umd.ts new file mode 100644 index 00000000000..d0f65f76982 --- /dev/null +++ b/tests/cases/compiler/es5-umd.ts @@ -0,0 +1,17 @@ +// @target: ES5 +// @sourcemap: false +// @declaration: false +// @module: umd + +class A +{ + constructor () + { + + } + + public B() + { + return 42; + } +} diff --git a/tests/cases/compiler/umdDependencyComment2.ts b/tests/cases/compiler/umdDependencyComment2.ts new file mode 100644 index 00000000000..87e4fd48526 --- /dev/null +++ b/tests/cases/compiler/umdDependencyComment2.ts @@ -0,0 +1,5 @@ +//@module: umd +/// + +import m1 = require("m2") +m1.f(); diff --git a/tests/cases/compiler/umdDependencyCommentName1.ts b/tests/cases/compiler/umdDependencyCommentName1.ts new file mode 100644 index 00000000000..90b852c9bfd --- /dev/null +++ b/tests/cases/compiler/umdDependencyCommentName1.ts @@ -0,0 +1,5 @@ +//@module: umd +/// + +import m1 = require("m2") +m1.f(); diff --git a/tests/cases/compiler/umdDependencyCommentName2.ts b/tests/cases/compiler/umdDependencyCommentName2.ts new file mode 100644 index 00000000000..bbdd847b84b --- /dev/null +++ b/tests/cases/compiler/umdDependencyCommentName2.ts @@ -0,0 +1,7 @@ +//@module: umd +/// +/// +/// + +import m1 = require("m2") +m1.f(); From 4dc9da255fa9f55c9e9de8ef29f69c9f9b48bc77 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Wed, 22 Apr 2015 13:23:52 -0700 Subject: [PATCH 24/45] Fix Iterator type in es6.d.ts --- src/lib/es6.d.ts | 4 ++-- tests/baselines/reference/for-of30.errors.txt | 4 ++-- tests/baselines/reference/for-of31.errors.txt | 4 ++-- tests/baselines/reference/iteratorSpreadInArray9.errors.txt | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/lib/es6.d.ts b/src/lib/es6.d.ts index b81a3341a6c..888ded962ef 100644 --- a/src/lib/es6.d.ts +++ b/src/lib/es6.d.ts @@ -442,8 +442,8 @@ interface IteratorResult { } interface Iterator { - next(): IteratorResult; - return?(value?: any): IteratorResult; + next(value?: any): IteratorResult; + return?(value?: T): IteratorResult; throw?(e?: any): IteratorResult; } diff --git a/tests/baselines/reference/for-of30.errors.txt b/tests/baselines/reference/for-of30.errors.txt index 6434b5294d5..bc93a031bf5 100644 --- a/tests/baselines/reference/for-of30.errors.txt +++ b/tests/baselines/reference/for-of30.errors.txt @@ -3,7 +3,7 @@ tests/cases/conformance/es6/for-ofStatements/for-of30.ts(1,15): error TS2322: Ty Type '() => StringIterator' is not assignable to type '() => Iterator'. Type 'StringIterator' is not assignable to type 'Iterator'. Types of property 'return' are incompatible. - Type 'number' is not assignable to type '(value?: any) => IteratorResult'. + Type 'number' is not assignable to type '(value?: string) => IteratorResult'. ==== tests/cases/conformance/es6/for-ofStatements/for-of30.ts (1 errors) ==== @@ -14,7 +14,7 @@ tests/cases/conformance/es6/for-ofStatements/for-of30.ts(1,15): error TS2322: Ty !!! error TS2322: Type '() => StringIterator' is not assignable to type '() => Iterator'. !!! error TS2322: Type 'StringIterator' is not assignable to type 'Iterator'. !!! error TS2322: Types of property 'return' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type '(value?: any) => IteratorResult'. +!!! error TS2322: Type 'number' is not assignable to type '(value?: string) => IteratorResult'. class StringIterator { next() { diff --git a/tests/baselines/reference/for-of31.errors.txt b/tests/baselines/reference/for-of31.errors.txt index 74afff00e99..6d5f6e816be 100644 --- a/tests/baselines/reference/for-of31.errors.txt +++ b/tests/baselines/reference/for-of31.errors.txt @@ -3,7 +3,7 @@ tests/cases/conformance/es6/for-ofStatements/for-of31.ts(1,15): error TS2322: Ty Type '() => StringIterator' is not assignable to type '() => Iterator'. Type 'StringIterator' is not assignable to type 'Iterator'. Types of property 'next' are incompatible. - Type '() => { value: string; }' is not assignable to type '() => IteratorResult'. + Type '() => { value: string; }' is not assignable to type '(value?: any) => IteratorResult'. Type '{ value: string; }' is not assignable to type 'IteratorResult'. Property 'done' is missing in type '{ value: string; }'. @@ -16,7 +16,7 @@ tests/cases/conformance/es6/for-ofStatements/for-of31.ts(1,15): error TS2322: Ty !!! error TS2322: Type '() => StringIterator' is not assignable to type '() => Iterator'. !!! error TS2322: Type 'StringIterator' is not assignable to type 'Iterator'. !!! error TS2322: Types of property 'next' are incompatible. -!!! error TS2322: Type '() => { value: string; }' is not assignable to type '() => IteratorResult'. +!!! error TS2322: Type '() => { value: string; }' is not assignable to type '(value?: any) => IteratorResult'. !!! error TS2322: Type '{ value: string; }' is not assignable to type 'IteratorResult'. !!! error TS2322: Property 'done' is missing in type '{ value: string; }'. diff --git a/tests/baselines/reference/iteratorSpreadInArray9.errors.txt b/tests/baselines/reference/iteratorSpreadInArray9.errors.txt index e0e3d061f16..90b8bdbeb46 100644 --- a/tests/baselines/reference/iteratorSpreadInArray9.errors.txt +++ b/tests/baselines/reference/iteratorSpreadInArray9.errors.txt @@ -3,7 +3,7 @@ tests/cases/conformance/es6/spread/iteratorSpreadInArray9.ts(1,17): error TS2322 Type '() => SymbolIterator' is not assignable to type '() => Iterator'. Type 'SymbolIterator' is not assignable to type 'Iterator'. Types of property 'next' are incompatible. - Type '() => { value: symbol; }' is not assignable to type '() => IteratorResult'. + Type '() => { value: symbol; }' is not assignable to type '(value?: any) => IteratorResult'. Type '{ value: symbol; }' is not assignable to type 'IteratorResult'. Property 'done' is missing in type '{ value: symbol; }'. @@ -16,7 +16,7 @@ tests/cases/conformance/es6/spread/iteratorSpreadInArray9.ts(1,17): error TS2322 !!! error TS2322: Type '() => SymbolIterator' is not assignable to type '() => Iterator'. !!! error TS2322: Type 'SymbolIterator' is not assignable to type 'Iterator'. !!! error TS2322: Types of property 'next' are incompatible. -!!! error TS2322: Type '() => { value: symbol; }' is not assignable to type '() => IteratorResult'. +!!! error TS2322: Type '() => { value: symbol; }' is not assignable to type '(value?: any) => IteratorResult'. !!! error TS2322: Type '{ value: symbol; }' is not assignable to type 'IteratorResult'. !!! error TS2322: Property 'done' is missing in type '{ value: symbol; }'. From 4487fa426b4aca9ebd7bc4b293d4173d9b0491e6 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Wed, 22 Apr 2015 13:29:50 -0700 Subject: [PATCH 25/45] Rename iterator property of ForStatement to incrementor --- src/compiler/checker.ts | 2 +- src/compiler/emitter.ts | 2 +- src/compiler/parser.ts | 4 ++-- src/compiler/types.ts | 2 +- src/compiler/utilities.ts | 2 +- src/services/breakpoints.ts | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index d5e5b5c67e4..268db63ebb0 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -9367,7 +9367,7 @@ module ts { } if (node.condition) checkExpression(node.condition); - if (node.iterator) checkExpression(node.iterator); + if (node.incrementor) checkExpression(node.incrementor); checkSourceElement(node.statement); } diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index f4aa0fe1022..bb65078009f 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -2138,7 +2138,7 @@ var __param = this.__param || function(index, decorator) { return function (targ write(";"); emitOptional(" ", node.condition); write(";"); - emitOptional(" ", node.iterator); + emitOptional(" ", node.incrementor); write(")"); emitEmbeddedStatement(node.statement); } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 6ad38ac73c1..1a06a2743ba 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -194,7 +194,7 @@ module ts { case SyntaxKind.ForStatement: return visitNode(cbNode, (node).initializer) || visitNode(cbNode, (node).condition) || - visitNode(cbNode, (node).iterator) || + visitNode(cbNode, (node).incrementor) || visitNode(cbNode, (node).statement); case SyntaxKind.ForInStatement: return visitNode(cbNode, (node).initializer) || @@ -3497,7 +3497,7 @@ module ts { } parseExpected(SyntaxKind.SemicolonToken); if (token !== SyntaxKind.CloseParenToken) { - forStatement.iterator = allowInAnd(parseExpression); + forStatement.incrementor = allowInAnd(parseExpression); } parseExpected(SyntaxKind.CloseParenToken); forOrForInOrForOfStatement = forStatement; diff --git a/src/compiler/types.ts b/src/compiler/types.ts index bff15a1ab9d..66a5d7ed030 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -795,7 +795,7 @@ module ts { export interface ForStatement extends IterationStatement { initializer?: VariableDeclarationList | Expression; condition?: Expression; - iterator?: Expression; + incrementor?: Expression; } export interface ForInStatement extends IterationStatement { diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index b1aa59be323..eabfb7e256a 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -775,7 +775,7 @@ module ts { let forStatement = parent; return (forStatement.initializer === node && forStatement.initializer.kind !== SyntaxKind.VariableDeclarationList) || forStatement.condition === node || - forStatement.iterator === node; + forStatement.incrementor === node; case SyntaxKind.ForInStatement: case SyntaxKind.ForOfStatement: let forInStatement = parent; diff --git a/src/services/breakpoints.ts b/src/services/breakpoints.ts index caed0582c33..19235269f22 100644 --- a/src/services/breakpoints.ts +++ b/src/services/breakpoints.ts @@ -401,8 +401,8 @@ module ts.BreakpointResolver { if (forStatement.condition) { return textSpan(forStatement.condition); } - if (forStatement.iterator) { - return textSpan(forStatement.iterator); + if (forStatement.incrementor) { + return textSpan(forStatement.incrementor); } } From 2a2ef28fc6aeca3f0957fd900eb426cd7050ca8f Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Wed, 22 Apr 2015 13:38:30 -0700 Subject: [PATCH 26/45] Undo the change to return --- src/lib/es6.d.ts | 2 +- tests/baselines/reference/for-of30.errors.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/es6.d.ts b/src/lib/es6.d.ts index 888ded962ef..71778ecf907 100644 --- a/src/lib/es6.d.ts +++ b/src/lib/es6.d.ts @@ -443,7 +443,7 @@ interface IteratorResult { interface Iterator { next(value?: any): IteratorResult; - return?(value?: T): IteratorResult; + return?(value?: any): IteratorResult; throw?(e?: any): IteratorResult; } diff --git a/tests/baselines/reference/for-of30.errors.txt b/tests/baselines/reference/for-of30.errors.txt index bc93a031bf5..6434b5294d5 100644 --- a/tests/baselines/reference/for-of30.errors.txt +++ b/tests/baselines/reference/for-of30.errors.txt @@ -3,7 +3,7 @@ tests/cases/conformance/es6/for-ofStatements/for-of30.ts(1,15): error TS2322: Ty Type '() => StringIterator' is not assignable to type '() => Iterator'. Type 'StringIterator' is not assignable to type 'Iterator'. Types of property 'return' are incompatible. - Type 'number' is not assignable to type '(value?: string) => IteratorResult'. + Type 'number' is not assignable to type '(value?: any) => IteratorResult'. ==== tests/cases/conformance/es6/for-ofStatements/for-of30.ts (1 errors) ==== @@ -14,7 +14,7 @@ tests/cases/conformance/es6/for-ofStatements/for-of30.ts(1,15): error TS2322: Ty !!! error TS2322: Type '() => StringIterator' is not assignable to type '() => Iterator'. !!! error TS2322: Type 'StringIterator' is not assignable to type 'Iterator'. !!! error TS2322: Types of property 'return' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type '(value?: string) => IteratorResult'. +!!! error TS2322: Type 'number' is not assignable to type '(value?: any) => IteratorResult'. class StringIterator { next() { From b1472d99f2c898105fcfee6164097d27aae45972 Mon Sep 17 00:00:00 2001 From: Paul van Brenk Date: Wed, 22 Apr 2015 14:27:05 -0700 Subject: [PATCH 27/45] Add error handling. --- src/services/shims.ts | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/services/shims.ts b/src/services/shims.ts index a8de3b817c4..99df0e093a4 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -802,17 +802,27 @@ module ts { return this.forwardJSONCall( "getTSConfigFileInfo('" + fileName + "')", () => { - var text = sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength()); - var json = /\S/.test(text) ? JSON.parse(text) : {}; + let text = sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength()); - var configFile = parseConfigFile(json, this.host, getDirectoryPath(normalizeSlashes(fileName))); + try { + var json = /\S/.test(text) ? JSON.parse(text) : {}; + } + catch (e) { + return { + options: {}, + files: [], + errors: realizeDiagnostic(createCompilerDiagnostic(Diagnostics.Unable_to_open_file_0, fileName), '\r\n') + } + } - var realErrors = realizeDiagnostics(configFile.errors, '\r\n'); + if (json) { + var configFile = parseConfigFile(json, this.host, getDirectoryPath(normalizeSlashes(fileName))); + } return { options: configFile.options, files: configFile.fileNames, - errors: realErrors + errors: realizeDiagnostics(configFile.errors, '\r\n') }; }); } From 5c44a0ff3e93628a4cf59509c103dc827504d317 Mon Sep 17 00:00:00 2001 From: Paul van Brenk Date: Wed, 22 Apr 2015 15:58:04 -0700 Subject: [PATCH 28/45] Improve error message when encountering an invalid tsconfig.json file. --- src/compiler/commandLineParser.ts | 2 +- src/compiler/diagnosticInformationMap.generated.ts | 1 + src/compiler/diagnosticMessages.json | 4 ++++ src/compiler/tsc.ts | 9 ++++++--- src/services/shims.ts | 2 +- 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 3645695ca76..a83e742a122 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -299,7 +299,7 @@ module ts { * @param basePath A root directory to resolve relative path entries in the config * file to. e.g. outDir */ - export function parseConfigFile(json: any, host: ParseConfigHost, basePath?: string): ParsedCommandLine { + export function parseConfigFile(json: any, host: ParseConfigHost, basePath: string): ParsedCommandLine { var errors: Diagnostic[] = []; return { diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 90f0ed0a0df..df7928d5717 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -439,6 +439,7 @@ module ts { Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: DiagnosticCategory.Error, key: "Cannot find the common subdirectory path for the input files." }, Cannot_read_file_0_Colon_1: { code: 5012, category: DiagnosticCategory.Error, key: "Cannot read file '{0}': {1}" }, Unsupported_file_encoding: { code: 5013, category: DiagnosticCategory.Error, key: "Unsupported file encoding." }, + Failed_to_parse_file_0_Colon_1: { code: 5014, category: DiagnosticCategory.Error, key: "Failed to parse file '{0}': {1}." }, Unknown_compiler_option_0: { code: 5023, category: DiagnosticCategory.Error, key: "Unknown compiler option '{0}'." }, Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: DiagnosticCategory.Error, key: "Compiler option '{0}' requires a value of type {1}." }, Could_not_write_file_0_Colon_1: { code: 5033, category: DiagnosticCategory.Error, key: "Could not write file '{0}': {1}" }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 48ef245c766..afd21593f81 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1744,6 +1744,10 @@ "category": "Error", "code": 5013 }, + "Failed to parse file '{0}': {1}.": { + "category": "Error", + "code": 5014 + }, "Unknown compiler option '{0}'.": { "category": "Error", "code": 5023 diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index 7eb86efbfae..89464e6b6e4 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -208,9 +208,12 @@ module ts { if (!cachedProgram) { if (configFileName) { - var configObject = readConfigFile(configFileName); - if (!configObject) { - reportDiagnostic(createCompilerDiagnostic(Diagnostics.Unable_to_open_file_0, configFileName)); + try { + var configObject = readConfigFile(configFileName); + } + catch (e) + { + reportDiagnostic(createCompilerDiagnostic(Diagnostics.Failed_to_parse_file_0_Colon_1, configFileName, e.message)); return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); } var configParseResult = parseConfigFile(configObject, sys, getDirectoryPath(configFileName)); diff --git a/src/services/shims.ts b/src/services/shims.ts index 99df0e093a4..6caec3cd23f 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -811,7 +811,7 @@ module ts { return { options: {}, files: [], - errors: realizeDiagnostic(createCompilerDiagnostic(Diagnostics.Unable_to_open_file_0, fileName), '\r\n') + errors: realizeDiagnostic(createCompilerDiagnostic(Diagnostics.Failed_to_parse_file_0_Colon_1, fileName, e.message), '\r\n') } } From f8424d0b0c91a487a2c8cc226c89ffb359816b7b Mon Sep 17 00:00:00 2001 From: Paul van Brenk Date: Wed, 22 Apr 2015 18:00:09 -0700 Subject: [PATCH 29/45] Minor clean up to make it more readable. --- src/compiler/commandLineParser.ts | 5 +++-- src/compiler/tsc.ts | 16 ++++++++-------- src/services/shims.ts | 24 +++++++++++++++--------- 3 files changed, 26 insertions(+), 19 deletions(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index a83e742a122..b477c97fec8 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -284,12 +284,13 @@ module ts { * Read tsconfig.json file * @param fileName The path to the config file */ - export function readConfigFile(fileName: string): any { + export function readConfigFile(fileName: string): { config?: any; error?: Diagnostic } { try { var text = sys.readFile(fileName); - return /\S/.test(text) ? JSON.parse(text) : {}; + return { config: /\S/.test(text) ? JSON.parse(text) : {} }; } catch (e) { + return { error: createCompilerDiagnostic(Diagnostics.Failed_to_parse_file_0_Colon_1, fileName, e.message) }; } } diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index 89464e6b6e4..15cc665e351 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -208,15 +208,15 @@ module ts { if (!cachedProgram) { if (configFileName) { - try { - var configObject = readConfigFile(configFileName); - } - catch (e) - { - reportDiagnostic(createCompilerDiagnostic(Diagnostics.Failed_to_parse_file_0_Colon_1, configFileName, e.message)); + + let result = readConfigFile(configFileName); + if (result.error) { + reportDiagnostic(result.error); return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); } - var configParseResult = parseConfigFile(configObject, sys, getDirectoryPath(configFileName)); + + let configObject = result.config; + let configParseResult = parseConfigFile(configObject, sys, getDirectoryPath(configFileName)); if (configParseResult.errors.length > 0) { reportDiagnostics(configParseResult.errors); return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); @@ -233,7 +233,7 @@ module ts { compilerHost.getSourceFile = getSourceFile; } - var compileResult = compile(rootFileNames, compilerOptions, compilerHost); + let compileResult = compile(rootFileNames, compilerOptions, compilerHost); if (!compilerOptions.watch) { return sys.exit(compileResult.exitStatus); diff --git a/src/services/shims.ts b/src/services/shims.ts index 6caec3cd23f..ddcc32b8640 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -804,20 +804,17 @@ module ts { () => { let text = sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength()); - try { - var json = /\S/.test(text) ? JSON.parse(text) : {}; - } - catch (e) { + let result = this.parseConfigFileText(fileName, text); + + if (result.error) { return { options: {}, files: [], - errors: realizeDiagnostic(createCompilerDiagnostic(Diagnostics.Failed_to_parse_file_0_Colon_1, fileName, e.message), '\r\n') - } + errors: [realizeDiagnostic(result.error, '/r/n')] + }; } - if (json) { - var configFile = parseConfigFile(json, this.host, getDirectoryPath(normalizeSlashes(fileName))); - } + var configFile = parseConfigFile(result.config, this.host, getDirectoryPath(normalizeSlashes(fileName))); return { options: configFile.options, @@ -827,6 +824,15 @@ module ts { }); } + private parseConfigFileText(fileName: string, jsonText: string): { config?: any; error?: Diagnostic } { + try { + return { config: /\S/.test(jsonText) ? JSON.parse(jsonText) : {} }; + } + catch (e) { + return { error: createCompilerDiagnostic(Diagnostics.Failed_to_parse_file_0_Colon_1, fileName, e.message) }; + } + } + public getDefaultCompilationSettings(): string { return this.forwardJSONCall( "getDefaultCompilationSettings()", From 8955d7ba572803cbb9f4353f1cc641bdf6f52bf1 Mon Sep 17 00:00:00 2001 From: Paul van Brenk Date: Wed, 22 Apr 2015 18:09:55 -0700 Subject: [PATCH 30/45] More refactoring --- src/compiler/commandLineParser.ts | 18 ++++++++++++++++-- src/services/shims.ts | 11 +---------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index b477c97fec8..a4b25b08d23 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -284,10 +284,24 @@ module ts { * Read tsconfig.json file * @param fileName The path to the config file */ - export function readConfigFile(fileName: string): { config?: any; error?: Diagnostic } { + export function readConfigFile(fileName: string): { config?: any; error?: Diagnostic } { try { var text = sys.readFile(fileName); - return { config: /\S/.test(text) ? JSON.parse(text) : {} }; + return parseConfigFileText(fileName, text); + } + catch (e) { + return { error: createCompilerDiagnostic(Diagnostics.Cannot_read_file_0_Colon_1, fileName, e.message) }; + } + } + + /** + * Parse the text of the tsconfig.json file + * @param fileName The path to the config file + * @param jsonText The text of the config file + */ + export function parseConfigFileText(fileName: string, jsonText: string): { config?: any; error?: Diagnostic } { + try { + return { config: /\S/.test(jsonText) ? JSON.parse(jsonText) : {} }; } catch (e) { return { error: createCompilerDiagnostic(Diagnostics.Failed_to_parse_file_0_Colon_1, fileName, e.message) }; diff --git a/src/services/shims.ts b/src/services/shims.ts index ddcc32b8640..5c08e503b1c 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -804,7 +804,7 @@ module ts { () => { let text = sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength()); - let result = this.parseConfigFileText(fileName, text); + let result = parseConfigFileText(fileName, text); if (result.error) { return { @@ -824,15 +824,6 @@ module ts { }); } - private parseConfigFileText(fileName: string, jsonText: string): { config?: any; error?: Diagnostic } { - try { - return { config: /\S/.test(jsonText) ? JSON.parse(jsonText) : {} }; - } - catch (e) { - return { error: createCompilerDiagnostic(Diagnostics.Failed_to_parse_file_0_Colon_1, fileName, e.message) }; - } - } - public getDefaultCompilationSettings(): string { return this.forwardJSONCall( "getDefaultCompilationSettings()", From 05b95c30ff4142ae0dec915ebb5938d7518c8cd5 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Wed, 22 Apr 2015 21:46:10 -0700 Subject: [PATCH 31/45] fixed formatting for equals token in type aliases --- src/services/formatting/rules.ts | 8 +++++--- .../fourslash/formattingEqualsBeforeBracketInTypeAlias.ts | 6 ++++++ 2 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 tests/cases/fourslash/formattingEqualsBeforeBracketInTypeAlias.ts diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index 73b586e3706..23c835eaec2 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -458,7 +458,11 @@ module ts.formatting { case SyntaxKind.BinaryExpression: case SyntaxKind.ConditionalExpression: return true; - + + // equals in binding elements: function foo([[x, y] = [1, 2]]) + case SyntaxKind.BindingElement: + // equals in type X = ... + case SyntaxKind.TypeAliasDeclaration: // equal in import a = module('a'); case SyntaxKind.ImportEqualsDeclaration: // equal in let a = 0; @@ -475,8 +479,6 @@ module ts.formatting { // Technically, "of" is not a binary operator, but format it the same way as "in" case SyntaxKind.ForOfStatement: return context.currentTokenSpan.kind === SyntaxKind.OfKeyword || context.nextTokenSpan.kind === SyntaxKind.OfKeyword; - case SyntaxKind.BindingElement: - return context.currentTokenSpan.kind === SyntaxKind.EqualsToken || context.nextTokenSpan.kind === SyntaxKind.EqualsToken; } return false; } diff --git a/tests/cases/fourslash/formattingEqualsBeforeBracketInTypeAlias.ts b/tests/cases/fourslash/formattingEqualsBeforeBracketInTypeAlias.ts new file mode 100644 index 00000000000..043ff2247a9 --- /dev/null +++ b/tests/cases/fourslash/formattingEqualsBeforeBracketInTypeAlias.ts @@ -0,0 +1,6 @@ +/// + +////type X = [number]/*1*/ +goTo.marker("1"); +edit.insert(";"); +verify.currentLineContentIs("type X = [number];"); \ No newline at end of file From f96dbd151c70fd8decdd0899724c9fe2638c1f84 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Thu, 23 Apr 2015 09:37:20 -0700 Subject: [PATCH 32/45] Fix #2837: remove (y, x) from the comment --- src/lib/core.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/core.d.ts b/src/lib/core.d.ts index 822b7ca5202..c03ab344ab2 100644 --- a/src/lib/core.d.ts +++ b/src/lib/core.d.ts @@ -546,7 +546,7 @@ interface Math { */ atan(x: number): number; /** - * Returns the angle (in radians) from the X axis to a point (y,x). + * Returns the angle (in radians) from the X axis to a point. * @param y A numeric expression representing the cartesian y-coordinate. * @param x A numeric expression representing the cartesian x-coordinate. */ From b6477607acd3e89383a468685ec6e5b2fca3987b Mon Sep 17 00:00:00 2001 From: Paul van Brenk Date: Thu, 23 Apr 2015 10:17:57 -0700 Subject: [PATCH 33/45] correct the slashes for a new line. --- src/services/shims.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/shims.ts b/src/services/shims.ts index 5c08e503b1c..993627619cb 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -810,7 +810,7 @@ module ts { return { options: {}, files: [], - errors: [realizeDiagnostic(result.error, '/r/n')] + errors: [realizeDiagnostic(result.error, '\r\n')] }; } From 5172c172b7553f55ca3c8c5c65849c8fd42b0d5a Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Thu, 23 Apr 2015 10:44:44 -0700 Subject: [PATCH 34/45] Add more tests --- tests/baselines/reference/es5-umd.js | 38 ++-- tests/baselines/reference/es5-umd.js.map | 2 +- .../baselines/reference/es5-umd.sourcemap.txt | 182 +++++++++--------- tests/baselines/reference/es5-umd.symbols | 34 ++-- tests/baselines/reference/es5-umd.types | 36 ++-- tests/baselines/reference/es5-umd2.js | 42 ++++ tests/baselines/reference/es5-umd2.js.map | 2 + .../reference/es5-umd2.sourcemap.txt | 149 ++++++++++++++ tests/baselines/reference/es5-umd2.symbols | 17 ++ tests/baselines/reference/es5-umd2.types | 18 ++ tests/baselines/reference/es5-umd3.js | 42 ++++ tests/baselines/reference/es5-umd3.js.map | 2 + .../reference/es5-umd3.sourcemap.txt | 146 ++++++++++++++ tests/baselines/reference/es5-umd3.symbols | 17 ++ tests/baselines/reference/es5-umd3.types | 18 ++ tests/baselines/reference/es5-umd4.js | 45 +++++ tests/baselines/reference/es5-umd4.js.map | 2 + .../reference/es5-umd4.sourcemap.txt | 143 ++++++++++++++ tests/baselines/reference/es5-umd4.symbols | 20 ++ tests/baselines/reference/es5-umd4.types | 21 ++ tests/baselines/reference/es6-umd.errors.txt | 18 ++ tests/baselines/reference/es6-umd.js | 30 +++ tests/baselines/reference/es6-umd.js.map | 2 + .../baselines/reference/es6-umd.sourcemap.txt | 91 +++++++++ tests/baselines/reference/es6-umd2.errors.txt | 18 ++ tests/baselines/reference/es6-umd2.js | 30 +++ tests/baselines/reference/es6-umd2.js.map | 2 + .../reference/es6-umd2.sourcemap.txt | 91 +++++++++ .../umdDependencyComment2.errors.txt | 20 +- .../reference/umdDependencyComment2.js | 32 +-- .../umdDependencyCommentName1.errors.txt | 20 +- .../reference/umdDependencyCommentName1.js | 32 +-- .../umdDependencyCommentName2.errors.txt | 24 +-- .../reference/umdDependencyCommentName2.js | 36 ++-- tests/cases/compiler/es5-umd2.ts | 17 ++ tests/cases/compiler/es5-umd3.ts | 17 ++ tests/cases/compiler/es5-umd4.ts | 19 ++ tests/cases/compiler/es6-umd.ts | 17 ++ tests/cases/compiler/es6-umd2.ts | 17 ++ 39 files changed, 1281 insertions(+), 228 deletions(-) create mode 100644 tests/baselines/reference/es5-umd2.js create mode 100644 tests/baselines/reference/es5-umd2.js.map create mode 100644 tests/baselines/reference/es5-umd2.sourcemap.txt create mode 100644 tests/baselines/reference/es5-umd2.symbols create mode 100644 tests/baselines/reference/es5-umd2.types create mode 100644 tests/baselines/reference/es5-umd3.js create mode 100644 tests/baselines/reference/es5-umd3.js.map create mode 100644 tests/baselines/reference/es5-umd3.sourcemap.txt create mode 100644 tests/baselines/reference/es5-umd3.symbols create mode 100644 tests/baselines/reference/es5-umd3.types create mode 100644 tests/baselines/reference/es5-umd4.js create mode 100644 tests/baselines/reference/es5-umd4.js.map create mode 100644 tests/baselines/reference/es5-umd4.sourcemap.txt create mode 100644 tests/baselines/reference/es5-umd4.symbols create mode 100644 tests/baselines/reference/es5-umd4.types create mode 100644 tests/baselines/reference/es6-umd.errors.txt create mode 100644 tests/baselines/reference/es6-umd.js create mode 100644 tests/baselines/reference/es6-umd.js.map create mode 100644 tests/baselines/reference/es6-umd.sourcemap.txt create mode 100644 tests/baselines/reference/es6-umd2.errors.txt create mode 100644 tests/baselines/reference/es6-umd2.js create mode 100644 tests/baselines/reference/es6-umd2.js.map create mode 100644 tests/baselines/reference/es6-umd2.sourcemap.txt create mode 100644 tests/cases/compiler/es5-umd2.ts create mode 100644 tests/cases/compiler/es5-umd3.ts create mode 100644 tests/cases/compiler/es5-umd4.ts create mode 100644 tests/cases/compiler/es6-umd.ts create mode 100644 tests/cases/compiler/es6-umd2.ts diff --git a/tests/baselines/reference/es5-umd.js b/tests/baselines/reference/es5-umd.js index 2fe8d686242..0175e8e9fe8 100644 --- a/tests/baselines/reference/es5-umd.js +++ b/tests/baselines/reference/es5-umd.js @@ -1,4 +1,4 @@ -//// [es5-umd.ts] +//// [es5-umd.ts] class A { @@ -12,21 +12,21 @@ class A return 42; } } - - -//// [es5-umd.js] -var A = (function () { - function A() { - } - A.prototype.B = function () { - return 42; - }; - return A; -})(); -//# sourceMappingURL=es5-umd.js.map - -//// [es5-umd.d.ts] -declare class A { - constructor(); - B(): number; -} + + +//// [es5-umd.js] +var A = (function () { + function A() { + } + A.prototype.B = function () { + return 42; + }; + return A; +})(); +//# sourceMappingURL=es5-umd.js.map + +//// [es5-umd.d.ts] +declare class A { + constructor(); + B(): number; +} diff --git a/tests/baselines/reference/es5-umd.js.map b/tests/baselines/reference/es5-umd.js.map index 785990dc2cb..5e29a48796e 100644 --- a/tests/baselines/reference/es5-umd.js.map +++ b/tests/baselines/reference/es5-umd.js.map @@ -1,2 +1,2 @@ -//// [es5-umd.js.map] +//// [es5-umd.js.map] {"version":3,"file":"es5-umd.js","sourceRoot":"","sources":["es5-umd.ts"],"names":["A","A.constructor","A.B"],"mappings":"AACA;IAEIA;IAGAC,CAACA;IAEMD,aAACA,GAARA;QAEIE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;IACLF,QAACA;AAADA,CAACA,AAXD,IAWC"} \ No newline at end of file diff --git a/tests/baselines/reference/es5-umd.sourcemap.txt b/tests/baselines/reference/es5-umd.sourcemap.txt index 55413ee1eb2..bdbdec5fa9e 100644 --- a/tests/baselines/reference/es5-umd.sourcemap.txt +++ b/tests/baselines/reference/es5-umd.sourcemap.txt @@ -1,100 +1,100 @@ -=================================================================== -JsFile: es5-umd.js -mapUrl: es5-umd.js.map -sourceRoot: -sources: es5-umd.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:tests/cases/compiler/es5-umd.js -sourceFile:es5-umd.ts -------------------------------------------------------------------- ->>>var A = (function () { +=================================================================== +JsFile: es5-umd.js +mapUrl: es5-umd.js.map +sourceRoot: +sources: es5-umd.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/es5-umd.js +sourceFile:es5-umd.ts +------------------------------------------------------------------- +>>>var A = (function () { +1 > +2 >^^^^^^^^^^^^^^^^^^^-> 1 > -2 >^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function A() { -1->^^^^ -2 > ^^-> + > +1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) +--- +>>> function A() { +1->^^^^ +2 > ^^-> 1->class A >{ - > -1->Emitted(2, 5) Source(4, 5) + SourceIndex(0) name (A) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> + > +1->Emitted(2, 5) Source(4, 5) + SourceIndex(0) name (A) +--- +>>> } +1->^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1->constructor () > { > - > -2 > } -1->Emitted(3, 5) Source(7, 5) + SourceIndex(0) name (A.constructor) -2 >Emitted(3, 6) Source(7, 6) + SourceIndex(0) name (A.constructor) ---- ->>> A.prototype.B = function () { -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ + > +2 > } +1->Emitted(3, 5) Source(7, 5) + SourceIndex(0) name (A.constructor) +2 >Emitted(3, 6) Source(7, 6) + SourceIndex(0) name (A.constructor) +--- +>>> A.prototype.B = function () { +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ 1-> > - > public -2 > B -3 > -1->Emitted(4, 5) Source(9, 12) + SourceIndex(0) name (A) -2 >Emitted(4, 18) Source(9, 13) + SourceIndex(0) name (A) -3 >Emitted(4, 21) Source(9, 5) + SourceIndex(0) name (A) ---- ->>> return 42; -1 >^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^ -5 > ^ + > public +2 > B +3 > +1->Emitted(4, 5) Source(9, 12) + SourceIndex(0) name (A) +2 >Emitted(4, 18) Source(9, 13) + SourceIndex(0) name (A) +3 >Emitted(4, 21) Source(9, 5) + SourceIndex(0) name (A) +--- +>>> return 42; +1 >^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^ +5 > ^ 1 >public B() > { - > -2 > return -3 > -4 > 42 -5 > ; -1 >Emitted(5, 9) Source(11, 9) + SourceIndex(0) name (A.B) -2 >Emitted(5, 15) Source(11, 15) + SourceIndex(0) name (A.B) -3 >Emitted(5, 16) Source(11, 16) + SourceIndex(0) name (A.B) -4 >Emitted(5, 18) Source(11, 18) + SourceIndex(0) name (A.B) -5 >Emitted(5, 19) Source(11, 19) + SourceIndex(0) name (A.B) ---- ->>> }; -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^-> + > +2 > return +3 > +4 > 42 +5 > ; +1 >Emitted(5, 9) Source(11, 9) + SourceIndex(0) name (A.B) +2 >Emitted(5, 15) Source(11, 15) + SourceIndex(0) name (A.B) +3 >Emitted(5, 16) Source(11, 16) + SourceIndex(0) name (A.B) +4 >Emitted(5, 18) Source(11, 18) + SourceIndex(0) name (A.B) +5 >Emitted(5, 19) Source(11, 19) + SourceIndex(0) name (A.B) +--- +>>> }; +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^-> 1 > - > -2 > } -1 >Emitted(6, 5) Source(12, 5) + SourceIndex(0) name (A.B) -2 >Emitted(6, 6) Source(12, 6) + SourceIndex(0) name (A.B) ---- ->>> return A; -1->^^^^ -2 > ^^^^^^^^ + > +2 > } +1 >Emitted(6, 5) Source(12, 5) + SourceIndex(0) name (A.B) +2 >Emitted(6, 6) Source(12, 6) + SourceIndex(0) name (A.B) +--- +>>> return A; +1->^^^^ +2 > ^^^^^^^^ 1-> - > -2 > } -1->Emitted(7, 5) Source(13, 1) + SourceIndex(0) name (A) -2 >Emitted(7, 13) Source(13, 2) + SourceIndex(0) name (A) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > + > +2 > } +1->Emitted(7, 5) Source(13, 1) + SourceIndex(0) name (A) +2 >Emitted(7, 13) Source(13, 2) + SourceIndex(0) name (A) +--- +>>>})(); +1 > +2 >^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >} +3 > 4 > class A > { > constructor () @@ -106,10 +106,10 @@ sourceFile:es5-umd.ts > { > return 42; > } - > } -1 >Emitted(8, 1) Source(13, 1) + SourceIndex(0) name (A) -2 >Emitted(8, 2) Source(13, 2) + SourceIndex(0) name (A) -3 >Emitted(8, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(8, 6) Source(13, 2) + SourceIndex(0) ---- + > } +1 >Emitted(8, 1) Source(13, 1) + SourceIndex(0) name (A) +2 >Emitted(8, 2) Source(13, 2) + SourceIndex(0) name (A) +3 >Emitted(8, 2) Source(2, 1) + SourceIndex(0) +4 >Emitted(8, 6) Source(13, 2) + SourceIndex(0) +--- >>>//# sourceMappingURL=es5-umd.js.map \ No newline at end of file diff --git a/tests/baselines/reference/es5-umd.symbols b/tests/baselines/reference/es5-umd.symbols index 1914a7877c1..f570afd9548 100644 --- a/tests/baselines/reference/es5-umd.symbols +++ b/tests/baselines/reference/es5-umd.symbols @@ -1,17 +1,17 @@ -=== tests/cases/compiler/es5-umd.ts === - -class A ->A : Symbol(A, Decl(es5-umd.ts, 0, 0)) -{ - constructor () - { - - } - - public B() ->B : Symbol(B, Decl(es5-umd.ts, 6, 5)) - { - return 42; - } -} - +=== tests/cases/compiler/es5-umd.ts === + +class A +>A : Symbol(A, Decl(es5-umd.ts, 0, 0)) +{ + constructor () + { + + } + + public B() +>B : Symbol(B, Decl(es5-umd.ts, 6, 5)) + { + return 42; + } +} + diff --git a/tests/baselines/reference/es5-umd.types b/tests/baselines/reference/es5-umd.types index f0e513e8b88..60987d429e0 100644 --- a/tests/baselines/reference/es5-umd.types +++ b/tests/baselines/reference/es5-umd.types @@ -1,18 +1,18 @@ -=== tests/cases/compiler/es5-umd.ts === - -class A ->A : A -{ - constructor () - { - - } - - public B() ->B : () => number - { - return 42; ->42 : number - } -} - +=== tests/cases/compiler/es5-umd.ts === + +class A +>A : A +{ + constructor () + { + + } + + public B() +>B : () => number + { + return 42; +>42 : number + } +} + diff --git a/tests/baselines/reference/es5-umd2.js b/tests/baselines/reference/es5-umd2.js new file mode 100644 index 00000000000..cb0265bf92f --- /dev/null +++ b/tests/baselines/reference/es5-umd2.js @@ -0,0 +1,42 @@ +//// [es5-umd2.ts] + +export class A +{ + constructor () + { + + } + + public B() + { + return 42; + } +} + + +//// [es5-umd2.js] +(function (deps, factory) { + if (typeof module === 'object' && typeof module.exports === 'object') { + var v = factory(require, exports); if (v !== undefined) module.exports = v; + } + else if (typeof define === 'function' && define.amd) { + define(deps, factory); + } +})(["require", "exports"], function (require, exports) { + var A = (function () { + function A() { + } + A.prototype.B = function () { + return 42; + }; + return A; + })(); + exports.A = A; +}); +//# sourceMappingURL=es5-umd2.js.map + +//// [es5-umd2.d.ts] +export declare class A { + constructor(); + B(): number; +} diff --git a/tests/baselines/reference/es5-umd2.js.map b/tests/baselines/reference/es5-umd2.js.map new file mode 100644 index 00000000000..13a785b2edc --- /dev/null +++ b/tests/baselines/reference/es5-umd2.js.map @@ -0,0 +1,2 @@ +//// [es5-umd2.js.map] +{"version":3,"file":"es5-umd2.js","sourceRoot":"","sources":["es5-umd2.ts"],"names":["A","A.constructor","A.B"],"mappings":";;;;;;;;IACA;QAEIA;QAGAC,CAACA;QAEMD,aAACA,GAARA;YAEIE,MAAMA,CAACA,EAAEA,CAACA;QACdA,CAACA;QACLF,QAACA;IAADA,CAACA,AAXD,IAWC;IAXY,SAAC,IAWb,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/es5-umd2.sourcemap.txt b/tests/baselines/reference/es5-umd2.sourcemap.txt new file mode 100644 index 00000000000..bfadd9615f3 --- /dev/null +++ b/tests/baselines/reference/es5-umd2.sourcemap.txt @@ -0,0 +1,149 @@ +=================================================================== +JsFile: es5-umd2.js +mapUrl: es5-umd2.js.map +sourceRoot: +sources: es5-umd2.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/es5-umd2.js +sourceFile:es5-umd2.ts +------------------------------------------------------------------- +>>>(function (deps, factory) { +>>> if (typeof module === 'object' && typeof module.exports === 'object') { +>>> var v = factory(require, exports); if (v !== undefined) module.exports = v; +>>> } +>>> else if (typeof define === 'function' && define.amd) { +>>> define(deps, factory); +>>> } +>>>})(["require", "exports"], function (require, exports) { +>>> var A = (function () { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(9, 5) Source(2, 1) + SourceIndex(0) +--- +>>> function A() { +1->^^^^^^^^ +2 > ^^-> +1->export class A + >{ + > +1->Emitted(10, 9) Source(4, 5) + SourceIndex(0) name (A) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1->constructor () + > { + > + > +2 > } +1->Emitted(11, 9) Source(7, 5) + SourceIndex(0) name (A.constructor) +2 >Emitted(11, 10) Source(7, 6) + SourceIndex(0) name (A.constructor) +--- +>>> A.prototype.B = function () { +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +1-> + > + > public +2 > B +3 > +1->Emitted(12, 9) Source(9, 12) + SourceIndex(0) name (A) +2 >Emitted(12, 22) Source(9, 13) + SourceIndex(0) name (A) +3 >Emitted(12, 25) Source(9, 5) + SourceIndex(0) name (A) +--- +>>> return 42; +1 >^^^^^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^ +5 > ^ +1 >public B() + > { + > +2 > return +3 > +4 > 42 +5 > ; +1 >Emitted(13, 13) Source(11, 9) + SourceIndex(0) name (A.B) +2 >Emitted(13, 19) Source(11, 15) + SourceIndex(0) name (A.B) +3 >Emitted(13, 20) Source(11, 16) + SourceIndex(0) name (A.B) +4 >Emitted(13, 22) Source(11, 18) + SourceIndex(0) name (A.B) +5 >Emitted(13, 23) Source(11, 19) + SourceIndex(0) name (A.B) +--- +>>> }; +1 >^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(14, 9) Source(12, 5) + SourceIndex(0) name (A.B) +2 >Emitted(14, 10) Source(12, 6) + SourceIndex(0) name (A.B) +--- +>>> return A; +1->^^^^^^^^ +2 > ^^^^^^^^ +1-> + > +2 > } +1->Emitted(15, 9) Source(13, 1) + SourceIndex(0) name (A) +2 >Emitted(15, 17) Source(13, 2) + SourceIndex(0) name (A) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class A + > { + > constructor () + > { + > + > } + > + > public B() + > { + > return 42; + > } + > } +1 >Emitted(16, 5) Source(13, 1) + SourceIndex(0) name (A) +2 >Emitted(16, 6) Source(13, 2) + SourceIndex(0) name (A) +3 >Emitted(16, 6) Source(2, 1) + SourceIndex(0) +4 >Emitted(16, 10) Source(13, 2) + SourceIndex(0) +--- +>>> exports.A = A; +1->^^^^ +2 > ^^^^^^^^^ +3 > ^^^^ +4 > ^ +1-> +2 > A +3 > + > { + > constructor () + > { + > + > } + > + > public B() + > { + > return 42; + > } + > } +4 > +1->Emitted(17, 5) Source(2, 14) + SourceIndex(0) +2 >Emitted(17, 14) Source(2, 15) + SourceIndex(0) +3 >Emitted(17, 18) Source(13, 2) + SourceIndex(0) +4 >Emitted(17, 19) Source(13, 2) + SourceIndex(0) +--- +>>>}); +>>>//# sourceMappingURL=es5-umd2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/es5-umd2.symbols b/tests/baselines/reference/es5-umd2.symbols new file mode 100644 index 00000000000..3b911d7e6f0 --- /dev/null +++ b/tests/baselines/reference/es5-umd2.symbols @@ -0,0 +1,17 @@ +=== tests/cases/compiler/es5-umd2.ts === + +export class A +>A : Symbol(A, Decl(es5-umd2.ts, 0, 0)) +{ + constructor () + { + + } + + public B() +>B : Symbol(B, Decl(es5-umd2.ts, 6, 5)) + { + return 42; + } +} + diff --git a/tests/baselines/reference/es5-umd2.types b/tests/baselines/reference/es5-umd2.types new file mode 100644 index 00000000000..fab4e9dfc01 --- /dev/null +++ b/tests/baselines/reference/es5-umd2.types @@ -0,0 +1,18 @@ +=== tests/cases/compiler/es5-umd2.ts === + +export class A +>A : A +{ + constructor () + { + + } + + public B() +>B : () => number + { + return 42; +>42 : number + } +} + diff --git a/tests/baselines/reference/es5-umd3.js b/tests/baselines/reference/es5-umd3.js new file mode 100644 index 00000000000..2d18e2eecc3 --- /dev/null +++ b/tests/baselines/reference/es5-umd3.js @@ -0,0 +1,42 @@ +//// [es5-umd3.ts] + +export default class A +{ + constructor () + { + + } + + public B() + { + return 42; + } +} + + +//// [es5-umd3.js] +(function (deps, factory) { + if (typeof module === 'object' && typeof module.exports === 'object') { + var v = factory(require, exports); if (v !== undefined) module.exports = v; + } + else if (typeof define === 'function' && define.amd) { + define(deps, factory); + } +})(["require", "exports"], function (require, exports) { + var A = (function () { + function A() { + } + A.prototype.B = function () { + return 42; + }; + return A; + })(); + exports.default = A; +}); +//# sourceMappingURL=es5-umd3.js.map + +//// [es5-umd3.d.ts] +export default class A { + constructor(); + B(): number; +} diff --git a/tests/baselines/reference/es5-umd3.js.map b/tests/baselines/reference/es5-umd3.js.map new file mode 100644 index 00000000000..8b955f11936 --- /dev/null +++ b/tests/baselines/reference/es5-umd3.js.map @@ -0,0 +1,2 @@ +//// [es5-umd3.js.map] +{"version":3,"file":"es5-umd3.js","sourceRoot":"","sources":["es5-umd3.ts"],"names":["A","A.constructor","A.B"],"mappings":";;;;;;;;IACA;QAEIA;QAGAC,CAACA;QAEMD,aAACA,GAARA;YAEIE,MAAMA,CAACA,EAAEA,CAACA;QACdA,CAACA;QACLF,QAACA;IAADA,CAACA,AAXD,IAWC;IAXD,mBAWC,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/es5-umd3.sourcemap.txt b/tests/baselines/reference/es5-umd3.sourcemap.txt new file mode 100644 index 00000000000..afb879ac713 --- /dev/null +++ b/tests/baselines/reference/es5-umd3.sourcemap.txt @@ -0,0 +1,146 @@ +=================================================================== +JsFile: es5-umd3.js +mapUrl: es5-umd3.js.map +sourceRoot: +sources: es5-umd3.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/es5-umd3.js +sourceFile:es5-umd3.ts +------------------------------------------------------------------- +>>>(function (deps, factory) { +>>> if (typeof module === 'object' && typeof module.exports === 'object') { +>>> var v = factory(require, exports); if (v !== undefined) module.exports = v; +>>> } +>>> else if (typeof define === 'function' && define.amd) { +>>> define(deps, factory); +>>> } +>>>})(["require", "exports"], function (require, exports) { +>>> var A = (function () { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(9, 5) Source(2, 1) + SourceIndex(0) +--- +>>> function A() { +1->^^^^^^^^ +2 > ^^-> +1->export default class A + >{ + > +1->Emitted(10, 9) Source(4, 5) + SourceIndex(0) name (A) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1->constructor () + > { + > + > +2 > } +1->Emitted(11, 9) Source(7, 5) + SourceIndex(0) name (A.constructor) +2 >Emitted(11, 10) Source(7, 6) + SourceIndex(0) name (A.constructor) +--- +>>> A.prototype.B = function () { +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +1-> + > + > public +2 > B +3 > +1->Emitted(12, 9) Source(9, 12) + SourceIndex(0) name (A) +2 >Emitted(12, 22) Source(9, 13) + SourceIndex(0) name (A) +3 >Emitted(12, 25) Source(9, 5) + SourceIndex(0) name (A) +--- +>>> return 42; +1 >^^^^^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^ +5 > ^ +1 >public B() + > { + > +2 > return +3 > +4 > 42 +5 > ; +1 >Emitted(13, 13) Source(11, 9) + SourceIndex(0) name (A.B) +2 >Emitted(13, 19) Source(11, 15) + SourceIndex(0) name (A.B) +3 >Emitted(13, 20) Source(11, 16) + SourceIndex(0) name (A.B) +4 >Emitted(13, 22) Source(11, 18) + SourceIndex(0) name (A.B) +5 >Emitted(13, 23) Source(11, 19) + SourceIndex(0) name (A.B) +--- +>>> }; +1 >^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(14, 9) Source(12, 5) + SourceIndex(0) name (A.B) +2 >Emitted(14, 10) Source(12, 6) + SourceIndex(0) name (A.B) +--- +>>> return A; +1->^^^^^^^^ +2 > ^^^^^^^^ +1-> + > +2 > } +1->Emitted(15, 9) Source(13, 1) + SourceIndex(0) name (A) +2 >Emitted(15, 17) Source(13, 2) + SourceIndex(0) name (A) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export default class A + > { + > constructor () + > { + > + > } + > + > public B() + > { + > return 42; + > } + > } +1 >Emitted(16, 5) Source(13, 1) + SourceIndex(0) name (A) +2 >Emitted(16, 6) Source(13, 2) + SourceIndex(0) name (A) +3 >Emitted(16, 6) Source(2, 1) + SourceIndex(0) +4 >Emitted(16, 10) Source(13, 2) + SourceIndex(0) +--- +>>> exports.default = A; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^ +3 > ^ +1-> +2 > export default class A + > { + > constructor () + > { + > + > } + > + > public B() + > { + > return 42; + > } + > } +3 > +1->Emitted(17, 5) Source(2, 1) + SourceIndex(0) +2 >Emitted(17, 24) Source(13, 2) + SourceIndex(0) +3 >Emitted(17, 25) Source(13, 2) + SourceIndex(0) +--- +>>>}); +>>>//# sourceMappingURL=es5-umd3.js.map \ No newline at end of file diff --git a/tests/baselines/reference/es5-umd3.symbols b/tests/baselines/reference/es5-umd3.symbols new file mode 100644 index 00000000000..3f830ae3637 --- /dev/null +++ b/tests/baselines/reference/es5-umd3.symbols @@ -0,0 +1,17 @@ +=== tests/cases/compiler/es5-umd3.ts === + +export default class A +>A : Symbol(A, Decl(es5-umd3.ts, 0, 0)) +{ + constructor () + { + + } + + public B() +>B : Symbol(B, Decl(es5-umd3.ts, 6, 5)) + { + return 42; + } +} + diff --git a/tests/baselines/reference/es5-umd3.types b/tests/baselines/reference/es5-umd3.types new file mode 100644 index 00000000000..b4b5f0dc366 --- /dev/null +++ b/tests/baselines/reference/es5-umd3.types @@ -0,0 +1,18 @@ +=== tests/cases/compiler/es5-umd3.ts === + +export default class A +>A : A +{ + constructor () + { + + } + + public B() +>B : () => number + { + return 42; +>42 : number + } +} + diff --git a/tests/baselines/reference/es5-umd4.js b/tests/baselines/reference/es5-umd4.js new file mode 100644 index 00000000000..85683f8f3c2 --- /dev/null +++ b/tests/baselines/reference/es5-umd4.js @@ -0,0 +1,45 @@ +//// [es5-umd4.ts] + +class A +{ + constructor () + { + + } + + public B() + { + return 42; + } +} + +export = A; + + +//// [es5-umd4.js] +(function (deps, factory) { + if (typeof module === 'object' && typeof module.exports === 'object') { + var v = factory(require, exports); if (v !== undefined) module.exports = v; + } + else if (typeof define === 'function' && define.amd) { + define(deps, factory); + } +})(["require", "exports"], function (require, exports) { + var A = (function () { + function A() { + } + A.prototype.B = function () { + return 42; + }; + return A; + })(); + return A; +}); +//# sourceMappingURL=es5-umd4.js.map + +//// [es5-umd4.d.ts] +declare class A { + constructor(); + B(): number; +} +export = A; diff --git a/tests/baselines/reference/es5-umd4.js.map b/tests/baselines/reference/es5-umd4.js.map new file mode 100644 index 00000000000..0a47d679ed9 --- /dev/null +++ b/tests/baselines/reference/es5-umd4.js.map @@ -0,0 +1,2 @@ +//// [es5-umd4.js.map] +{"version":3,"file":"es5-umd4.js","sourceRoot":"","sources":["es5-umd4.ts"],"names":["A","A.constructor","A.B"],"mappings":";;;;;;;;IACA;QAEIA;QAGAC,CAACA;QAEMD,aAACA,GAARA;YAEIE,MAAMA,CAACA,EAAEA,CAACA;QACdA,CAACA;QACLF,QAACA;IAADA,CAACA,AAXD,IAWC;IAEU,AAAX,OAAS,CAAC,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/es5-umd4.sourcemap.txt b/tests/baselines/reference/es5-umd4.sourcemap.txt new file mode 100644 index 00000000000..9afd8effecf --- /dev/null +++ b/tests/baselines/reference/es5-umd4.sourcemap.txt @@ -0,0 +1,143 @@ +=================================================================== +JsFile: es5-umd4.js +mapUrl: es5-umd4.js.map +sourceRoot: +sources: es5-umd4.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/es5-umd4.js +sourceFile:es5-umd4.ts +------------------------------------------------------------------- +>>>(function (deps, factory) { +>>> if (typeof module === 'object' && typeof module.exports === 'object') { +>>> var v = factory(require, exports); if (v !== undefined) module.exports = v; +>>> } +>>> else if (typeof define === 'function' && define.amd) { +>>> define(deps, factory); +>>> } +>>>})(["require", "exports"], function (require, exports) { +>>> var A = (function () { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(9, 5) Source(2, 1) + SourceIndex(0) +--- +>>> function A() { +1->^^^^^^^^ +2 > ^^-> +1->class A + >{ + > +1->Emitted(10, 9) Source(4, 5) + SourceIndex(0) name (A) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1->constructor () + > { + > + > +2 > } +1->Emitted(11, 9) Source(7, 5) + SourceIndex(0) name (A.constructor) +2 >Emitted(11, 10) Source(7, 6) + SourceIndex(0) name (A.constructor) +--- +>>> A.prototype.B = function () { +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +1-> + > + > public +2 > B +3 > +1->Emitted(12, 9) Source(9, 12) + SourceIndex(0) name (A) +2 >Emitted(12, 22) Source(9, 13) + SourceIndex(0) name (A) +3 >Emitted(12, 25) Source(9, 5) + SourceIndex(0) name (A) +--- +>>> return 42; +1 >^^^^^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^ +5 > ^ +1 >public B() + > { + > +2 > return +3 > +4 > 42 +5 > ; +1 >Emitted(13, 13) Source(11, 9) + SourceIndex(0) name (A.B) +2 >Emitted(13, 19) Source(11, 15) + SourceIndex(0) name (A.B) +3 >Emitted(13, 20) Source(11, 16) + SourceIndex(0) name (A.B) +4 >Emitted(13, 22) Source(11, 18) + SourceIndex(0) name (A.B) +5 >Emitted(13, 23) Source(11, 19) + SourceIndex(0) name (A.B) +--- +>>> }; +1 >^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(14, 9) Source(12, 5) + SourceIndex(0) name (A.B) +2 >Emitted(14, 10) Source(12, 6) + SourceIndex(0) name (A.B) +--- +>>> return A; +1->^^^^^^^^ +2 > ^^^^^^^^ +1-> + > +2 > } +1->Emitted(15, 9) Source(13, 1) + SourceIndex(0) name (A) +2 >Emitted(15, 17) Source(13, 2) + SourceIndex(0) name (A) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^-> +1 > +2 > } +3 > +4 > class A + > { + > constructor () + > { + > + > } + > + > public B() + > { + > return 42; + > } + > } +1 >Emitted(16, 5) Source(13, 1) + SourceIndex(0) name (A) +2 >Emitted(16, 6) Source(13, 2) + SourceIndex(0) name (A) +3 >Emitted(16, 6) Source(2, 1) + SourceIndex(0) +4 >Emitted(16, 10) Source(13, 2) + SourceIndex(0) +--- +>>> return A; +1->^^^^ +2 > +3 > ^^^^^^^ +4 > ^ +5 > ^ +1-> + > + >export = A; +2 > +3 > export = +4 > A +5 > ; +1->Emitted(17, 5) Source(15, 12) + SourceIndex(0) +2 >Emitted(17, 5) Source(15, 1) + SourceIndex(0) +3 >Emitted(17, 12) Source(15, 10) + SourceIndex(0) +4 >Emitted(17, 13) Source(15, 11) + SourceIndex(0) +5 >Emitted(17, 14) Source(15, 12) + SourceIndex(0) +--- +>>>}); +>>>//# sourceMappingURL=es5-umd4.js.map \ No newline at end of file diff --git a/tests/baselines/reference/es5-umd4.symbols b/tests/baselines/reference/es5-umd4.symbols new file mode 100644 index 00000000000..cdf1e135cf7 --- /dev/null +++ b/tests/baselines/reference/es5-umd4.symbols @@ -0,0 +1,20 @@ +=== tests/cases/compiler/es5-umd4.ts === + +class A +>A : Symbol(A, Decl(es5-umd4.ts, 0, 0)) +{ + constructor () + { + + } + + public B() +>B : Symbol(B, Decl(es5-umd4.ts, 6, 5)) + { + return 42; + } +} + +export = A; +>A : Symbol(A, Decl(es5-umd4.ts, 0, 0)) + diff --git a/tests/baselines/reference/es5-umd4.types b/tests/baselines/reference/es5-umd4.types new file mode 100644 index 00000000000..59d23e6bd8d --- /dev/null +++ b/tests/baselines/reference/es5-umd4.types @@ -0,0 +1,21 @@ +=== tests/cases/compiler/es5-umd4.ts === + +class A +>A : A +{ + constructor () + { + + } + + public B() +>B : () => number + { + return 42; +>42 : number + } +} + +export = A; +>A : A + diff --git a/tests/baselines/reference/es6-umd.errors.txt b/tests/baselines/reference/es6-umd.errors.txt new file mode 100644 index 00000000000..c231fe0b12b --- /dev/null +++ b/tests/baselines/reference/es6-umd.errors.txt @@ -0,0 +1,18 @@ +error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher. + + +!!! error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher. +==== tests/cases/compiler/es6-umd.ts (0 errors) ==== + + class A + { + constructor () + { + + } + + public B() + { + return 42; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/es6-umd.js b/tests/baselines/reference/es6-umd.js new file mode 100644 index 00000000000..74cd671f5ef --- /dev/null +++ b/tests/baselines/reference/es6-umd.js @@ -0,0 +1,30 @@ +//// [es6-umd.ts] + +class A +{ + constructor () + { + + } + + public B() + { + return 42; + } +} + +//// [es6-umd.js] +class A { + constructor() { + } + B() { + return 42; + } +} +//# sourceMappingURL=es6-umd.js.map + +//// [es6-umd.d.ts] +declare class A { + constructor(); + B(): number; +} diff --git a/tests/baselines/reference/es6-umd.js.map b/tests/baselines/reference/es6-umd.js.map new file mode 100644 index 00000000000..a5e82f7ccfd --- /dev/null +++ b/tests/baselines/reference/es6-umd.js.map @@ -0,0 +1,2 @@ +//// [es6-umd.js.map] +{"version":3,"file":"es6-umd.js","sourceRoot":"","sources":["es6-umd.ts"],"names":["A","A.constructor","A.B"],"mappings":"AACA;IAEIA;IAGAC,CAACA;IAEMD,CAACA;QAEJE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;AACLF,CAACA;AAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/es6-umd.sourcemap.txt b/tests/baselines/reference/es6-umd.sourcemap.txt new file mode 100644 index 00000000000..bb8281ce741 --- /dev/null +++ b/tests/baselines/reference/es6-umd.sourcemap.txt @@ -0,0 +1,91 @@ +=================================================================== +JsFile: es6-umd.js +mapUrl: es6-umd.js.map +sourceRoot: +sources: es6-umd.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/es6-umd.js +sourceFile:es6-umd.ts +------------------------------------------------------------------- +>>>class A { +1 > +2 >^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) +--- +>>> constructor() { +1->^^^^ +2 > ^^-> +1->class A + >{ + > +1->Emitted(2, 5) Source(4, 5) + SourceIndex(0) name (A) +--- +>>> } +1->^^^^ +2 > ^ +3 > ^^^^^-> +1->constructor () + > { + > + > +2 > } +1->Emitted(3, 5) Source(7, 5) + SourceIndex(0) name (A.constructor) +2 >Emitted(3, 6) Source(7, 6) + SourceIndex(0) name (A.constructor) +--- +>>> B() { +1->^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^-> +1-> + > + > public +2 > B +1->Emitted(4, 5) Source(9, 12) + SourceIndex(0) name (A) +2 >Emitted(4, 6) Source(9, 13) + SourceIndex(0) name (A) +--- +>>> return 42; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^ +5 > ^ +1->() + > { + > +2 > return +3 > +4 > 42 +5 > ; +1->Emitted(5, 9) Source(11, 9) + SourceIndex(0) name (A.B) +2 >Emitted(5, 15) Source(11, 15) + SourceIndex(0) name (A.B) +3 >Emitted(5, 16) Source(11, 16) + SourceIndex(0) name (A.B) +4 >Emitted(5, 18) Source(11, 18) + SourceIndex(0) name (A.B) +5 >Emitted(5, 19) Source(11, 19) + SourceIndex(0) name (A.B) +--- +>>> } +1 >^^^^ +2 > ^ +1 > + > +2 > } +1 >Emitted(6, 5) Source(12, 5) + SourceIndex(0) name (A.B) +2 >Emitted(6, 6) Source(12, 6) + SourceIndex(0) name (A.B) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(7, 1) Source(13, 1) + SourceIndex(0) name (A) +2 >Emitted(7, 2) Source(13, 2) + SourceIndex(0) name (A) +--- +>>>//# sourceMappingURL=es6-umd.js.map1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> +1->Emitted(8, 1) Source(13, 2) + SourceIndex(0) +--- \ No newline at end of file diff --git a/tests/baselines/reference/es6-umd2.errors.txt b/tests/baselines/reference/es6-umd2.errors.txt new file mode 100644 index 00000000000..ac05e967356 --- /dev/null +++ b/tests/baselines/reference/es6-umd2.errors.txt @@ -0,0 +1,18 @@ +error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher. + + +!!! error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher. +==== tests/cases/compiler/es6-umd2.ts (0 errors) ==== + + export class A + { + constructor () + { + + } + + public B() + { + return 42; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/es6-umd2.js b/tests/baselines/reference/es6-umd2.js new file mode 100644 index 00000000000..b12d35aacf8 --- /dev/null +++ b/tests/baselines/reference/es6-umd2.js @@ -0,0 +1,30 @@ +//// [es6-umd2.ts] + +export class A +{ + constructor () + { + + } + + public B() + { + return 42; + } +} + +//// [es6-umd2.js] +export class A { + constructor() { + } + B() { + return 42; + } +} +//# sourceMappingURL=es6-umd2.js.map + +//// [es6-umd2.d.ts] +export declare class A { + constructor(); + B(): number; +} diff --git a/tests/baselines/reference/es6-umd2.js.map b/tests/baselines/reference/es6-umd2.js.map new file mode 100644 index 00000000000..81f3d85a6cd --- /dev/null +++ b/tests/baselines/reference/es6-umd2.js.map @@ -0,0 +1,2 @@ +//// [es6-umd2.js.map] +{"version":3,"file":"es6-umd2.js","sourceRoot":"","sources":["es6-umd2.ts"],"names":["A","A.constructor","A.B"],"mappings":"AACA;IAEIA;IAGAC,CAACA;IAEMD,CAACA;QAEJE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;AACLF,CAACA;AAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/es6-umd2.sourcemap.txt b/tests/baselines/reference/es6-umd2.sourcemap.txt new file mode 100644 index 00000000000..d032aa3d6c7 --- /dev/null +++ b/tests/baselines/reference/es6-umd2.sourcemap.txt @@ -0,0 +1,91 @@ +=================================================================== +JsFile: es6-umd2.js +mapUrl: es6-umd2.js.map +sourceRoot: +sources: es6-umd2.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/es6-umd2.js +sourceFile:es6-umd2.ts +------------------------------------------------------------------- +>>>export class A { +1 > +2 >^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) +--- +>>> constructor() { +1->^^^^ +2 > ^^-> +1->export class A + >{ + > +1->Emitted(2, 5) Source(4, 5) + SourceIndex(0) name (A) +--- +>>> } +1->^^^^ +2 > ^ +3 > ^^^^^-> +1->constructor () + > { + > + > +2 > } +1->Emitted(3, 5) Source(7, 5) + SourceIndex(0) name (A.constructor) +2 >Emitted(3, 6) Source(7, 6) + SourceIndex(0) name (A.constructor) +--- +>>> B() { +1->^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^-> +1-> + > + > public +2 > B +1->Emitted(4, 5) Source(9, 12) + SourceIndex(0) name (A) +2 >Emitted(4, 6) Source(9, 13) + SourceIndex(0) name (A) +--- +>>> return 42; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^ +5 > ^ +1->() + > { + > +2 > return +3 > +4 > 42 +5 > ; +1->Emitted(5, 9) Source(11, 9) + SourceIndex(0) name (A.B) +2 >Emitted(5, 15) Source(11, 15) + SourceIndex(0) name (A.B) +3 >Emitted(5, 16) Source(11, 16) + SourceIndex(0) name (A.B) +4 >Emitted(5, 18) Source(11, 18) + SourceIndex(0) name (A.B) +5 >Emitted(5, 19) Source(11, 19) + SourceIndex(0) name (A.B) +--- +>>> } +1 >^^^^ +2 > ^ +1 > + > +2 > } +1 >Emitted(6, 5) Source(12, 5) + SourceIndex(0) name (A.B) +2 >Emitted(6, 6) Source(12, 6) + SourceIndex(0) name (A.B) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(7, 1) Source(13, 1) + SourceIndex(0) name (A) +2 >Emitted(7, 2) Source(13, 2) + SourceIndex(0) name (A) +--- +>>>//# sourceMappingURL=es6-umd2.js.map1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> +1->Emitted(8, 1) Source(13, 2) + SourceIndex(0) +--- \ No newline at end of file diff --git a/tests/baselines/reference/umdDependencyComment2.errors.txt b/tests/baselines/reference/umdDependencyComment2.errors.txt index 1e85844af64..66c4adf4c1d 100644 --- a/tests/baselines/reference/umdDependencyComment2.errors.txt +++ b/tests/baselines/reference/umdDependencyComment2.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/umdDependencyComment2.ts(3,21): error TS2307: Cannot find external module 'm2'. - - -==== tests/cases/compiler/umdDependencyComment2.ts (1 errors) ==== - /// - - import m1 = require("m2") - ~~~~ -!!! error TS2307: Cannot find external module 'm2'. - m1.f(); +tests/cases/compiler/umdDependencyComment2.ts(3,21): error TS2307: Cannot find external module 'm2'. + + +==== tests/cases/compiler/umdDependencyComment2.ts (1 errors) ==== + /// + + import m1 = require("m2") + ~~~~ +!!! error TS2307: Cannot find external module 'm2'. + m1.f(); \ No newline at end of file diff --git a/tests/baselines/reference/umdDependencyComment2.js b/tests/baselines/reference/umdDependencyComment2.js index 462dad2daca..cae34631517 100644 --- a/tests/baselines/reference/umdDependencyComment2.js +++ b/tests/baselines/reference/umdDependencyComment2.js @@ -1,20 +1,20 @@ -//// [umdDependencyComment2.ts] +//// [umdDependencyComment2.ts] /// import m1 = require("m2") m1.f(); - - -//// [umdDependencyComment2.js] -/// -(function (deps, factory) { - if (typeof module === 'object' && typeof module.exports === 'object') { - var v = factory(require, exports); if (v !== undefined) module.exports = v; - } - else if (typeof define === 'function' && define.amd) { - define(deps, factory); - } -})(["require", "exports", "bar", "m2"], function (require, exports) { - var m1 = require("m2"); - m1.f(); -}); + + +//// [umdDependencyComment2.js] +/// +(function (deps, factory) { + if (typeof module === 'object' && typeof module.exports === 'object') { + var v = factory(require, exports); if (v !== undefined) module.exports = v; + } + else if (typeof define === 'function' && define.amd) { + define(deps, factory); + } +})(["require", "exports", "bar", "m2"], function (require, exports) { + var m1 = require("m2"); + m1.f(); +}); diff --git a/tests/baselines/reference/umdDependencyCommentName1.errors.txt b/tests/baselines/reference/umdDependencyCommentName1.errors.txt index 080ae2d852a..6acb71c4b00 100644 --- a/tests/baselines/reference/umdDependencyCommentName1.errors.txt +++ b/tests/baselines/reference/umdDependencyCommentName1.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/umdDependencyCommentName1.ts(3,21): error TS2307: Cannot find external module 'm2'. - - -==== tests/cases/compiler/umdDependencyCommentName1.ts (1 errors) ==== - /// - - import m1 = require("m2") - ~~~~ -!!! error TS2307: Cannot find external module 'm2'. - m1.f(); +tests/cases/compiler/umdDependencyCommentName1.ts(3,21): error TS2307: Cannot find external module 'm2'. + + +==== tests/cases/compiler/umdDependencyCommentName1.ts (1 errors) ==== + /// + + import m1 = require("m2") + ~~~~ +!!! error TS2307: Cannot find external module 'm2'. + m1.f(); \ No newline at end of file diff --git a/tests/baselines/reference/umdDependencyCommentName1.js b/tests/baselines/reference/umdDependencyCommentName1.js index 20ef7c1326f..6cb87eb45f5 100644 --- a/tests/baselines/reference/umdDependencyCommentName1.js +++ b/tests/baselines/reference/umdDependencyCommentName1.js @@ -1,20 +1,20 @@ -//// [umdDependencyCommentName1.ts] +//// [umdDependencyCommentName1.ts] /// import m1 = require("m2") m1.f(); - - -//// [umdDependencyCommentName1.js] -/// -(function (deps, factory) { - if (typeof module === 'object' && typeof module.exports === 'object') { - var v = factory(require, exports); if (v !== undefined) module.exports = v; - } - else if (typeof define === 'function' && define.amd) { - define(deps, factory); - } -})(["require", "exports", "bar", "m2"], function (require, exports, b) { - var m1 = require("m2"); - m1.f(); -}); + + +//// [umdDependencyCommentName1.js] +/// +(function (deps, factory) { + if (typeof module === 'object' && typeof module.exports === 'object') { + var v = factory(require, exports); if (v !== undefined) module.exports = v; + } + else if (typeof define === 'function' && define.amd) { + define(deps, factory); + } +})(["require", "exports", "bar", "m2"], function (require, exports, b) { + var m1 = require("m2"); + m1.f(); +}); diff --git a/tests/baselines/reference/umdDependencyCommentName2.errors.txt b/tests/baselines/reference/umdDependencyCommentName2.errors.txt index 903ca4ecfaf..3481ca61148 100644 --- a/tests/baselines/reference/umdDependencyCommentName2.errors.txt +++ b/tests/baselines/reference/umdDependencyCommentName2.errors.txt @@ -1,13 +1,13 @@ -tests/cases/compiler/umdDependencyCommentName2.ts(5,21): error TS2307: Cannot find external module 'm2'. - - -==== tests/cases/compiler/umdDependencyCommentName2.ts (1 errors) ==== - /// - /// - /// - - import m1 = require("m2") - ~~~~ -!!! error TS2307: Cannot find external module 'm2'. - m1.f(); +tests/cases/compiler/umdDependencyCommentName2.ts(5,21): error TS2307: Cannot find external module 'm2'. + + +==== tests/cases/compiler/umdDependencyCommentName2.ts (1 errors) ==== + /// + /// + /// + + import m1 = require("m2") + ~~~~ +!!! error TS2307: Cannot find external module 'm2'. + m1.f(); \ No newline at end of file diff --git a/tests/baselines/reference/umdDependencyCommentName2.js b/tests/baselines/reference/umdDependencyCommentName2.js index 22a0cc709bc..d474454936d 100644 --- a/tests/baselines/reference/umdDependencyCommentName2.js +++ b/tests/baselines/reference/umdDependencyCommentName2.js @@ -1,24 +1,24 @@ -//// [umdDependencyCommentName2.ts] +//// [umdDependencyCommentName2.ts] /// /// /// import m1 = require("m2") m1.f(); - - -//// [umdDependencyCommentName2.js] -/// -/// -/// -(function (deps, factory) { - if (typeof module === 'object' && typeof module.exports === 'object') { - var v = factory(require, exports); if (v !== undefined) module.exports = v; - } - else if (typeof define === 'function' && define.amd) { - define(deps, factory); - } -})(["require", "exports", "bar", "goo", "foo", "m2"], function (require, exports, b, c) { - var m1 = require("m2"); - m1.f(); -}); + + +//// [umdDependencyCommentName2.js] +/// +/// +/// +(function (deps, factory) { + if (typeof module === 'object' && typeof module.exports === 'object') { + var v = factory(require, exports); if (v !== undefined) module.exports = v; + } + else if (typeof define === 'function' && define.amd) { + define(deps, factory); + } +})(["require", "exports", "bar", "goo", "foo", "m2"], function (require, exports, b, c) { + var m1 = require("m2"); + m1.f(); +}); diff --git a/tests/cases/compiler/es5-umd2.ts b/tests/cases/compiler/es5-umd2.ts new file mode 100644 index 00000000000..a74ae21f4dd --- /dev/null +++ b/tests/cases/compiler/es5-umd2.ts @@ -0,0 +1,17 @@ +// @target: ES5 +// @sourcemap: false +// @declaration: false +// @module: umd + +export class A +{ + constructor () + { + + } + + public B() + { + return 42; + } +} diff --git a/tests/cases/compiler/es5-umd3.ts b/tests/cases/compiler/es5-umd3.ts new file mode 100644 index 00000000000..b4ab3cc1cf1 --- /dev/null +++ b/tests/cases/compiler/es5-umd3.ts @@ -0,0 +1,17 @@ +// @target: ES5 +// @sourcemap: false +// @declaration: false +// @module: umd + +export default class A +{ + constructor () + { + + } + + public B() + { + return 42; + } +} diff --git a/tests/cases/compiler/es5-umd4.ts b/tests/cases/compiler/es5-umd4.ts new file mode 100644 index 00000000000..5ab7e7de4e3 --- /dev/null +++ b/tests/cases/compiler/es5-umd4.ts @@ -0,0 +1,19 @@ +// @target: ES5 +// @sourcemap: false +// @declaration: false +// @module: umd + +class A +{ + constructor () + { + + } + + public B() + { + return 42; + } +} + +export = A; diff --git a/tests/cases/compiler/es6-umd.ts b/tests/cases/compiler/es6-umd.ts new file mode 100644 index 00000000000..239ff49ef6c --- /dev/null +++ b/tests/cases/compiler/es6-umd.ts @@ -0,0 +1,17 @@ +// @target: ES6 +// @sourcemap: false +// @declaration: false +// @module: umd + +class A +{ + constructor () + { + + } + + public B() + { + return 42; + } +} \ No newline at end of file diff --git a/tests/cases/compiler/es6-umd2.ts b/tests/cases/compiler/es6-umd2.ts new file mode 100644 index 00000000000..54622fe81aa --- /dev/null +++ b/tests/cases/compiler/es6-umd2.ts @@ -0,0 +1,17 @@ +// @target: ES6 +// @sourcemap: false +// @declaration: false +// @module: umd + +export class A +{ + constructor () + { + + } + + public B() + { + return 42; + } +} \ No newline at end of file From ded0e398b4758218001a837c893e60e92596cc40 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Thu, 23 Apr 2015 10:53:19 -0700 Subject: [PATCH 35/45] update error messages --- src/compiler/commandLineParser.ts | 2 +- src/compiler/diagnosticInformationMap.generated.ts | 6 +++--- src/compiler/diagnosticMessages.json | 6 +++--- src/compiler/program.ts | 2 +- .../reference/constDeclarations-access5.errors.txt | 4 ++-- tests/baselines/reference/es6-amd.errors.txt | 4 ++-- tests/baselines/reference/es6-declaration-amd.errors.txt | 4 ++-- tests/baselines/reference/es6-sourcemap-amd.errors.txt | 4 ++-- tests/baselines/reference/es6-umd.errors.txt | 4 ++-- tests/baselines/reference/es6-umd2.errors.txt | 4 ++-- ...s6ImportDefaultBindingFollowedWithNamedImport.errors.txt | 4 ++-- .../baselines/reference/es6ImportNameSpaceImport.errors.txt | 4 ++-- tests/baselines/reference/es6ImportNamedImport.errors.txt | 4 ++-- .../es6ImportNamedImportInExportAssignment.errors.txt | 4 ++-- .../reference/es6ModuleWithModuleGenTargetAmd.errors.txt | 4 ++-- .../es6ModuleWithModuleGenTargetCommonjs.errors.txt | 4 ++-- 16 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index adb0e2d37c5..002e049bdd0 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -151,7 +151,7 @@ module ts { type: { "es3": ScriptTarget.ES3, "es5": ScriptTarget.ES5, "es6": ScriptTarget.ES6 }, description: Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental, paramType: Diagnostics.VERSION, - error: Diagnostics.Argument_for_target_option_must_be_es3_es5_or_es6 + error: Diagnostics.Argument_for_target_option_must_be_ES3_ES5_or_ES6 }, { name: "version", diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index f03b2ea16b3..0af10bdb89a 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -161,7 +161,7 @@ module ts { Line_terminator_not_permitted_before_arrow: { code: 1200, category: DiagnosticCategory.Error, key: "Line terminator not permitted before arrow." }, Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_or_import_d_from_mod_instead: { code: 1202, category: DiagnosticCategory.Error, key: "Import assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"' or 'import d from \"mod\"' instead." }, Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead: { code: 1203, category: DiagnosticCategory.Error, key: "Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead." }, - Cannot_compile_external_modules_into_amd_or_commonjs_when_targeting_es6_or_higher: { code: 1204, category: DiagnosticCategory.Error, key: "Cannot compile external modules into amd or commonjs when targeting es6 or higher." }, + Cannot_compile_external_modules_into_amd_commonjs_or_umd_when_targeting_ES6_or_higher: { code: 1204, category: DiagnosticCategory.Error, key: "Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher." }, Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1205, category: DiagnosticCategory.Error, key: "Decorators are only available when targeting ECMAScript 5 and higher." }, Decorators_are_not_valid_here: { code: 1206, category: DiagnosticCategory.Error, key: "Decorators are not valid here." }, Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: DiagnosticCategory.Error, key: "Decorators cannot be applied to multiple get/set accessors of the same name." }, @@ -463,7 +463,7 @@ module ts { Do_not_emit_comments_to_output: { code: 6009, category: DiagnosticCategory.Message, key: "Do not emit comments to output." }, Do_not_emit_outputs: { code: 6010, category: DiagnosticCategory.Message, key: "Do not emit outputs." }, Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, - Specify_module_code_generation_Colon_commonjs_amd_or_umd: { code: 6016, category: DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs', 'amd', or 'umd'" }, + Specify_module_code_generation_Colon_commonjs_amd_or_umd: { code: 6016, category: DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs', 'amd', or 'umd'." }, Print_this_message: { code: 6017, category: DiagnosticCategory.Message, key: "Print this message." }, Print_the_compiler_s_version: { code: 6019, category: DiagnosticCategory.Message, key: "Print the compiler's version." }, Compile_the_project_in_the_given_directory: { code: 6020, category: DiagnosticCategory.Message, key: "Compile the project in the given directory." }, @@ -485,7 +485,7 @@ module ts { Compiler_option_0_expects_an_argument: { code: 6044, category: DiagnosticCategory.Error, key: "Compiler option '{0}' expects an argument." }, Unterminated_quoted_string_in_response_file_0: { code: 6045, category: DiagnosticCategory.Error, key: "Unterminated quoted string in response file '{0}'." }, Argument_for_module_option_must_be_commonjs_amd_or_umd: { code: 6046, category: DiagnosticCategory.Error, key: "Argument for '--module' option must be 'commonjs', 'amd', or 'umd'." }, - Argument_for_target_option_must_be_es3_es5_or_es6: { code: 6047, category: DiagnosticCategory.Error, key: "Argument for '--target' option must be 'es3', 'es5', or 'es6'." }, + Argument_for_target_option_must_be_ES3_ES5_or_ES6: { code: 6047, category: DiagnosticCategory.Error, key: "Argument for '--target' option must be 'ES3', 'ES5', or 'ES6'." }, Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: DiagnosticCategory.Error, key: "Locale must be of the form or -. For example '{0}' or '{1}'." }, Unsupported_locale_0: { code: 6049, category: DiagnosticCategory.Error, key: "Unsupported locale '{0}'." }, Unable_to_open_file_0: { code: 6050, category: DiagnosticCategory.Error, key: "Unable to open file '{0}'." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 7192987f810..8aa4f73fe7c 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -631,7 +631,7 @@ "category": "Error", "code": 1203 }, - "Cannot compile external modules into amd or commonjs when targeting es6 or higher.": { + "Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher.": { "category": "Error", "code": 1204 }, @@ -1840,7 +1840,7 @@ "category": "Message", "code": 6015 }, - "Specify module code generation: 'commonjs', 'amd', or 'umd'": { + "Specify module code generation: 'commonjs', 'amd', or 'umd'.": { "category": "Message", "code": 6016 }, @@ -1928,7 +1928,7 @@ "category": "Error", "code": 6046 }, - "Argument for '--target' option must be 'es3', 'es5', or 'es6'.": { + "Argument for '--target' option must be 'ES3', 'ES5', or 'ES6'.": { "category": "Error", "code": 6047 }, diff --git a/src/compiler/program.ts b/src/compiler/program.ts index d49e01bd45d..97c681838f2 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -567,7 +567,7 @@ module ts { // Cannot specify module gen target when in es6 or above if (options.module && languageVersion >= ScriptTarget.ES6) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_compile_external_modules_into_amd_or_commonjs_when_targeting_es6_or_higher)); + diagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_compile_external_modules_into_amd_commonjs_or_umd_when_targeting_ES6_or_higher)); } // there has to be common source directory if user specified --outdir || --sourceRoot diff --git a/tests/baselines/reference/constDeclarations-access5.errors.txt b/tests/baselines/reference/constDeclarations-access5.errors.txt index a098b0e72c6..e689bbf8b4e 100644 --- a/tests/baselines/reference/constDeclarations-access5.errors.txt +++ b/tests/baselines/reference/constDeclarations-access5.errors.txt @@ -1,4 +1,4 @@ -error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher. +error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher. tests/cases/compiler/constDeclarations_access_2.ts(2,1): error TS1202: Import assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'import * as ns from "mod"', 'import {a} from "mod"' or 'import d from "mod"' instead. tests/cases/compiler/constDeclarations_access_2.ts(4,1): error TS2450: Left-hand side of assignment expression cannot be a constant. tests/cases/compiler/constDeclarations_access_2.ts(5,1): error TS2450: Left-hand side of assignment expression cannot be a constant. @@ -20,7 +20,7 @@ tests/cases/compiler/constDeclarations_access_2.ts(22,3): error TS2449: The oper tests/cases/compiler/constDeclarations_access_2.ts(24,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -!!! error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher. +!!! error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher. ==== tests/cases/compiler/constDeclarations_access_2.ts (19 errors) ==== /// import m = require('constDeclarations_access_1'); diff --git a/tests/baselines/reference/es6-amd.errors.txt b/tests/baselines/reference/es6-amd.errors.txt index cb1ef4b1287..e1e44b4a493 100644 --- a/tests/baselines/reference/es6-amd.errors.txt +++ b/tests/baselines/reference/es6-amd.errors.txt @@ -1,7 +1,7 @@ -error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher. +error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher. -!!! error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher. +!!! error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher. ==== tests/cases/compiler/es6-amd.ts (0 errors) ==== class A diff --git a/tests/baselines/reference/es6-declaration-amd.errors.txt b/tests/baselines/reference/es6-declaration-amd.errors.txt index 18319504dc9..30cf14f0861 100644 --- a/tests/baselines/reference/es6-declaration-amd.errors.txt +++ b/tests/baselines/reference/es6-declaration-amd.errors.txt @@ -1,7 +1,7 @@ -error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher. +error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher. -!!! error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher. +!!! error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher. ==== tests/cases/compiler/es6-declaration-amd.ts (0 errors) ==== class A diff --git a/tests/baselines/reference/es6-sourcemap-amd.errors.txt b/tests/baselines/reference/es6-sourcemap-amd.errors.txt index 24a83f8ee12..da8968e9d5e 100644 --- a/tests/baselines/reference/es6-sourcemap-amd.errors.txt +++ b/tests/baselines/reference/es6-sourcemap-amd.errors.txt @@ -1,7 +1,7 @@ -error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher. +error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher. -!!! error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher. +!!! error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher. ==== tests/cases/compiler/es6-sourcemap-amd.ts (0 errors) ==== class A diff --git a/tests/baselines/reference/es6-umd.errors.txt b/tests/baselines/reference/es6-umd.errors.txt index c231fe0b12b..874b41552c5 100644 --- a/tests/baselines/reference/es6-umd.errors.txt +++ b/tests/baselines/reference/es6-umd.errors.txt @@ -1,7 +1,7 @@ -error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher. +error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher. -!!! error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher. +!!! error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher. ==== tests/cases/compiler/es6-umd.ts (0 errors) ==== class A diff --git a/tests/baselines/reference/es6-umd2.errors.txt b/tests/baselines/reference/es6-umd2.errors.txt index ac05e967356..88d732df122 100644 --- a/tests/baselines/reference/es6-umd2.errors.txt +++ b/tests/baselines/reference/es6-umd2.errors.txt @@ -1,7 +1,7 @@ -error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher. +error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher. -!!! error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher. +!!! error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher. ==== tests/cases/compiler/es6-umd2.ts (0 errors) ==== export class A diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.errors.txt b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.errors.txt index 34bb303a571..5844f39ed3a 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.errors.txt +++ b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.errors.txt @@ -1,7 +1,7 @@ -error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher. +error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher. -!!! error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher. +!!! error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher. ==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0.ts (0 errors) ==== export var a = 10; diff --git a/tests/baselines/reference/es6ImportNameSpaceImport.errors.txt b/tests/baselines/reference/es6ImportNameSpaceImport.errors.txt index 635bb955c00..20b74ee394e 100644 --- a/tests/baselines/reference/es6ImportNameSpaceImport.errors.txt +++ b/tests/baselines/reference/es6ImportNameSpaceImport.errors.txt @@ -1,7 +1,7 @@ -error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher. +error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher. -!!! error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher. +!!! error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher. ==== tests/cases/compiler/es6ImportNameSpaceImport_0.ts (0 errors) ==== export var a = 10; diff --git a/tests/baselines/reference/es6ImportNamedImport.errors.txt b/tests/baselines/reference/es6ImportNamedImport.errors.txt index 5723b5c20d4..b20f3808c95 100644 --- a/tests/baselines/reference/es6ImportNamedImport.errors.txt +++ b/tests/baselines/reference/es6ImportNamedImport.errors.txt @@ -1,7 +1,7 @@ -error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher. +error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher. -!!! error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher. +!!! error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher. ==== tests/cases/compiler/es6ImportNamedImport_0.ts (0 errors) ==== export var a = 10; diff --git a/tests/baselines/reference/es6ImportNamedImportInExportAssignment.errors.txt b/tests/baselines/reference/es6ImportNamedImportInExportAssignment.errors.txt index 41d3f160938..ce4d4965921 100644 --- a/tests/baselines/reference/es6ImportNamedImportInExportAssignment.errors.txt +++ b/tests/baselines/reference/es6ImportNamedImportInExportAssignment.errors.txt @@ -1,8 +1,8 @@ -error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher. +error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher. tests/cases/compiler/es6ImportNamedImportInExportAssignment_1.ts(2,1): error TS1203: Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead. -!!! error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher. +!!! error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher. ==== tests/cases/compiler/es6ImportNamedImportInExportAssignment_0.ts (0 errors) ==== export var a = 10; diff --git a/tests/baselines/reference/es6ModuleWithModuleGenTargetAmd.errors.txt b/tests/baselines/reference/es6ModuleWithModuleGenTargetAmd.errors.txt index bbe0d8b78b6..e851817ee8e 100644 --- a/tests/baselines/reference/es6ModuleWithModuleGenTargetAmd.errors.txt +++ b/tests/baselines/reference/es6ModuleWithModuleGenTargetAmd.errors.txt @@ -1,7 +1,7 @@ -error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher. +error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher. -!!! error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher. +!!! error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher. ==== tests/cases/compiler/es6ModuleWithModuleGenTargetAmd.ts (0 errors) ==== export class A { diff --git a/tests/baselines/reference/es6ModuleWithModuleGenTargetCommonjs.errors.txt b/tests/baselines/reference/es6ModuleWithModuleGenTargetCommonjs.errors.txt index 87f53cb7810..1de27c03c54 100644 --- a/tests/baselines/reference/es6ModuleWithModuleGenTargetCommonjs.errors.txt +++ b/tests/baselines/reference/es6ModuleWithModuleGenTargetCommonjs.errors.txt @@ -1,7 +1,7 @@ -error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher. +error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher. -!!! error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher. +!!! error TS1204: Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher. ==== tests/cases/compiler/es6ModuleWithModuleGenTargetCommonjs.ts (0 errors) ==== export class A { From a9e79bf06b97cd32821bcea891b7feb03dfd492f Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Thu, 23 Apr 2015 11:04:44 -0700 Subject: [PATCH 36/45] Lazy resolution of global decorator types --- src/compiler/checker.ts | 26 +++++++++---------- src/compiler/core.ts | 11 ++++++++ .../reference/noDefaultLib.errors.txt | 10 ------- .../reference/parser509698.errors.txt | 26 ++++++------------- .../noDefaultLib/amd/noDefaultLib.errors.txt | 26 ++++++------------- .../noDefaultLib/node/noDefaultLib.errors.txt | 26 ++++++------------- .../typeCheckTypeArgument.errors.txt | 22 +++++----------- 7 files changed, 53 insertions(+), 94 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 50d17638371..489e44a9cd3 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -114,11 +114,10 @@ module ts { let globalIterableType: ObjectType; let anyArrayType: Type; - let globalTypedPropertyDescriptorType: ObjectType; - let globalClassDecoratorType: ObjectType; - let globalParameterDecoratorType: ObjectType; - let globalPropertyDecoratorType: ObjectType; - let globalMethodDecoratorType: ObjectType; + let getGlobalClassDecoratorType: () => ObjectType; + let getGlobalParameterDecoratorType: () => ObjectType; + let getGlobalPropertyDecoratorType: () => ObjectType; + let getGlobalMethodDecoratorType: () => ObjectType; let tupleTypes: Map = {}; let unionTypes: Map = {}; @@ -8790,24 +8789,24 @@ module ts { case SyntaxKind.ClassDeclaration: let classSymbol = getSymbolOfNode(node.parent); let classConstructorType = getTypeOfSymbol(classSymbol); - let classDecoratorType = instantiateSingleCallFunctionType(globalClassDecoratorType, [classConstructorType]); + let classDecoratorType = instantiateSingleCallFunctionType(getGlobalClassDecoratorType(), [classConstructorType]); checkTypeAssignableTo(exprType, classDecoratorType, node); break; case SyntaxKind.PropertyDeclaration: - checkTypeAssignableTo(exprType, globalPropertyDecoratorType, node); + checkTypeAssignableTo(exprType, getGlobalPropertyDecoratorType(), node); break; case SyntaxKind.MethodDeclaration: case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: let methodType = getTypeOfNode(node.parent); - let methodDecoratorType = instantiateSingleCallFunctionType(globalMethodDecoratorType, [methodType]); + let methodDecoratorType = instantiateSingleCallFunctionType(getGlobalMethodDecoratorType(), [methodType]); checkTypeAssignableTo(exprType, methodDecoratorType, node); break; case SyntaxKind.Parameter: - checkTypeAssignableTo(exprType, globalParameterDecoratorType, node); + checkTypeAssignableTo(exprType, getGlobalParameterDecoratorType(), node); break; } } @@ -11969,11 +11968,10 @@ module ts { globalNumberType = getGlobalType("Number"); globalBooleanType = getGlobalType("Boolean"); globalRegExpType = getGlobalType("RegExp"); - globalTypedPropertyDescriptorType = getTypeOfGlobalSymbol(getGlobalTypeSymbol("TypedPropertyDescriptor"), 1); - globalClassDecoratorType = getGlobalType("ClassDecorator"); - globalPropertyDecoratorType = getGlobalType("PropertyDecorator"); - globalMethodDecoratorType = getGlobalType("MethodDecorator"); - globalParameterDecoratorType = getGlobalType("ParameterDecorator"); + getGlobalClassDecoratorType = memoize(() => getGlobalType("ClassDecorator")); + getGlobalPropertyDecoratorType = memoize(() => getGlobalType("PropertyDecorator")); + getGlobalMethodDecoratorType = memoize(() => getGlobalType("MethodDecorator")); + getGlobalParameterDecoratorType = memoize(() => getGlobalType("ParameterDecorator")); // If we're in ES6 mode, load the TemplateStringsArray. // Otherwise, default to 'unknown' for the purposes of type checking in LS scenarios. diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 80840068332..6383108b0d6 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -281,6 +281,17 @@ module ts { return result; } + export function memoize(callback: () => T): () => T { + let value: T; + return () => { + if (callback) { + value = callback(); + callback = undefined; + } + return value; + }; + } + function formatStringFromArgs(text: string, args: { [index: number]: any; }, baseIndex?: number): string { baseIndex = baseIndex || 0; diff --git a/tests/baselines/reference/noDefaultLib.errors.txt b/tests/baselines/reference/noDefaultLib.errors.txt index c73f3e0b948..b8f42ba7c33 100644 --- a/tests/baselines/reference/noDefaultLib.errors.txt +++ b/tests/baselines/reference/noDefaultLib.errors.txt @@ -1,19 +1,9 @@ -error TS2318: Cannot find global type 'TypedPropertyDescriptor'. -error TS2318: Cannot find global type 'PropertyDecorator'. -error TS2318: Cannot find global type 'ParameterDecorator'. -error TS2318: Cannot find global type 'MethodDecorator'. error TS2318: Cannot find global type 'IArguments'. -error TS2318: Cannot find global type 'ClassDecorator'. error TS2318: Cannot find global type 'Boolean'. tests/cases/compiler/noDefaultLib.ts(4,11): error TS2317: Global type 'Array' must have 1 type parameter(s). -!!! error TS2318: Cannot find global type 'TypedPropertyDescriptor'. -!!! error TS2318: Cannot find global type 'PropertyDecorator'. -!!! error TS2318: Cannot find global type 'ParameterDecorator'. -!!! error TS2318: Cannot find global type 'MethodDecorator'. !!! error TS2318: Cannot find global type 'IArguments'. -!!! error TS2318: Cannot find global type 'ClassDecorator'. !!! error TS2318: Cannot find global type 'Boolean'. ==== tests/cases/compiler/noDefaultLib.ts (1 errors) ==== /// diff --git a/tests/baselines/reference/parser509698.errors.txt b/tests/baselines/reference/parser509698.errors.txt index 3dd70275e5c..85485dd6501 100644 --- a/tests/baselines/reference/parser509698.errors.txt +++ b/tests/baselines/reference/parser509698.errors.txt @@ -1,31 +1,21 @@ -error TS2318: Cannot find global type 'Number'. -error TS2318: Cannot find global type 'TypedPropertyDescriptor'. -error TS2318: Cannot find global type 'Object'. -error TS2318: Cannot find global type 'Array'. -error TS2318: Cannot find global type 'ClassDecorator'. error TS2318: Cannot find global type 'String'. error TS2318: Cannot find global type 'RegExp'. -error TS2318: Cannot find global type 'PropertyDecorator'. -error TS2318: Cannot find global type 'ParameterDecorator'. +error TS2318: Cannot find global type 'Object'. +error TS2318: Cannot find global type 'Number'. +error TS2318: Cannot find global type 'IArguments'. error TS2318: Cannot find global type 'Function'. error TS2318: Cannot find global type 'Boolean'. -error TS2318: Cannot find global type 'MethodDecorator'. -error TS2318: Cannot find global type 'IArguments'. +error TS2318: Cannot find global type 'Array'. -!!! error TS2318: Cannot find global type 'Number'. -!!! error TS2318: Cannot find global type 'TypedPropertyDescriptor'. -!!! error TS2318: Cannot find global type 'Object'. -!!! error TS2318: Cannot find global type 'Array'. -!!! error TS2318: Cannot find global type 'ClassDecorator'. !!! error TS2318: Cannot find global type 'String'. !!! error TS2318: Cannot find global type 'RegExp'. -!!! error TS2318: Cannot find global type 'PropertyDecorator'. -!!! error TS2318: Cannot find global type 'ParameterDecorator'. +!!! error TS2318: Cannot find global type 'Object'. +!!! error TS2318: Cannot find global type 'Number'. +!!! error TS2318: Cannot find global type 'IArguments'. !!! error TS2318: Cannot find global type 'Function'. !!! error TS2318: Cannot find global type 'Boolean'. -!!! error TS2318: Cannot find global type 'MethodDecorator'. -!!! error TS2318: Cannot find global type 'IArguments'. +!!! error TS2318: Cannot find global type 'Array'. ==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509698.ts (0 errors) ==== ///