mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge remote-tracking branch 'origin/master' into tsserverVS-WIP
This commit is contained in:
@@ -6,3 +6,10 @@ node_js:
|
||||
- '0.10'
|
||||
|
||||
sudo: false
|
||||
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
|
||||
matrix:
|
||||
fast_finish: true
|
||||
|
||||
+32
-3
@@ -694,6 +694,12 @@ gulp.task(nodeServerOutFile, false, [servicesFile], () => {
|
||||
.pipe(gulp.dest(path.dirname(nodeServerOutFile)));
|
||||
});
|
||||
|
||||
import convertMap = require("convert-source-map");
|
||||
import sorcery = require("sorcery");
|
||||
declare module "convert-source-map" {
|
||||
export function fromSource(source: string, largeSource?: boolean): SourceMapConverter;
|
||||
}
|
||||
|
||||
gulp.task("browserify", "Runs browserify on run.js to produce a file suitable for running tests in the browser", [servicesFile], (done) => {
|
||||
const testProject = tsc.createProject("src/harness/tsconfig.json", getCompilerSettings({ outFile: "built/local/bundle.js" }, /*useBuiltCompiler*/ true));
|
||||
return testProject.src()
|
||||
@@ -701,14 +707,37 @@ gulp.task("browserify", "Runs browserify on run.js to produce a file suitable fo
|
||||
.pipe(sourcemaps.init())
|
||||
.pipe(tsc(testProject))
|
||||
.pipe(through2.obj((file, enc, next) => {
|
||||
browserify(intoStream(file.contents))
|
||||
const originalMap = file.sourceMap;
|
||||
const prebundledContent = file.contents.toString();
|
||||
// Make paths absolute to help sorcery deal with all the terrible paths being thrown around
|
||||
originalMap.sources = originalMap.sources.map(s => path.resolve(s));
|
||||
// intoStream (below) makes browserify think the input file is named this, so this is what it puts in the sourcemap
|
||||
originalMap.file = "built/local/_stream_0.js";
|
||||
|
||||
browserify(intoStream(file.contents), { debug: true })
|
||||
.bundle((err, res) => {
|
||||
// assumes file.contents is a Buffer
|
||||
file.contents = res;
|
||||
const maps = JSON.parse(convertMap.fromSource(res.toString(), /*largeSource*/true).toJSON());
|
||||
delete maps.sourceRoot;
|
||||
maps.sources = maps.sources.map(s => path.resolve(s === "_stream_0.js" ? "built/local/_stream_0.js" : s));
|
||||
// Strip browserify's inline comments away (could probably just let sorcery do this, but then we couldn't fix the paths)
|
||||
file.contents = new Buffer(convertMap.removeComments(res.toString()));
|
||||
const chain = sorcery.loadSync("built/local/bundle.js", {
|
||||
content: {
|
||||
"built/local/_stream_0.js": prebundledContent,
|
||||
"built/local/bundle.js": file.contents.toString()
|
||||
},
|
||||
sourcemaps: {
|
||||
"built/local/_stream_0.js": originalMap,
|
||||
"built/local/bundle.js": maps,
|
||||
}
|
||||
});
|
||||
const finalMap = chain.apply();
|
||||
file.sourceMap = finalMap;
|
||||
next(undefined, file);
|
||||
});
|
||||
}))
|
||||
.pipe(sourcemaps.write(".", { includeContent: false, sourceRoot: "../../" }))
|
||||
.pipe(sourcemaps.write(".", { includeContent: false }))
|
||||
.pipe(gulp.dest("."));
|
||||
});
|
||||
|
||||
|
||||
+120
-76
@@ -825,10 +825,17 @@ var ts;
|
||||
return true;
|
||||
}
|
||||
ts.containsPath = containsPath;
|
||||
function startsWith(str, prefix) {
|
||||
return str.lastIndexOf(prefix, 0) === 0;
|
||||
}
|
||||
ts.startsWith = startsWith;
|
||||
function endsWith(str, suffix) {
|
||||
var expectedPos = str.length - suffix.length;
|
||||
return expectedPos >= 0 && str.indexOf(suffix, expectedPos) === expectedPos;
|
||||
}
|
||||
ts.endsWith = endsWith;
|
||||
function fileExtensionIs(path, extension) {
|
||||
var pathLen = path.length;
|
||||
var extLen = extension.length;
|
||||
return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension;
|
||||
return path.length > extension.length && endsWith(path, extension);
|
||||
}
|
||||
ts.fileExtensionIs = fileExtensionIs;
|
||||
function fileExtensionIsAny(path, extensions) {
|
||||
@@ -1093,6 +1100,8 @@ var ts;
|
||||
}
|
||||
ts.objectAllocator = {
|
||||
getNodeConstructor: function () { return Node; },
|
||||
getTokenConstructor: function () { return Node; },
|
||||
getIdentifierConstructor: function () { return Node; },
|
||||
getSourceFileConstructor: function () { return Node; },
|
||||
getSymbolConstructor: function () { return Symbol; },
|
||||
getTypeConstructor: function () { return Type; },
|
||||
@@ -1224,7 +1233,7 @@ var ts;
|
||||
function readDirectory(path, extensions, excludes, includes) {
|
||||
return ts.matchFiles(path, extensions, excludes, includes, false, shell.CurrentDirectory, getAccessibleFileSystemEntries);
|
||||
}
|
||||
return {
|
||||
var wscriptSystem = {
|
||||
args: args,
|
||||
newLine: "\r\n",
|
||||
useCaseSensitiveFileNames: false,
|
||||
@@ -1243,7 +1252,7 @@ var ts;
|
||||
return fso.FolderExists(path);
|
||||
},
|
||||
createDirectory: function (directoryName) {
|
||||
if (!this.directoryExists(directoryName)) {
|
||||
if (!wscriptSystem.directoryExists(directoryName)) {
|
||||
fso.CreateFolder(directoryName);
|
||||
}
|
||||
},
|
||||
@@ -1263,6 +1272,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
};
|
||||
return wscriptSystem;
|
||||
}
|
||||
function getNodeSystem() {
|
||||
var _fs = require("fs");
|
||||
@@ -1435,7 +1445,7 @@ var ts;
|
||||
function getDirectories(path) {
|
||||
return ts.filter(_fs.readdirSync(path), function (p) { return fileSystemEntryExists(ts.combinePaths(path, p), 1); });
|
||||
}
|
||||
return {
|
||||
var nodeSystem = {
|
||||
args: process.argv.slice(2),
|
||||
newLine: _os.EOL,
|
||||
useCaseSensitiveFileNames: useCaseSensitiveFileNames,
|
||||
@@ -1485,7 +1495,7 @@ var ts;
|
||||
fileExists: fileExists,
|
||||
directoryExists: directoryExists,
|
||||
createDirectory: function (directoryName) {
|
||||
if (!this.directoryExists(directoryName)) {
|
||||
if (!nodeSystem.directoryExists(directoryName)) {
|
||||
_fs.mkdirSync(directoryName);
|
||||
}
|
||||
},
|
||||
@@ -1533,6 +1543,7 @@ var ts;
|
||||
return _fs.realpathSync(path);
|
||||
}
|
||||
};
|
||||
return nodeSystem;
|
||||
}
|
||||
function getChakraSystem() {
|
||||
var realpath = ChakraHost.realpath && (function (path) { return ChakraHost.realpath(path); });
|
||||
@@ -2282,8 +2293,8 @@ var ts;
|
||||
Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system: { code: 6131, category: ts.DiagnosticCategory.Error, key: "Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system_6131", message: "Cannot compile modules using option '{0}' unless the '--module' flag is 'amd' or 'system'." },
|
||||
File_name_0_has_a_1_extension_stripping_it: { code: 6132, category: ts.DiagnosticCategory.Message, key: "File_name_0_has_a_1_extension_stripping_it_6132", message: "File name '{0}' has a '{1}' extension - stripping it" },
|
||||
_0_is_declared_but_never_used: { code: 6133, category: ts.DiagnosticCategory.Error, key: "_0_is_declared_but_never_used_6133", message: "'{0}' is declared but never used." },
|
||||
Report_Errors_on_Unused_Locals: { code: 6134, category: ts.DiagnosticCategory.Message, key: "Report_Errors_on_Unused_Locals_6134", message: "Report Errors on Unused Locals." },
|
||||
Report_Errors_on_Unused_Parameters: { code: 6135, category: ts.DiagnosticCategory.Message, key: "Report_Errors_on_Unused_Parameters_6135", message: "Report Errors on Unused Parameters." },
|
||||
Report_errors_on_unused_locals: { code: 6134, category: ts.DiagnosticCategory.Message, key: "Report_errors_on_unused_locals_6134", message: "Report errors on unused locals." },
|
||||
Report_errors_on_unused_parameters: { code: 6135, category: ts.DiagnosticCategory.Message, key: "Report_errors_on_unused_parameters_6135", message: "Report errors on unused parameters." },
|
||||
The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files: { code: 6136, category: ts.DiagnosticCategory.Message, key: "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136", message: "The maximum dependency depth to search under node_modules and load JavaScript files" },
|
||||
No_types_specified_in_package_json_but_allowJs_is_set_so_returning_main_value_of_0: { code: 6137, category: ts.DiagnosticCategory.Message, key: "No_types_specified_in_package_json_but_allowJs_is_set_so_returning_main_value_of_0_6137", message: "No types specified in 'package.json' but 'allowJs' is set, so returning 'main' value of '{0}'" },
|
||||
Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_an_1_type_7005", message: "Variable '{0}' implicitly has an '{1}' type." },
|
||||
@@ -4836,7 +4847,7 @@ var ts;
|
||||
}
|
||||
ts.isExpression = isExpression;
|
||||
function isExternalModuleNameRelative(moduleName) {
|
||||
return moduleName.substr(0, 2) === "./" || moduleName.substr(0, 3) === "../" || moduleName.substr(0, 2) === ".\\" || moduleName.substr(0, 3) === "..\\";
|
||||
return /^\.\.?($|[\\/])/.test(moduleName);
|
||||
}
|
||||
ts.isExternalModuleNameRelative = isExternalModuleNameRelative;
|
||||
function isInstantiatedModule(node, preserveConstEnums) {
|
||||
@@ -6344,25 +6355,24 @@ var ts;
|
||||
return node.flags & 92 && node.parent.kind === 148 && ts.isClassLike(node.parent.parent);
|
||||
}
|
||||
ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration;
|
||||
function startsWith(str, prefix) {
|
||||
return str.lastIndexOf(prefix, 0) === 0;
|
||||
}
|
||||
ts.startsWith = startsWith;
|
||||
function endsWith(str, suffix) {
|
||||
var expectedPos = str.length - suffix.length;
|
||||
return str.indexOf(suffix, expectedPos) === expectedPos;
|
||||
}
|
||||
ts.endsWith = endsWith;
|
||||
})(ts || (ts = {}));
|
||||
var ts;
|
||||
(function (ts) {
|
||||
ts.parseTime = 0;
|
||||
var NodeConstructor;
|
||||
var TokenConstructor;
|
||||
var IdentifierConstructor;
|
||||
var SourceFileConstructor;
|
||||
function createNode(kind, pos, end) {
|
||||
if (kind === 256) {
|
||||
return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end);
|
||||
}
|
||||
else if (kind === 69) {
|
||||
return new (IdentifierConstructor || (IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor()))(kind, pos, end);
|
||||
}
|
||||
else if (kind < 139) {
|
||||
return new (TokenConstructor || (TokenConstructor = ts.objectAllocator.getTokenConstructor()))(kind, pos, end);
|
||||
}
|
||||
else {
|
||||
return new (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor()))(kind, pos, end);
|
||||
}
|
||||
@@ -6785,6 +6795,8 @@ var ts;
|
||||
var scanner = ts.createScanner(2, true);
|
||||
var disallowInAndDecoratorContext = 4194304 | 16777216;
|
||||
var NodeConstructor;
|
||||
var TokenConstructor;
|
||||
var IdentifierConstructor;
|
||||
var SourceFileConstructor;
|
||||
var sourceFile;
|
||||
var parseDiagnostics;
|
||||
@@ -6810,6 +6822,8 @@ var ts;
|
||||
}
|
||||
function initializeState(fileName, _sourceText, languageVersion, _syntaxCursor, scriptKind) {
|
||||
NodeConstructor = ts.objectAllocator.getNodeConstructor();
|
||||
TokenConstructor = ts.objectAllocator.getTokenConstructor();
|
||||
IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor();
|
||||
SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor();
|
||||
sourceText = _sourceText;
|
||||
syntaxCursor = _syntaxCursor;
|
||||
@@ -7116,7 +7130,9 @@ var ts;
|
||||
if (!(pos >= 0)) {
|
||||
pos = scanner.getStartPos();
|
||||
}
|
||||
return new NodeConstructor(kind, pos, pos);
|
||||
return kind >= 139 ? new NodeConstructor(kind, pos, pos) :
|
||||
kind === 69 ? new IdentifierConstructor(kind, pos, pos) :
|
||||
new TokenConstructor(kind, pos, pos);
|
||||
}
|
||||
function finishNode(node, end) {
|
||||
node.end = end === undefined ? scanner.getStartPos() : end;
|
||||
@@ -10892,6 +10908,9 @@ var ts;
|
||||
case 55:
|
||||
if (canParseTag) {
|
||||
parentTagTerminated = !tryParseChildTag(jsDocTypeLiteral);
|
||||
if (!parentTagTerminated) {
|
||||
resumePos = scanner.getStartPos();
|
||||
}
|
||||
}
|
||||
seenAsterisk = false;
|
||||
break;
|
||||
@@ -15418,17 +15437,18 @@ var ts;
|
||||
if (declaration.kind === 235) {
|
||||
return links.type = checkExpression(declaration.expression);
|
||||
}
|
||||
if (declaration.flags & 134217728 && declaration.kind === 280 && declaration.typeExpression) {
|
||||
return links.type = getTypeFromTypeNode(declaration.typeExpression.type);
|
||||
}
|
||||
if (!pushTypeResolution(symbol, 0)) {
|
||||
return unknownType;
|
||||
}
|
||||
var type = undefined;
|
||||
if (declaration.kind === 187) {
|
||||
type = getUnionType(ts.map(symbol.declarations, function (decl) { return checkExpressionCached(decl.right); }));
|
||||
}
|
||||
else if (declaration.kind === 172) {
|
||||
if (declaration.parent.kind === 187) {
|
||||
type = checkExpressionCached(declaration.parent.right);
|
||||
}
|
||||
if (declaration.kind === 187 ||
|
||||
declaration.kind === 172 && declaration.parent.kind === 187) {
|
||||
type = getUnionType(ts.map(symbol.declarations, function (decl) { return decl.kind === 187 ?
|
||||
checkExpressionCached(decl.right) :
|
||||
checkExpressionCached(decl.parent.right); }));
|
||||
}
|
||||
if (type === undefined) {
|
||||
type = getWidenedTypeForVariableLikeDeclaration(declaration, true);
|
||||
@@ -21935,7 +21955,7 @@ var ts;
|
||||
function getInferredClassType(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
if (!links.inferredClassType) {
|
||||
links.inferredClassType = createAnonymousType(undefined, symbol.members, emptyArray, emptyArray, undefined, undefined);
|
||||
links.inferredClassType = createAnonymousType(symbol, symbol.members, emptyArray, emptyArray, undefined, undefined);
|
||||
}
|
||||
return links.inferredClassType;
|
||||
}
|
||||
@@ -23155,7 +23175,7 @@ var ts;
|
||||
checkAsyncFunctionReturnType(node);
|
||||
}
|
||||
}
|
||||
if (!node.body) {
|
||||
if (noUnusedIdentifiers && !node.body) {
|
||||
checkUnusedTypeParameters(node);
|
||||
}
|
||||
}
|
||||
@@ -24051,6 +24071,7 @@ var ts;
|
||||
var parameter = local_1.valueDeclaration;
|
||||
if (compilerOptions.noUnusedParameters &&
|
||||
!ts.isParameterPropertyDeclaration(parameter) &&
|
||||
!parameterIsThisKeyword(parameter) &&
|
||||
!parameterNameStartsWithUnderscore(parameter)) {
|
||||
error(local_1.valueDeclaration.name, ts.Diagnostics._0_is_declared_but_never_used, local_1.name);
|
||||
}
|
||||
@@ -24066,6 +24087,9 @@ var ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
function parameterIsThisKeyword(parameter) {
|
||||
return parameter.name && parameter.name.originalKeywordKind === 97;
|
||||
}
|
||||
function parameterNameStartsWithUnderscore(parameter) {
|
||||
return parameter.name && parameter.name.kind === 69 && parameter.name.text.charCodeAt(0) === 95;
|
||||
}
|
||||
@@ -24094,9 +24118,14 @@ var ts;
|
||||
function checkUnusedTypeParameters(node) {
|
||||
if (compilerOptions.noUnusedLocals && !ts.isInAmbientContext(node)) {
|
||||
if (node.typeParameters) {
|
||||
var symbol = getSymbolOfNode(node);
|
||||
var lastDeclaration = symbol && symbol.declarations && ts.lastOrUndefined(symbol.declarations);
|
||||
if (lastDeclaration !== node) {
|
||||
return;
|
||||
}
|
||||
for (var _i = 0, _a = node.typeParameters; _i < _a.length; _i++) {
|
||||
var typeParameter = _a[_i];
|
||||
if (!typeParameter.symbol.isReferenced) {
|
||||
if (!getMergedSymbol(typeParameter.symbol).isReferenced) {
|
||||
error(typeParameter.name, ts.Diagnostics._0_is_declared_but_never_used, typeParameter.symbol.name);
|
||||
}
|
||||
}
|
||||
@@ -25173,7 +25202,7 @@ var ts;
|
||||
ts.forEach(node.members, checkSourceElement);
|
||||
if (produceDiagnostics) {
|
||||
checkTypeForDuplicateIndexSignatures(node);
|
||||
checkUnusedTypeParameters(node);
|
||||
registerForUnusedIdentifiersCheck(node);
|
||||
}
|
||||
}
|
||||
function checkTypeAliasDeclaration(node) {
|
||||
@@ -29896,7 +29925,7 @@ var ts;
|
||||
writeLine();
|
||||
var sourceMappingURL = sourceMap.getSourceMappingURL();
|
||||
if (sourceMappingURL) {
|
||||
write("//# sourceMappingURL=" + sourceMappingURL);
|
||||
write("//# " + "sourceMappingURL" + "=" + sourceMappingURL);
|
||||
}
|
||||
writeEmittedFiles(writer.getText(), jsFilePath, sourceMapFilePath, compilerOptions.emitBOM, sourceFiles);
|
||||
sourceMap.reset();
|
||||
@@ -33546,13 +33575,13 @@ var ts;
|
||||
if (isES6ExportedDeclaration(node) && !(node.flags & 512) && decoratedClassAlias === undefined) {
|
||||
write("export ");
|
||||
}
|
||||
if (!isHoistedDeclarationInSystemModule) {
|
||||
write("let ");
|
||||
}
|
||||
if (decoratedClassAlias !== undefined) {
|
||||
write("" + decoratedClassAlias);
|
||||
write("let " + decoratedClassAlias);
|
||||
}
|
||||
else {
|
||||
if (!isHoistedDeclarationInSystemModule) {
|
||||
write("let ");
|
||||
}
|
||||
emitDeclarationName(node);
|
||||
}
|
||||
write(" = ");
|
||||
@@ -35796,7 +35825,7 @@ var ts;
|
||||
ts.emitTime = 0;
|
||||
ts.ioReadTime = 0;
|
||||
ts.ioWriteTime = 0;
|
||||
ts.version = "2.0.0";
|
||||
ts.version = "2.1.0";
|
||||
var emptyArray = [];
|
||||
var defaultTypeRoots = ["node_modules/@types"];
|
||||
function findConfigFile(searchPath, fileExists) {
|
||||
@@ -35876,12 +35905,7 @@ var ts;
|
||||
return { resolvedModule: resolvedFileName ? { resolvedFileName: resolvedFileName, isExternalLibraryImport: isExternalLibraryImport } : undefined, failedLookupLocations: failedLookupLocations };
|
||||
}
|
||||
function moduleHasNonRelativeName(moduleName) {
|
||||
if (ts.isRootedDiskPath(moduleName)) {
|
||||
return false;
|
||||
}
|
||||
var i = moduleName.lastIndexOf("./", 1);
|
||||
var startsWithDotSlashOrDotDotSlash = i === 0 || (i === 1 && moduleName.charCodeAt(0) === 46);
|
||||
return !startsWithDotSlashOrDotDotSlash;
|
||||
return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName));
|
||||
}
|
||||
function tryReadTypesSection(packageJsonPath, baseDirectory, state) {
|
||||
var jsonContent;
|
||||
@@ -36537,6 +36561,22 @@ var ts;
|
||||
return ts.sortAndDeduplicateDiagnostics(diagnostics);
|
||||
}
|
||||
ts.getPreEmitDiagnostics = getPreEmitDiagnostics;
|
||||
function formatDiagnostics(diagnostics, host) {
|
||||
var output = "";
|
||||
for (var _i = 0, diagnostics_1 = diagnostics; _i < diagnostics_1.length; _i++) {
|
||||
var diagnostic = diagnostics_1[_i];
|
||||
if (diagnostic.file) {
|
||||
var _a = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start), line = _a.line, character = _a.character;
|
||||
var fileName = diagnostic.file.fileName;
|
||||
var relativeFileName = ts.convertToRelativePath(fileName, host.getCurrentDirectory(), function (fileName) { return host.getCanonicalFileName(fileName); });
|
||||
output += relativeFileName + "(" + (line + 1) + "," + (character + 1) + "): ";
|
||||
}
|
||||
var category = ts.DiagnosticCategory[diagnostic.category].toLowerCase();
|
||||
output += category + " TS" + diagnostic.code + ": " + flattenDiagnosticMessageText(diagnostic.messageText, host.getNewLine()) + host.getNewLine();
|
||||
}
|
||||
return output;
|
||||
}
|
||||
ts.formatDiagnostics = formatDiagnostics;
|
||||
function flattenDiagnosticMessageText(messageText, newLine) {
|
||||
if (typeof messageText === "string") {
|
||||
return messageText;
|
||||
@@ -36612,7 +36652,7 @@ var ts;
|
||||
var resolvedTypeReferenceDirectives = {};
|
||||
var fileProcessingDiagnostics = ts.createDiagnosticCollection();
|
||||
var maxNodeModulesJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 2;
|
||||
var currentNodeModulesJsDepth = 0;
|
||||
var currentNodeModulesDepth = 0;
|
||||
var modulesWithElidedImports = {};
|
||||
var sourceFilesFoundSearchingNodeModules = {};
|
||||
var start = new Date().getTime();
|
||||
@@ -36836,8 +36876,7 @@ var ts;
|
||||
return noDiagnosticsTypeChecker || (noDiagnosticsTypeChecker = ts.createTypeChecker(program, false));
|
||||
}
|
||||
function emit(sourceFile, writeFileCallback, cancellationToken) {
|
||||
var _this = this;
|
||||
return runWithCancellationToken(function () { return emitWorker(_this, sourceFile, writeFileCallback, cancellationToken); });
|
||||
return runWithCancellationToken(function () { return emitWorker(program, sourceFile, writeFileCallback, cancellationToken); });
|
||||
}
|
||||
function isEmitBlocked(emitFileName) {
|
||||
return hasEmitBlockingDiagnostics.contains(ts.toPath(emitFileName, currentDirectory, getCanonicalFileName));
|
||||
@@ -37244,8 +37283,17 @@ var ts;
|
||||
if (file_1 && options.forceConsistentCasingInFileNames && ts.getNormalizedAbsolutePath(file_1.fileName, currentDirectory) !== ts.getNormalizedAbsolutePath(fileName, currentDirectory)) {
|
||||
reportFileNamesDifferOnlyInCasingError(fileName, file_1.fileName, refFile, refPos, refEnd);
|
||||
}
|
||||
if (file_1 && ts.lookUp(modulesWithElidedImports, file_1.path)) {
|
||||
if (currentNodeModulesJsDepth < maxNodeModulesJsDepth) {
|
||||
if (file_1 && ts.lookUp(sourceFilesFoundSearchingNodeModules, file_1.path) && currentNodeModulesDepth == 0) {
|
||||
sourceFilesFoundSearchingNodeModules[file_1.path] = false;
|
||||
if (!options.noResolve) {
|
||||
processReferencedFiles(file_1, ts.getDirectoryPath(fileName), isDefaultLib);
|
||||
processTypeReferenceDirectives(file_1);
|
||||
}
|
||||
modulesWithElidedImports[file_1.path] = false;
|
||||
processImportedModules(file_1, ts.getDirectoryPath(fileName));
|
||||
}
|
||||
else if (file_1 && ts.lookUp(modulesWithElidedImports, file_1.path)) {
|
||||
if (currentNodeModulesDepth < maxNodeModulesJsDepth) {
|
||||
modulesWithElidedImports[file_1.path] = false;
|
||||
processImportedModules(file_1, ts.getDirectoryPath(fileName));
|
||||
}
|
||||
@@ -37262,6 +37310,7 @@ var ts;
|
||||
});
|
||||
filesByName.set(path, file);
|
||||
if (file) {
|
||||
sourceFilesFoundSearchingNodeModules[path] = (currentNodeModulesDepth > 0);
|
||||
file.path = path;
|
||||
if (host.useCaseSensitiveFileNames()) {
|
||||
var existingFile = filesByNameIgnoreCase.get(path);
|
||||
@@ -37362,12 +37411,9 @@ var ts;
|
||||
var isFromNodeModulesSearch = resolution && resolution.isExternalLibraryImport;
|
||||
var isJsFileFromNodeModules = isFromNodeModulesSearch && ts.hasJavaScriptFileExtension(resolution.resolvedFileName);
|
||||
if (isFromNodeModulesSearch) {
|
||||
sourceFilesFoundSearchingNodeModules[resolvedPath] = true;
|
||||
currentNodeModulesDepth++;
|
||||
}
|
||||
if (isJsFileFromNodeModules) {
|
||||
currentNodeModulesJsDepth++;
|
||||
}
|
||||
var elideImport = isJsFileFromNodeModules && currentNodeModulesJsDepth > maxNodeModulesJsDepth;
|
||||
var elideImport = isJsFileFromNodeModules && currentNodeModulesDepth > maxNodeModulesJsDepth;
|
||||
var shouldAddFile = resolution && !options.noResolve && i < file.imports.length && !elideImport;
|
||||
if (elideImport) {
|
||||
modulesWithElidedImports[file.path] = true;
|
||||
@@ -37375,8 +37421,8 @@ var ts;
|
||||
else if (shouldAddFile) {
|
||||
findSourceFile(resolution.resolvedFileName, resolvedPath, false, false, file, ts.skipTrivia(file.text, file.imports[i].pos), file.imports[i].end);
|
||||
}
|
||||
if (isJsFileFromNodeModules) {
|
||||
currentNodeModulesJsDepth--;
|
||||
if (isFromNodeModulesSearch) {
|
||||
currentNodeModulesDepth--;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -37695,12 +37741,12 @@ var ts;
|
||||
{
|
||||
name: "noUnusedLocals",
|
||||
type: "boolean",
|
||||
description: ts.Diagnostics.Report_Errors_on_Unused_Locals
|
||||
description: ts.Diagnostics.Report_errors_on_unused_locals
|
||||
},
|
||||
{
|
||||
name: "noUnusedParameters",
|
||||
type: "boolean",
|
||||
description: ts.Diagnostics.Report_Errors_on_Unused_Parameters
|
||||
description: ts.Diagnostics.Report_errors_on_unused_parameters
|
||||
},
|
||||
{
|
||||
name: "noLib",
|
||||
@@ -38479,10 +38525,18 @@ var ts;
|
||||
})(ts || (ts = {}));
|
||||
var ts;
|
||||
(function (ts) {
|
||||
var reportDiagnostic = reportDiagnosticSimply;
|
||||
var defaultFormatDiagnosticsHost = {
|
||||
getCurrentDirectory: function () { return ts.sys.getCurrentDirectory(); },
|
||||
getNewLine: function () { return ts.sys.newLine; },
|
||||
getCanonicalFileName: ts.createGetCanonicalFileName(ts.sys.useCaseSensitiveFileNames)
|
||||
};
|
||||
var reportDiagnosticWorker = reportDiagnosticSimply;
|
||||
function reportDiagnostic(diagnostic, host) {
|
||||
reportDiagnosticWorker(diagnostic, host || defaultFormatDiagnosticsHost);
|
||||
}
|
||||
function reportDiagnostics(diagnostics, host) {
|
||||
for (var _i = 0, diagnostics_1 = diagnostics; _i < diagnostics_1.length; _i++) {
|
||||
var diagnostic = diagnostics_1[_i];
|
||||
for (var _i = 0, diagnostics_2 = diagnostics; _i < diagnostics_2.length; _i++) {
|
||||
var diagnostic = diagnostics_2[_i];
|
||||
reportDiagnostic(diagnostic, host);
|
||||
}
|
||||
}
|
||||
@@ -38553,19 +38607,8 @@ var ts;
|
||||
var diagnostic = ts.createCompilerDiagnostic.apply(undefined, arguments);
|
||||
return diagnostic.messageText;
|
||||
}
|
||||
function getRelativeFileName(fileName, host) {
|
||||
return host ? ts.convertToRelativePath(fileName, host.getCurrentDirectory(), function (fileName) { return host.getCanonicalFileName(fileName); }) : fileName;
|
||||
}
|
||||
function reportDiagnosticSimply(diagnostic, host) {
|
||||
var output = "";
|
||||
if (diagnostic.file) {
|
||||
var _a = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start), line = _a.line, character = _a.character;
|
||||
var relativeFileName = getRelativeFileName(diagnostic.file.fileName, host);
|
||||
output += relativeFileName + "(" + (line + 1) + "," + (character + 1) + "): ";
|
||||
}
|
||||
var category = ts.DiagnosticCategory[diagnostic.category].toLowerCase();
|
||||
output += category + " TS" + diagnostic.code + ": " + ts.flattenDiagnosticMessageText(diagnostic.messageText, ts.sys.newLine) + ts.sys.newLine;
|
||||
ts.sys.write(output);
|
||||
ts.sys.write(ts.formatDiagnostics([diagnostic], host));
|
||||
}
|
||||
var redForegroundEscapeSequence = "\u001b[91m";
|
||||
var yellowForegroundEscapeSequence = "\u001b[93m";
|
||||
@@ -38590,7 +38633,7 @@ var ts;
|
||||
var _a = ts.getLineAndCharacterOfPosition(file, start), firstLine = _a.line, firstLineChar = _a.character;
|
||||
var _b = ts.getLineAndCharacterOfPosition(file, start + length_3), lastLine = _b.line, lastLineChar = _b.character;
|
||||
var lastLineInFile = ts.getLineAndCharacterOfPosition(file, file.text.length).line;
|
||||
var relativeFileName = getRelativeFileName(file.fileName, host);
|
||||
var relativeFileName = host ? ts.convertToRelativePath(file.fileName, host.getCurrentDirectory(), function (fileName) { return host.getCanonicalFileName(fileName); }) : file.fileName;
|
||||
var hasMoreThanFiveLines = (lastLine - firstLine) >= 4;
|
||||
var gutterWidth = (lastLine + 1 + "").length;
|
||||
if (hasMoreThanFiveLines) {
|
||||
@@ -38779,7 +38822,8 @@ var ts;
|
||||
ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
return;
|
||||
}
|
||||
var configParseResult = ts.parseJsonConfigFileContent(configObject, ts.sys, ts.getNormalizedAbsolutePath(ts.getDirectoryPath(configFileName), ts.sys.getCurrentDirectory()), commandLine.options, configFileName);
|
||||
var cwd = ts.sys.getCurrentDirectory();
|
||||
var configParseResult = ts.parseJsonConfigFileContent(configObject, ts.sys, ts.getNormalizedAbsolutePath(ts.getDirectoryPath(configFileName), cwd), commandLine.options, ts.getNormalizedAbsolutePath(configFileName, cwd));
|
||||
if (configParseResult.errors.length > 0) {
|
||||
reportDiagnostics(configParseResult.errors, undefined);
|
||||
ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
@@ -38816,7 +38860,7 @@ var ts;
|
||||
compilerHost.fileExists = cachedFileExists;
|
||||
}
|
||||
if (compilerOptions.pretty) {
|
||||
reportDiagnostic = reportDiagnosticWithColorAndContext;
|
||||
reportDiagnosticWorker = reportDiagnosticWithColorAndContext;
|
||||
}
|
||||
cachedExistingFiles = {};
|
||||
var compileResult = compile(rootFileNames, compilerOptions, compilerHost);
|
||||
@@ -38979,7 +39023,7 @@ var ts;
|
||||
output += ts.sys.newLine + ts.sys.newLine;
|
||||
var padding = makePadding(marginLength);
|
||||
output += getDiagnosticText(ts.Diagnostics.Examples_Colon_0, makePadding(marginLength - examplesLength) + "tsc hello.ts") + ts.sys.newLine;
|
||||
output += padding + "tsc --out file.js file.ts" + ts.sys.newLine;
|
||||
output += padding + "tsc --outFile file.js file.ts" + ts.sys.newLine;
|
||||
output += padding + "tsc @args.txt" + ts.sys.newLine;
|
||||
output += ts.sys.newLine;
|
||||
output += getDiagnosticText(ts.Diagnostics.Options_Colon) + ts.sys.newLine;
|
||||
|
||||
+193
-77
@@ -830,10 +830,17 @@ var ts;
|
||||
return true;
|
||||
}
|
||||
ts.containsPath = containsPath;
|
||||
function startsWith(str, prefix) {
|
||||
return str.lastIndexOf(prefix, 0) === 0;
|
||||
}
|
||||
ts.startsWith = startsWith;
|
||||
function endsWith(str, suffix) {
|
||||
var expectedPos = str.length - suffix.length;
|
||||
return expectedPos >= 0 && str.indexOf(suffix, expectedPos) === expectedPos;
|
||||
}
|
||||
ts.endsWith = endsWith;
|
||||
function fileExtensionIs(path, extension) {
|
||||
var pathLen = path.length;
|
||||
var extLen = extension.length;
|
||||
return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension;
|
||||
return path.length > extension.length && endsWith(path, extension);
|
||||
}
|
||||
ts.fileExtensionIs = fileExtensionIs;
|
||||
function fileExtensionIsAny(path, extensions) {
|
||||
@@ -1098,6 +1105,8 @@ var ts;
|
||||
}
|
||||
ts.objectAllocator = {
|
||||
getNodeConstructor: function () { return Node; },
|
||||
getTokenConstructor: function () { return Node; },
|
||||
getIdentifierConstructor: function () { return Node; },
|
||||
getSourceFileConstructor: function () { return Node; },
|
||||
getSymbolConstructor: function () { return Symbol; },
|
||||
getTypeConstructor: function () { return Type; },
|
||||
@@ -1229,7 +1238,7 @@ var ts;
|
||||
function readDirectory(path, extensions, excludes, includes) {
|
||||
return ts.matchFiles(path, extensions, excludes, includes, false, shell.CurrentDirectory, getAccessibleFileSystemEntries);
|
||||
}
|
||||
return {
|
||||
var wscriptSystem = {
|
||||
args: args,
|
||||
newLine: "\r\n",
|
||||
useCaseSensitiveFileNames: false,
|
||||
@@ -1248,7 +1257,7 @@ var ts;
|
||||
return fso.FolderExists(path);
|
||||
},
|
||||
createDirectory: function (directoryName) {
|
||||
if (!this.directoryExists(directoryName)) {
|
||||
if (!wscriptSystem.directoryExists(directoryName)) {
|
||||
fso.CreateFolder(directoryName);
|
||||
}
|
||||
},
|
||||
@@ -1268,6 +1277,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
};
|
||||
return wscriptSystem;
|
||||
}
|
||||
function getNodeSystem() {
|
||||
var _fs = require("fs");
|
||||
@@ -1440,7 +1450,7 @@ var ts;
|
||||
function getDirectories(path) {
|
||||
return ts.filter(_fs.readdirSync(path), function (p) { return fileSystemEntryExists(ts.combinePaths(path, p), 1); });
|
||||
}
|
||||
return {
|
||||
var nodeSystem = {
|
||||
args: process.argv.slice(2),
|
||||
newLine: _os.EOL,
|
||||
useCaseSensitiveFileNames: useCaseSensitiveFileNames,
|
||||
@@ -1490,7 +1500,7 @@ var ts;
|
||||
fileExists: fileExists,
|
||||
directoryExists: directoryExists,
|
||||
createDirectory: function (directoryName) {
|
||||
if (!this.directoryExists(directoryName)) {
|
||||
if (!nodeSystem.directoryExists(directoryName)) {
|
||||
_fs.mkdirSync(directoryName);
|
||||
}
|
||||
},
|
||||
@@ -1538,6 +1548,7 @@ var ts;
|
||||
return _fs.realpathSync(path);
|
||||
}
|
||||
};
|
||||
return nodeSystem;
|
||||
}
|
||||
function getChakraSystem() {
|
||||
var realpath = ChakraHost.realpath && (function (path) { return ChakraHost.realpath(path); });
|
||||
@@ -2287,8 +2298,8 @@ var ts;
|
||||
Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system: { code: 6131, category: ts.DiagnosticCategory.Error, key: "Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system_6131", message: "Cannot compile modules using option '{0}' unless the '--module' flag is 'amd' or 'system'." },
|
||||
File_name_0_has_a_1_extension_stripping_it: { code: 6132, category: ts.DiagnosticCategory.Message, key: "File_name_0_has_a_1_extension_stripping_it_6132", message: "File name '{0}' has a '{1}' extension - stripping it" },
|
||||
_0_is_declared_but_never_used: { code: 6133, category: ts.DiagnosticCategory.Error, key: "_0_is_declared_but_never_used_6133", message: "'{0}' is declared but never used." },
|
||||
Report_Errors_on_Unused_Locals: { code: 6134, category: ts.DiagnosticCategory.Message, key: "Report_Errors_on_Unused_Locals_6134", message: "Report Errors on Unused Locals." },
|
||||
Report_Errors_on_Unused_Parameters: { code: 6135, category: ts.DiagnosticCategory.Message, key: "Report_Errors_on_Unused_Parameters_6135", message: "Report Errors on Unused Parameters." },
|
||||
Report_errors_on_unused_locals: { code: 6134, category: ts.DiagnosticCategory.Message, key: "Report_errors_on_unused_locals_6134", message: "Report errors on unused locals." },
|
||||
Report_errors_on_unused_parameters: { code: 6135, category: ts.DiagnosticCategory.Message, key: "Report_errors_on_unused_parameters_6135", message: "Report errors on unused parameters." },
|
||||
The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files: { code: 6136, category: ts.DiagnosticCategory.Message, key: "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136", message: "The maximum dependency depth to search under node_modules and load JavaScript files" },
|
||||
No_types_specified_in_package_json_but_allowJs_is_set_so_returning_main_value_of_0: { code: 6137, category: ts.DiagnosticCategory.Message, key: "No_types_specified_in_package_json_but_allowJs_is_set_so_returning_main_value_of_0_6137", message: "No types specified in 'package.json' but 'allowJs' is set, so returning 'main' value of '{0}'" },
|
||||
Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_an_1_type_7005", message: "Variable '{0}' implicitly has an '{1}' type." },
|
||||
@@ -3966,12 +3977,12 @@ var ts;
|
||||
{
|
||||
name: "noUnusedLocals",
|
||||
type: "boolean",
|
||||
description: ts.Diagnostics.Report_Errors_on_Unused_Locals
|
||||
description: ts.Diagnostics.Report_errors_on_unused_locals
|
||||
},
|
||||
{
|
||||
name: "noUnusedParameters",
|
||||
type: "boolean",
|
||||
description: ts.Diagnostics.Report_Errors_on_Unused_Parameters
|
||||
description: ts.Diagnostics.Report_errors_on_unused_parameters
|
||||
},
|
||||
{
|
||||
name: "noLib",
|
||||
@@ -5754,7 +5765,7 @@ var ts;
|
||||
}
|
||||
ts.isExpression = isExpression;
|
||||
function isExternalModuleNameRelative(moduleName) {
|
||||
return moduleName.substr(0, 2) === "./" || moduleName.substr(0, 3) === "../" || moduleName.substr(0, 2) === ".\\" || moduleName.substr(0, 3) === "..\\";
|
||||
return /^\.\.?($|[\\/])/.test(moduleName);
|
||||
}
|
||||
ts.isExternalModuleNameRelative = isExternalModuleNameRelative;
|
||||
function isInstantiatedModule(node, preserveConstEnums) {
|
||||
@@ -7262,25 +7273,24 @@ var ts;
|
||||
return node.flags & 92 && node.parent.kind === 148 && ts.isClassLike(node.parent.parent);
|
||||
}
|
||||
ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration;
|
||||
function startsWith(str, prefix) {
|
||||
return str.lastIndexOf(prefix, 0) === 0;
|
||||
}
|
||||
ts.startsWith = startsWith;
|
||||
function endsWith(str, suffix) {
|
||||
var expectedPos = str.length - suffix.length;
|
||||
return str.indexOf(suffix, expectedPos) === expectedPos;
|
||||
}
|
||||
ts.endsWith = endsWith;
|
||||
})(ts || (ts = {}));
|
||||
var ts;
|
||||
(function (ts) {
|
||||
ts.parseTime = 0;
|
||||
var NodeConstructor;
|
||||
var TokenConstructor;
|
||||
var IdentifierConstructor;
|
||||
var SourceFileConstructor;
|
||||
function createNode(kind, pos, end) {
|
||||
if (kind === 256) {
|
||||
return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end);
|
||||
}
|
||||
else if (kind === 69) {
|
||||
return new (IdentifierConstructor || (IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor()))(kind, pos, end);
|
||||
}
|
||||
else if (kind < 139) {
|
||||
return new (TokenConstructor || (TokenConstructor = ts.objectAllocator.getTokenConstructor()))(kind, pos, end);
|
||||
}
|
||||
else {
|
||||
return new (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor()))(kind, pos, end);
|
||||
}
|
||||
@@ -7703,6 +7713,8 @@ var ts;
|
||||
var scanner = ts.createScanner(2, true);
|
||||
var disallowInAndDecoratorContext = 4194304 | 16777216;
|
||||
var NodeConstructor;
|
||||
var TokenConstructor;
|
||||
var IdentifierConstructor;
|
||||
var SourceFileConstructor;
|
||||
var sourceFile;
|
||||
var parseDiagnostics;
|
||||
@@ -7728,6 +7740,8 @@ var ts;
|
||||
}
|
||||
function initializeState(fileName, _sourceText, languageVersion, _syntaxCursor, scriptKind) {
|
||||
NodeConstructor = ts.objectAllocator.getNodeConstructor();
|
||||
TokenConstructor = ts.objectAllocator.getTokenConstructor();
|
||||
IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor();
|
||||
SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor();
|
||||
sourceText = _sourceText;
|
||||
syntaxCursor = _syntaxCursor;
|
||||
@@ -8034,7 +8048,9 @@ var ts;
|
||||
if (!(pos >= 0)) {
|
||||
pos = scanner.getStartPos();
|
||||
}
|
||||
return new NodeConstructor(kind, pos, pos);
|
||||
return kind >= 139 ? new NodeConstructor(kind, pos, pos) :
|
||||
kind === 69 ? new IdentifierConstructor(kind, pos, pos) :
|
||||
new TokenConstructor(kind, pos, pos);
|
||||
}
|
||||
function finishNode(node, end) {
|
||||
node.end = end === undefined ? scanner.getStartPos() : end;
|
||||
@@ -11810,6 +11826,9 @@ var ts;
|
||||
case 55:
|
||||
if (canParseTag) {
|
||||
parentTagTerminated = !tryParseChildTag(jsDocTypeLiteral);
|
||||
if (!parentTagTerminated) {
|
||||
resumePos = scanner.getStartPos();
|
||||
}
|
||||
}
|
||||
seenAsterisk = false;
|
||||
break;
|
||||
@@ -16336,17 +16355,18 @@ var ts;
|
||||
if (declaration.kind === 235) {
|
||||
return links.type = checkExpression(declaration.expression);
|
||||
}
|
||||
if (declaration.flags & 134217728 && declaration.kind === 280 && declaration.typeExpression) {
|
||||
return links.type = getTypeFromTypeNode(declaration.typeExpression.type);
|
||||
}
|
||||
if (!pushTypeResolution(symbol, 0)) {
|
||||
return unknownType;
|
||||
}
|
||||
var type = undefined;
|
||||
if (declaration.kind === 187) {
|
||||
type = getUnionType(ts.map(symbol.declarations, function (decl) { return checkExpressionCached(decl.right); }));
|
||||
}
|
||||
else if (declaration.kind === 172) {
|
||||
if (declaration.parent.kind === 187) {
|
||||
type = checkExpressionCached(declaration.parent.right);
|
||||
}
|
||||
if (declaration.kind === 187 ||
|
||||
declaration.kind === 172 && declaration.parent.kind === 187) {
|
||||
type = getUnionType(ts.map(symbol.declarations, function (decl) { return decl.kind === 187 ?
|
||||
checkExpressionCached(decl.right) :
|
||||
checkExpressionCached(decl.parent.right); }));
|
||||
}
|
||||
if (type === undefined) {
|
||||
type = getWidenedTypeForVariableLikeDeclaration(declaration, true);
|
||||
@@ -22853,7 +22873,7 @@ var ts;
|
||||
function getInferredClassType(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
if (!links.inferredClassType) {
|
||||
links.inferredClassType = createAnonymousType(undefined, symbol.members, emptyArray, emptyArray, undefined, undefined);
|
||||
links.inferredClassType = createAnonymousType(symbol, symbol.members, emptyArray, emptyArray, undefined, undefined);
|
||||
}
|
||||
return links.inferredClassType;
|
||||
}
|
||||
@@ -24073,7 +24093,7 @@ var ts;
|
||||
checkAsyncFunctionReturnType(node);
|
||||
}
|
||||
}
|
||||
if (!node.body) {
|
||||
if (noUnusedIdentifiers && !node.body) {
|
||||
checkUnusedTypeParameters(node);
|
||||
}
|
||||
}
|
||||
@@ -24969,6 +24989,7 @@ var ts;
|
||||
var parameter = local_1.valueDeclaration;
|
||||
if (compilerOptions.noUnusedParameters &&
|
||||
!ts.isParameterPropertyDeclaration(parameter) &&
|
||||
!parameterIsThisKeyword(parameter) &&
|
||||
!parameterNameStartsWithUnderscore(parameter)) {
|
||||
error(local_1.valueDeclaration.name, ts.Diagnostics._0_is_declared_but_never_used, local_1.name);
|
||||
}
|
||||
@@ -24984,6 +25005,9 @@ var ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
function parameterIsThisKeyword(parameter) {
|
||||
return parameter.name && parameter.name.originalKeywordKind === 97;
|
||||
}
|
||||
function parameterNameStartsWithUnderscore(parameter) {
|
||||
return parameter.name && parameter.name.kind === 69 && parameter.name.text.charCodeAt(0) === 95;
|
||||
}
|
||||
@@ -25012,9 +25036,14 @@ var ts;
|
||||
function checkUnusedTypeParameters(node) {
|
||||
if (compilerOptions.noUnusedLocals && !ts.isInAmbientContext(node)) {
|
||||
if (node.typeParameters) {
|
||||
var symbol = getSymbolOfNode(node);
|
||||
var lastDeclaration = symbol && symbol.declarations && ts.lastOrUndefined(symbol.declarations);
|
||||
if (lastDeclaration !== node) {
|
||||
return;
|
||||
}
|
||||
for (var _i = 0, _a = node.typeParameters; _i < _a.length; _i++) {
|
||||
var typeParameter = _a[_i];
|
||||
if (!typeParameter.symbol.isReferenced) {
|
||||
if (!getMergedSymbol(typeParameter.symbol).isReferenced) {
|
||||
error(typeParameter.name, ts.Diagnostics._0_is_declared_but_never_used, typeParameter.symbol.name);
|
||||
}
|
||||
}
|
||||
@@ -26091,7 +26120,7 @@ var ts;
|
||||
ts.forEach(node.members, checkSourceElement);
|
||||
if (produceDiagnostics) {
|
||||
checkTypeForDuplicateIndexSignatures(node);
|
||||
checkUnusedTypeParameters(node);
|
||||
registerForUnusedIdentifiersCheck(node);
|
||||
}
|
||||
}
|
||||
function checkTypeAliasDeclaration(node) {
|
||||
@@ -30814,7 +30843,7 @@ var ts;
|
||||
writeLine();
|
||||
var sourceMappingURL = sourceMap.getSourceMappingURL();
|
||||
if (sourceMappingURL) {
|
||||
write("//# sourceMappingURL=" + sourceMappingURL);
|
||||
write("//# " + "sourceMappingURL" + "=" + sourceMappingURL);
|
||||
}
|
||||
writeEmittedFiles(writer.getText(), jsFilePath, sourceMapFilePath, compilerOptions.emitBOM, sourceFiles);
|
||||
sourceMap.reset();
|
||||
@@ -34464,13 +34493,13 @@ var ts;
|
||||
if (isES6ExportedDeclaration(node) && !(node.flags & 512) && decoratedClassAlias === undefined) {
|
||||
write("export ");
|
||||
}
|
||||
if (!isHoistedDeclarationInSystemModule) {
|
||||
write("let ");
|
||||
}
|
||||
if (decoratedClassAlias !== undefined) {
|
||||
write("" + decoratedClassAlias);
|
||||
write("let " + decoratedClassAlias);
|
||||
}
|
||||
else {
|
||||
if (!isHoistedDeclarationInSystemModule) {
|
||||
write("let ");
|
||||
}
|
||||
emitDeclarationName(node);
|
||||
}
|
||||
write(" = ");
|
||||
@@ -36714,7 +36743,7 @@ var ts;
|
||||
ts.emitTime = 0;
|
||||
ts.ioReadTime = 0;
|
||||
ts.ioWriteTime = 0;
|
||||
ts.version = "2.0.0";
|
||||
ts.version = "2.1.0";
|
||||
var emptyArray = [];
|
||||
var defaultTypeRoots = ["node_modules/@types"];
|
||||
function findConfigFile(searchPath, fileExists) {
|
||||
@@ -36794,12 +36823,7 @@ var ts;
|
||||
return { resolvedModule: resolvedFileName ? { resolvedFileName: resolvedFileName, isExternalLibraryImport: isExternalLibraryImport } : undefined, failedLookupLocations: failedLookupLocations };
|
||||
}
|
||||
function moduleHasNonRelativeName(moduleName) {
|
||||
if (ts.isRootedDiskPath(moduleName)) {
|
||||
return false;
|
||||
}
|
||||
var i = moduleName.lastIndexOf("./", 1);
|
||||
var startsWithDotSlashOrDotDotSlash = i === 0 || (i === 1 && moduleName.charCodeAt(0) === 46);
|
||||
return !startsWithDotSlashOrDotDotSlash;
|
||||
return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName));
|
||||
}
|
||||
function tryReadTypesSection(packageJsonPath, baseDirectory, state) {
|
||||
var jsonContent;
|
||||
@@ -37455,6 +37479,22 @@ var ts;
|
||||
return ts.sortAndDeduplicateDiagnostics(diagnostics);
|
||||
}
|
||||
ts.getPreEmitDiagnostics = getPreEmitDiagnostics;
|
||||
function formatDiagnostics(diagnostics, host) {
|
||||
var output = "";
|
||||
for (var _i = 0, diagnostics_1 = diagnostics; _i < diagnostics_1.length; _i++) {
|
||||
var diagnostic = diagnostics_1[_i];
|
||||
if (diagnostic.file) {
|
||||
var _a = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start), line = _a.line, character = _a.character;
|
||||
var fileName = diagnostic.file.fileName;
|
||||
var relativeFileName = ts.convertToRelativePath(fileName, host.getCurrentDirectory(), function (fileName) { return host.getCanonicalFileName(fileName); });
|
||||
output += relativeFileName + "(" + (line + 1) + "," + (character + 1) + "): ";
|
||||
}
|
||||
var category = ts.DiagnosticCategory[diagnostic.category].toLowerCase();
|
||||
output += category + " TS" + diagnostic.code + ": " + flattenDiagnosticMessageText(diagnostic.messageText, host.getNewLine()) + host.getNewLine();
|
||||
}
|
||||
return output;
|
||||
}
|
||||
ts.formatDiagnostics = formatDiagnostics;
|
||||
function flattenDiagnosticMessageText(messageText, newLine) {
|
||||
if (typeof messageText === "string") {
|
||||
return messageText;
|
||||
@@ -37530,7 +37570,7 @@ var ts;
|
||||
var resolvedTypeReferenceDirectives = {};
|
||||
var fileProcessingDiagnostics = ts.createDiagnosticCollection();
|
||||
var maxNodeModulesJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 2;
|
||||
var currentNodeModulesJsDepth = 0;
|
||||
var currentNodeModulesDepth = 0;
|
||||
var modulesWithElidedImports = {};
|
||||
var sourceFilesFoundSearchingNodeModules = {};
|
||||
var start = new Date().getTime();
|
||||
@@ -37754,8 +37794,7 @@ var ts;
|
||||
return noDiagnosticsTypeChecker || (noDiagnosticsTypeChecker = ts.createTypeChecker(program, false));
|
||||
}
|
||||
function emit(sourceFile, writeFileCallback, cancellationToken) {
|
||||
var _this = this;
|
||||
return runWithCancellationToken(function () { return emitWorker(_this, sourceFile, writeFileCallback, cancellationToken); });
|
||||
return runWithCancellationToken(function () { return emitWorker(program, sourceFile, writeFileCallback, cancellationToken); });
|
||||
}
|
||||
function isEmitBlocked(emitFileName) {
|
||||
return hasEmitBlockingDiagnostics.contains(ts.toPath(emitFileName, currentDirectory, getCanonicalFileName));
|
||||
@@ -38162,8 +38201,17 @@ var ts;
|
||||
if (file_1 && options.forceConsistentCasingInFileNames && ts.getNormalizedAbsolutePath(file_1.fileName, currentDirectory) !== ts.getNormalizedAbsolutePath(fileName, currentDirectory)) {
|
||||
reportFileNamesDifferOnlyInCasingError(fileName, file_1.fileName, refFile, refPos, refEnd);
|
||||
}
|
||||
if (file_1 && ts.lookUp(modulesWithElidedImports, file_1.path)) {
|
||||
if (currentNodeModulesJsDepth < maxNodeModulesJsDepth) {
|
||||
if (file_1 && ts.lookUp(sourceFilesFoundSearchingNodeModules, file_1.path) && currentNodeModulesDepth == 0) {
|
||||
sourceFilesFoundSearchingNodeModules[file_1.path] = false;
|
||||
if (!options.noResolve) {
|
||||
processReferencedFiles(file_1, ts.getDirectoryPath(fileName), isDefaultLib);
|
||||
processTypeReferenceDirectives(file_1);
|
||||
}
|
||||
modulesWithElidedImports[file_1.path] = false;
|
||||
processImportedModules(file_1, ts.getDirectoryPath(fileName));
|
||||
}
|
||||
else if (file_1 && ts.lookUp(modulesWithElidedImports, file_1.path)) {
|
||||
if (currentNodeModulesDepth < maxNodeModulesJsDepth) {
|
||||
modulesWithElidedImports[file_1.path] = false;
|
||||
processImportedModules(file_1, ts.getDirectoryPath(fileName));
|
||||
}
|
||||
@@ -38180,6 +38228,7 @@ var ts;
|
||||
});
|
||||
filesByName.set(path, file);
|
||||
if (file) {
|
||||
sourceFilesFoundSearchingNodeModules[path] = (currentNodeModulesDepth > 0);
|
||||
file.path = path;
|
||||
if (host.useCaseSensitiveFileNames()) {
|
||||
var existingFile = filesByNameIgnoreCase.get(path);
|
||||
@@ -38280,12 +38329,9 @@ var ts;
|
||||
var isFromNodeModulesSearch = resolution && resolution.isExternalLibraryImport;
|
||||
var isJsFileFromNodeModules = isFromNodeModulesSearch && ts.hasJavaScriptFileExtension(resolution.resolvedFileName);
|
||||
if (isFromNodeModulesSearch) {
|
||||
sourceFilesFoundSearchingNodeModules[resolvedPath] = true;
|
||||
currentNodeModulesDepth++;
|
||||
}
|
||||
if (isJsFileFromNodeModules) {
|
||||
currentNodeModulesJsDepth++;
|
||||
}
|
||||
var elideImport = isJsFileFromNodeModules && currentNodeModulesJsDepth > maxNodeModulesJsDepth;
|
||||
var elideImport = isJsFileFromNodeModules && currentNodeModulesDepth > maxNodeModulesJsDepth;
|
||||
var shouldAddFile = resolution && !options.noResolve && i < file.imports.length && !elideImport;
|
||||
if (elideImport) {
|
||||
modulesWithElidedImports[file.path] = true;
|
||||
@@ -38293,8 +38339,8 @@ var ts;
|
||||
else if (shouldAddFile) {
|
||||
findSourceFile(resolution.resolvedFileName, resolvedPath, false, false, file, ts.skipTrivia(file.text, file.imports[i].pos), file.imports[i].end);
|
||||
}
|
||||
if (isJsFileFromNodeModules) {
|
||||
currentNodeModulesJsDepth--;
|
||||
if (isFromNodeModulesSearch) {
|
||||
currentNodeModulesDepth--;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39887,7 +39933,7 @@ var ts;
|
||||
return createPatternMatch(PatternMatchKind.exact, punctuationStripped, candidate === chunk.text);
|
||||
}
|
||||
else {
|
||||
return createPatternMatch(PatternMatchKind.prefix, punctuationStripped, startsWith(candidate, chunk.text));
|
||||
return createPatternMatch(PatternMatchKind.prefix, punctuationStripped, ts.startsWith(candidate, chunk.text));
|
||||
}
|
||||
}
|
||||
var isLowercase = chunk.isLowerCase;
|
||||
@@ -40059,14 +40105,6 @@ var ts;
|
||||
var str = String.fromCharCode(ch);
|
||||
return str === str.toLowerCase();
|
||||
}
|
||||
function startsWith(string, search) {
|
||||
for (var i = 0, n = search.length; i < n; i++) {
|
||||
if (string.charCodeAt(i) !== search.charCodeAt(i)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function indexOfIgnoringCase(string, value) {
|
||||
for (var i = 0, n = string.length - value.length; i <= n; i++) {
|
||||
if (startsWithIgnoringCase(string, value, i)) {
|
||||
@@ -41551,6 +41589,9 @@ var ts;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function shouldRescanJsxText(node) {
|
||||
return node && node.kind === 244;
|
||||
}
|
||||
function shouldRescanSlashToken(container) {
|
||||
return container.kind === 10;
|
||||
}
|
||||
@@ -41578,7 +41619,9 @@ var ts;
|
||||
? 3
|
||||
: shouldRescanJsxIdentifier(n)
|
||||
? 4
|
||||
: 0;
|
||||
: shouldRescanJsxText(n)
|
||||
? 5
|
||||
: 0;
|
||||
if (lastTokenInfo && expectedScanAction === lastScanAction) {
|
||||
return fixTokenKind(lastTokenInfo, n);
|
||||
}
|
||||
@@ -41606,6 +41649,10 @@ var ts;
|
||||
currentToken = scanner.scanJsxIdentifier();
|
||||
lastScanAction = 4;
|
||||
}
|
||||
else if (expectedScanAction === 5) {
|
||||
currentToken = scanner.reScanJsxToken();
|
||||
lastScanAction = 5;
|
||||
}
|
||||
else {
|
||||
lastScanAction = 0;
|
||||
}
|
||||
@@ -43854,19 +43901,20 @@ var ts;
|
||||
"version"
|
||||
];
|
||||
var jsDocCompletionEntries;
|
||||
function createNode(kind, pos, end, flags, parent) {
|
||||
var node = new NodeObject(kind, pos, end);
|
||||
node.flags = flags;
|
||||
function createNode(kind, pos, end, parent) {
|
||||
var node = kind >= 139 ? new NodeObject(kind, pos, end) :
|
||||
kind === 69 ? new IdentifierObject(kind, pos, end) :
|
||||
new TokenObject(kind, pos, end);
|
||||
node.parent = parent;
|
||||
return node;
|
||||
}
|
||||
var NodeObject = (function () {
|
||||
function NodeObject(kind, pos, end) {
|
||||
this.kind = kind;
|
||||
this.pos = pos;
|
||||
this.end = end;
|
||||
this.flags = 0;
|
||||
this.parent = undefined;
|
||||
this.kind = kind;
|
||||
}
|
||||
NodeObject.prototype.getSourceFile = function () {
|
||||
return ts.getSourceFileOfNode(this);
|
||||
@@ -43901,14 +43949,14 @@ var ts;
|
||||
var token = useJSDocScanner ? scanner.scanJSDocToken() : scanner.scan();
|
||||
var textPos = scanner.getTextPos();
|
||||
if (textPos <= end) {
|
||||
nodes.push(createNode(token, pos, textPos, 0, this));
|
||||
nodes.push(createNode(token, pos, textPos, this));
|
||||
}
|
||||
pos = textPos;
|
||||
}
|
||||
return pos;
|
||||
};
|
||||
NodeObject.prototype.createSyntaxList = function (nodes) {
|
||||
var list = createNode(282, nodes.pos, nodes.end, 0, this);
|
||||
var list = createNode(282, nodes.pos, nodes.end, this);
|
||||
list._children = [];
|
||||
var pos = nodes.pos;
|
||||
for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) {
|
||||
@@ -43993,6 +44041,73 @@ var ts;
|
||||
};
|
||||
return NodeObject;
|
||||
}());
|
||||
var TokenOrIdentifierObject = (function () {
|
||||
function TokenOrIdentifierObject(pos, end) {
|
||||
this.pos = pos;
|
||||
this.end = end;
|
||||
this.flags = 0;
|
||||
this.parent = undefined;
|
||||
}
|
||||
TokenOrIdentifierObject.prototype.getSourceFile = function () {
|
||||
return ts.getSourceFileOfNode(this);
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getStart = function (sourceFile, includeJsDocComment) {
|
||||
return ts.getTokenPosOfNode(this, sourceFile, includeJsDocComment);
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getFullStart = function () {
|
||||
return this.pos;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getEnd = function () {
|
||||
return this.end;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getWidth = function (sourceFile) {
|
||||
return this.getEnd() - this.getStart(sourceFile);
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getFullWidth = function () {
|
||||
return this.end - this.pos;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getLeadingTriviaWidth = function (sourceFile) {
|
||||
return this.getStart(sourceFile) - this.pos;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getFullText = function (sourceFile) {
|
||||
return (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end);
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getText = function (sourceFile) {
|
||||
return (sourceFile || this.getSourceFile()).text.substring(this.getStart(), this.getEnd());
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getChildCount = function (sourceFile) {
|
||||
return 0;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getChildAt = function (index, sourceFile) {
|
||||
return undefined;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getChildren = function (sourceFile) {
|
||||
return emptyArray;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getFirstToken = function (sourceFile) {
|
||||
return undefined;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getLastToken = function (sourceFile) {
|
||||
return undefined;
|
||||
};
|
||||
return TokenOrIdentifierObject;
|
||||
}());
|
||||
var TokenObject = (function (_super) {
|
||||
__extends(TokenObject, _super);
|
||||
function TokenObject(kind, pos, end) {
|
||||
_super.call(this, pos, end);
|
||||
this.kind = kind;
|
||||
}
|
||||
return TokenObject;
|
||||
}(TokenOrIdentifierObject));
|
||||
var IdentifierObject = (function (_super) {
|
||||
__extends(IdentifierObject, _super);
|
||||
function IdentifierObject(kind, pos, end) {
|
||||
_super.call(this, pos, end);
|
||||
}
|
||||
return IdentifierObject;
|
||||
}(TokenOrIdentifierObject));
|
||||
IdentifierObject.prototype.kind = 69;
|
||||
var SymbolObject = (function () {
|
||||
function SymbolObject(flags, name) {
|
||||
this.flags = flags;
|
||||
@@ -49673,6 +49788,8 @@ var ts;
|
||||
function initializeServices() {
|
||||
ts.objectAllocator = {
|
||||
getNodeConstructor: function () { return NodeObject; },
|
||||
getTokenConstructor: function () { return TokenObject; },
|
||||
getIdentifierConstructor: function () { return IdentifierObject; },
|
||||
getSourceFileConstructor: function () { return SourceFileObject; },
|
||||
getSymbolConstructor: function () { return SymbolObject; },
|
||||
getTypeConstructor: function () { return TypeObject; },
|
||||
@@ -50793,7 +50910,6 @@ var ts;
|
||||
if (isOpen === void 0) { isOpen = false; }
|
||||
this.host = host;
|
||||
this.fileName = fileName;
|
||||
this.content = content;
|
||||
this.isOpen = isOpen;
|
||||
this.children = [];
|
||||
this.formatCodeOptions = ts.clone(CompilerService.getDefaultFormatCodeOptions(this.host));
|
||||
@@ -52419,7 +52535,7 @@ var ts;
|
||||
done: false,
|
||||
leaf: function (relativeStart, relativeLength, ll) {
|
||||
if (!f(ll, relativeStart, relativeLength)) {
|
||||
this.done = true;
|
||||
walkFns.done = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -53069,7 +53185,7 @@ var ts;
|
||||
ioSession.listen();
|
||||
})(server = ts.server || (ts.server = {}));
|
||||
})(ts || (ts = {}));
|
||||
var debugObjectHost = this;
|
||||
var debugObjectHost = new Function("return this")();
|
||||
var ts;
|
||||
(function (ts) {
|
||||
function logInternalError(logger, err) {
|
||||
@@ -53197,7 +53313,7 @@ var ts;
|
||||
return this.shimHost.getCurrentDirectory();
|
||||
};
|
||||
LanguageServiceShimHostAdapter.prototype.getDirectories = function (path) {
|
||||
return this.shimHost.getDirectories(path);
|
||||
return JSON.parse(this.shimHost.getDirectories(path));
|
||||
};
|
||||
LanguageServiceShimHostAdapter.prototype.getDefaultLibFileName = function (options) {
|
||||
return this.shimHost.getDefaultLibFileName(JSON.stringify(options));
|
||||
|
||||
Vendored
+17
-8
@@ -405,7 +405,10 @@ declare namespace ts {
|
||||
interface ModifiersArray extends NodeArray<Modifier> {
|
||||
flags: NodeFlags;
|
||||
}
|
||||
interface Modifier extends Node {
|
||||
interface Token extends Node {
|
||||
__tokenTag: any;
|
||||
}
|
||||
interface Modifier extends Token {
|
||||
}
|
||||
interface Identifier extends PrimaryExpression {
|
||||
text: string;
|
||||
@@ -2050,7 +2053,6 @@ declare namespace ts {
|
||||
getCancellationToken?(): CancellationToken;
|
||||
getDefaultLibFileName(options: CompilerOptions): string;
|
||||
getDefaultLibLocation?(): string;
|
||||
getDefaultTypeDirectiveNames?(rootPath: string): string[];
|
||||
writeFile: WriteFileCallback;
|
||||
getCurrentDirectory(): string;
|
||||
getDirectories(path: string): string[];
|
||||
@@ -2156,6 +2158,8 @@ declare namespace ts {
|
||||
function ensureTrailingDirectorySeparator(path: string): string;
|
||||
function comparePaths(a: string, b: string, currentDirectory: string, ignoreCase?: boolean): Comparison;
|
||||
function containsPath(parent: string, child: string, currentDirectory: string, ignoreCase?: boolean): boolean;
|
||||
function startsWith(str: string, prefix: string): boolean;
|
||||
function endsWith(str: string, suffix: string): boolean;
|
||||
function fileExtensionIs(path: string, extension: string): boolean;
|
||||
function fileExtensionIsAny(path: string, extensions: string[]): boolean;
|
||||
function getRegularExpressionForWildcard(specs: string[], basePath: string, usage: "files" | "directories" | "exclude"): string;
|
||||
@@ -2193,6 +2197,8 @@ declare namespace ts {
|
||||
function changeExtension<T extends string | Path>(path: T, newExtension: string): T;
|
||||
interface ObjectAllocator {
|
||||
getNodeConstructor(): new (kind: SyntaxKind, pos?: number, end?: number) => Node;
|
||||
getTokenConstructor(): new (kind: SyntaxKind, pos?: number, end?: number) => Token;
|
||||
getIdentifierConstructor(): new (kind: SyntaxKind, pos?: number, end?: number) => Token;
|
||||
getSourceFileConstructor(): new (kind: SyntaxKind, pos?: number, end?: number) => SourceFile;
|
||||
getSymbolConstructor(): new (flags: SymbolFlags, name: string) => Symbol;
|
||||
getTypeConstructor(): new (checker: TypeChecker, flags: TypeFlags) => Type;
|
||||
@@ -6456,13 +6462,13 @@ declare namespace ts {
|
||||
key: string;
|
||||
message: string;
|
||||
};
|
||||
Report_Errors_on_Unused_Locals: {
|
||||
Report_errors_on_unused_locals: {
|
||||
code: number;
|
||||
category: DiagnosticCategory;
|
||||
key: string;
|
||||
message: string;
|
||||
};
|
||||
Report_Errors_on_Unused_Parameters: {
|
||||
Report_errors_on_unused_parameters: {
|
||||
code: number;
|
||||
category: DiagnosticCategory;
|
||||
key: string;
|
||||
@@ -7143,8 +7149,6 @@ declare namespace ts {
|
||||
function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange;
|
||||
function getTypeParameterOwner(d: Declaration): Declaration;
|
||||
function isParameterPropertyDeclaration(node: ParameterDeclaration): boolean;
|
||||
function startsWith(str: string, prefix: string): boolean;
|
||||
function endsWith(str: string, suffix: string): boolean;
|
||||
}
|
||||
declare namespace ts {
|
||||
let parseTime: number;
|
||||
@@ -7225,6 +7229,12 @@ declare namespace ts {
|
||||
const defaultInitCompilerOptions: CompilerOptions;
|
||||
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
|
||||
function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[];
|
||||
interface FormatDiagnosticsHost {
|
||||
getCurrentDirectory(): string;
|
||||
getCanonicalFileName(fileName: string): string;
|
||||
getNewLine(): string;
|
||||
}
|
||||
function formatDiagnostics(diagnostics: Diagnostic[], host: FormatDiagnosticsHost): string;
|
||||
function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;
|
||||
function getAutomaticTypeDirectiveNames(options: CompilerOptions, rootFiles: string[], host: CompilerHost): string[];
|
||||
function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program;
|
||||
@@ -8388,7 +8398,6 @@ declare namespace ts.server {
|
||||
class ScriptInfo {
|
||||
private host;
|
||||
fileName: string;
|
||||
content: string;
|
||||
isOpen: boolean;
|
||||
svc: ScriptVersionCache;
|
||||
children: ScriptInfo[];
|
||||
@@ -8729,7 +8738,7 @@ declare namespace ts {
|
||||
getLocalizedDiagnosticMessages(): string;
|
||||
getCancellationToken(): HostCancellationToken;
|
||||
getCurrentDirectory(): string;
|
||||
getDirectories(path: string): string[];
|
||||
getDirectories(path: string): string;
|
||||
getDefaultLibFileName(options: string): string;
|
||||
getNewLine?(): string;
|
||||
getProjectVersion?(): string;
|
||||
|
||||
+193
-77
@@ -830,10 +830,17 @@ var ts;
|
||||
return true;
|
||||
}
|
||||
ts.containsPath = containsPath;
|
||||
function startsWith(str, prefix) {
|
||||
return str.lastIndexOf(prefix, 0) === 0;
|
||||
}
|
||||
ts.startsWith = startsWith;
|
||||
function endsWith(str, suffix) {
|
||||
var expectedPos = str.length - suffix.length;
|
||||
return expectedPos >= 0 && str.indexOf(suffix, expectedPos) === expectedPos;
|
||||
}
|
||||
ts.endsWith = endsWith;
|
||||
function fileExtensionIs(path, extension) {
|
||||
var pathLen = path.length;
|
||||
var extLen = extension.length;
|
||||
return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension;
|
||||
return path.length > extension.length && endsWith(path, extension);
|
||||
}
|
||||
ts.fileExtensionIs = fileExtensionIs;
|
||||
function fileExtensionIsAny(path, extensions) {
|
||||
@@ -1098,6 +1105,8 @@ var ts;
|
||||
}
|
||||
ts.objectAllocator = {
|
||||
getNodeConstructor: function () { return Node; },
|
||||
getTokenConstructor: function () { return Node; },
|
||||
getIdentifierConstructor: function () { return Node; },
|
||||
getSourceFileConstructor: function () { return Node; },
|
||||
getSymbolConstructor: function () { return Symbol; },
|
||||
getTypeConstructor: function () { return Type; },
|
||||
@@ -1229,7 +1238,7 @@ var ts;
|
||||
function readDirectory(path, extensions, excludes, includes) {
|
||||
return ts.matchFiles(path, extensions, excludes, includes, false, shell.CurrentDirectory, getAccessibleFileSystemEntries);
|
||||
}
|
||||
return {
|
||||
var wscriptSystem = {
|
||||
args: args,
|
||||
newLine: "\r\n",
|
||||
useCaseSensitiveFileNames: false,
|
||||
@@ -1248,7 +1257,7 @@ var ts;
|
||||
return fso.FolderExists(path);
|
||||
},
|
||||
createDirectory: function (directoryName) {
|
||||
if (!this.directoryExists(directoryName)) {
|
||||
if (!wscriptSystem.directoryExists(directoryName)) {
|
||||
fso.CreateFolder(directoryName);
|
||||
}
|
||||
},
|
||||
@@ -1268,6 +1277,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
};
|
||||
return wscriptSystem;
|
||||
}
|
||||
function getNodeSystem() {
|
||||
var _fs = require("fs");
|
||||
@@ -1440,7 +1450,7 @@ var ts;
|
||||
function getDirectories(path) {
|
||||
return ts.filter(_fs.readdirSync(path), function (p) { return fileSystemEntryExists(ts.combinePaths(path, p), 1); });
|
||||
}
|
||||
return {
|
||||
var nodeSystem = {
|
||||
args: process.argv.slice(2),
|
||||
newLine: _os.EOL,
|
||||
useCaseSensitiveFileNames: useCaseSensitiveFileNames,
|
||||
@@ -1490,7 +1500,7 @@ var ts;
|
||||
fileExists: fileExists,
|
||||
directoryExists: directoryExists,
|
||||
createDirectory: function (directoryName) {
|
||||
if (!this.directoryExists(directoryName)) {
|
||||
if (!nodeSystem.directoryExists(directoryName)) {
|
||||
_fs.mkdirSync(directoryName);
|
||||
}
|
||||
},
|
||||
@@ -1538,6 +1548,7 @@ var ts;
|
||||
return _fs.realpathSync(path);
|
||||
}
|
||||
};
|
||||
return nodeSystem;
|
||||
}
|
||||
function getChakraSystem() {
|
||||
var realpath = ChakraHost.realpath && (function (path) { return ChakraHost.realpath(path); });
|
||||
@@ -2287,8 +2298,8 @@ var ts;
|
||||
Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system: { code: 6131, category: ts.DiagnosticCategory.Error, key: "Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system_6131", message: "Cannot compile modules using option '{0}' unless the '--module' flag is 'amd' or 'system'." },
|
||||
File_name_0_has_a_1_extension_stripping_it: { code: 6132, category: ts.DiagnosticCategory.Message, key: "File_name_0_has_a_1_extension_stripping_it_6132", message: "File name '{0}' has a '{1}' extension - stripping it" },
|
||||
_0_is_declared_but_never_used: { code: 6133, category: ts.DiagnosticCategory.Error, key: "_0_is_declared_but_never_used_6133", message: "'{0}' is declared but never used." },
|
||||
Report_Errors_on_Unused_Locals: { code: 6134, category: ts.DiagnosticCategory.Message, key: "Report_Errors_on_Unused_Locals_6134", message: "Report Errors on Unused Locals." },
|
||||
Report_Errors_on_Unused_Parameters: { code: 6135, category: ts.DiagnosticCategory.Message, key: "Report_Errors_on_Unused_Parameters_6135", message: "Report Errors on Unused Parameters." },
|
||||
Report_errors_on_unused_locals: { code: 6134, category: ts.DiagnosticCategory.Message, key: "Report_errors_on_unused_locals_6134", message: "Report errors on unused locals." },
|
||||
Report_errors_on_unused_parameters: { code: 6135, category: ts.DiagnosticCategory.Message, key: "Report_errors_on_unused_parameters_6135", message: "Report errors on unused parameters." },
|
||||
The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files: { code: 6136, category: ts.DiagnosticCategory.Message, key: "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136", message: "The maximum dependency depth to search under node_modules and load JavaScript files" },
|
||||
No_types_specified_in_package_json_but_allowJs_is_set_so_returning_main_value_of_0: { code: 6137, category: ts.DiagnosticCategory.Message, key: "No_types_specified_in_package_json_but_allowJs_is_set_so_returning_main_value_of_0_6137", message: "No types specified in 'package.json' but 'allowJs' is set, so returning 'main' value of '{0}'" },
|
||||
Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_an_1_type_7005", message: "Variable '{0}' implicitly has an '{1}' type." },
|
||||
@@ -3966,12 +3977,12 @@ var ts;
|
||||
{
|
||||
name: "noUnusedLocals",
|
||||
type: "boolean",
|
||||
description: ts.Diagnostics.Report_Errors_on_Unused_Locals
|
||||
description: ts.Diagnostics.Report_errors_on_unused_locals
|
||||
},
|
||||
{
|
||||
name: "noUnusedParameters",
|
||||
type: "boolean",
|
||||
description: ts.Diagnostics.Report_Errors_on_Unused_Parameters
|
||||
description: ts.Diagnostics.Report_errors_on_unused_parameters
|
||||
},
|
||||
{
|
||||
name: "noLib",
|
||||
@@ -5754,7 +5765,7 @@ var ts;
|
||||
}
|
||||
ts.isExpression = isExpression;
|
||||
function isExternalModuleNameRelative(moduleName) {
|
||||
return moduleName.substr(0, 2) === "./" || moduleName.substr(0, 3) === "../" || moduleName.substr(0, 2) === ".\\" || moduleName.substr(0, 3) === "..\\";
|
||||
return /^\.\.?($|[\\/])/.test(moduleName);
|
||||
}
|
||||
ts.isExternalModuleNameRelative = isExternalModuleNameRelative;
|
||||
function isInstantiatedModule(node, preserveConstEnums) {
|
||||
@@ -7262,25 +7273,24 @@ var ts;
|
||||
return node.flags & 92 && node.parent.kind === 148 && ts.isClassLike(node.parent.parent);
|
||||
}
|
||||
ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration;
|
||||
function startsWith(str, prefix) {
|
||||
return str.lastIndexOf(prefix, 0) === 0;
|
||||
}
|
||||
ts.startsWith = startsWith;
|
||||
function endsWith(str, suffix) {
|
||||
var expectedPos = str.length - suffix.length;
|
||||
return str.indexOf(suffix, expectedPos) === expectedPos;
|
||||
}
|
||||
ts.endsWith = endsWith;
|
||||
})(ts || (ts = {}));
|
||||
var ts;
|
||||
(function (ts) {
|
||||
ts.parseTime = 0;
|
||||
var NodeConstructor;
|
||||
var TokenConstructor;
|
||||
var IdentifierConstructor;
|
||||
var SourceFileConstructor;
|
||||
function createNode(kind, pos, end) {
|
||||
if (kind === 256) {
|
||||
return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end);
|
||||
}
|
||||
else if (kind === 69) {
|
||||
return new (IdentifierConstructor || (IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor()))(kind, pos, end);
|
||||
}
|
||||
else if (kind < 139) {
|
||||
return new (TokenConstructor || (TokenConstructor = ts.objectAllocator.getTokenConstructor()))(kind, pos, end);
|
||||
}
|
||||
else {
|
||||
return new (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor()))(kind, pos, end);
|
||||
}
|
||||
@@ -7703,6 +7713,8 @@ var ts;
|
||||
var scanner = ts.createScanner(2, true);
|
||||
var disallowInAndDecoratorContext = 4194304 | 16777216;
|
||||
var NodeConstructor;
|
||||
var TokenConstructor;
|
||||
var IdentifierConstructor;
|
||||
var SourceFileConstructor;
|
||||
var sourceFile;
|
||||
var parseDiagnostics;
|
||||
@@ -7728,6 +7740,8 @@ var ts;
|
||||
}
|
||||
function initializeState(fileName, _sourceText, languageVersion, _syntaxCursor, scriptKind) {
|
||||
NodeConstructor = ts.objectAllocator.getNodeConstructor();
|
||||
TokenConstructor = ts.objectAllocator.getTokenConstructor();
|
||||
IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor();
|
||||
SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor();
|
||||
sourceText = _sourceText;
|
||||
syntaxCursor = _syntaxCursor;
|
||||
@@ -8034,7 +8048,9 @@ var ts;
|
||||
if (!(pos >= 0)) {
|
||||
pos = scanner.getStartPos();
|
||||
}
|
||||
return new NodeConstructor(kind, pos, pos);
|
||||
return kind >= 139 ? new NodeConstructor(kind, pos, pos) :
|
||||
kind === 69 ? new IdentifierConstructor(kind, pos, pos) :
|
||||
new TokenConstructor(kind, pos, pos);
|
||||
}
|
||||
function finishNode(node, end) {
|
||||
node.end = end === undefined ? scanner.getStartPos() : end;
|
||||
@@ -11810,6 +11826,9 @@ var ts;
|
||||
case 55:
|
||||
if (canParseTag) {
|
||||
parentTagTerminated = !tryParseChildTag(jsDocTypeLiteral);
|
||||
if (!parentTagTerminated) {
|
||||
resumePos = scanner.getStartPos();
|
||||
}
|
||||
}
|
||||
seenAsterisk = false;
|
||||
break;
|
||||
@@ -16336,17 +16355,18 @@ var ts;
|
||||
if (declaration.kind === 235) {
|
||||
return links.type = checkExpression(declaration.expression);
|
||||
}
|
||||
if (declaration.flags & 134217728 && declaration.kind === 280 && declaration.typeExpression) {
|
||||
return links.type = getTypeFromTypeNode(declaration.typeExpression.type);
|
||||
}
|
||||
if (!pushTypeResolution(symbol, 0)) {
|
||||
return unknownType;
|
||||
}
|
||||
var type = undefined;
|
||||
if (declaration.kind === 187) {
|
||||
type = getUnionType(ts.map(symbol.declarations, function (decl) { return checkExpressionCached(decl.right); }));
|
||||
}
|
||||
else if (declaration.kind === 172) {
|
||||
if (declaration.parent.kind === 187) {
|
||||
type = checkExpressionCached(declaration.parent.right);
|
||||
}
|
||||
if (declaration.kind === 187 ||
|
||||
declaration.kind === 172 && declaration.parent.kind === 187) {
|
||||
type = getUnionType(ts.map(symbol.declarations, function (decl) { return decl.kind === 187 ?
|
||||
checkExpressionCached(decl.right) :
|
||||
checkExpressionCached(decl.parent.right); }));
|
||||
}
|
||||
if (type === undefined) {
|
||||
type = getWidenedTypeForVariableLikeDeclaration(declaration, true);
|
||||
@@ -22853,7 +22873,7 @@ var ts;
|
||||
function getInferredClassType(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
if (!links.inferredClassType) {
|
||||
links.inferredClassType = createAnonymousType(undefined, symbol.members, emptyArray, emptyArray, undefined, undefined);
|
||||
links.inferredClassType = createAnonymousType(symbol, symbol.members, emptyArray, emptyArray, undefined, undefined);
|
||||
}
|
||||
return links.inferredClassType;
|
||||
}
|
||||
@@ -24073,7 +24093,7 @@ var ts;
|
||||
checkAsyncFunctionReturnType(node);
|
||||
}
|
||||
}
|
||||
if (!node.body) {
|
||||
if (noUnusedIdentifiers && !node.body) {
|
||||
checkUnusedTypeParameters(node);
|
||||
}
|
||||
}
|
||||
@@ -24969,6 +24989,7 @@ var ts;
|
||||
var parameter = local_1.valueDeclaration;
|
||||
if (compilerOptions.noUnusedParameters &&
|
||||
!ts.isParameterPropertyDeclaration(parameter) &&
|
||||
!parameterIsThisKeyword(parameter) &&
|
||||
!parameterNameStartsWithUnderscore(parameter)) {
|
||||
error(local_1.valueDeclaration.name, ts.Diagnostics._0_is_declared_but_never_used, local_1.name);
|
||||
}
|
||||
@@ -24984,6 +25005,9 @@ var ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
function parameterIsThisKeyword(parameter) {
|
||||
return parameter.name && parameter.name.originalKeywordKind === 97;
|
||||
}
|
||||
function parameterNameStartsWithUnderscore(parameter) {
|
||||
return parameter.name && parameter.name.kind === 69 && parameter.name.text.charCodeAt(0) === 95;
|
||||
}
|
||||
@@ -25012,9 +25036,14 @@ var ts;
|
||||
function checkUnusedTypeParameters(node) {
|
||||
if (compilerOptions.noUnusedLocals && !ts.isInAmbientContext(node)) {
|
||||
if (node.typeParameters) {
|
||||
var symbol = getSymbolOfNode(node);
|
||||
var lastDeclaration = symbol && symbol.declarations && ts.lastOrUndefined(symbol.declarations);
|
||||
if (lastDeclaration !== node) {
|
||||
return;
|
||||
}
|
||||
for (var _i = 0, _a = node.typeParameters; _i < _a.length; _i++) {
|
||||
var typeParameter = _a[_i];
|
||||
if (!typeParameter.symbol.isReferenced) {
|
||||
if (!getMergedSymbol(typeParameter.symbol).isReferenced) {
|
||||
error(typeParameter.name, ts.Diagnostics._0_is_declared_but_never_used, typeParameter.symbol.name);
|
||||
}
|
||||
}
|
||||
@@ -26091,7 +26120,7 @@ var ts;
|
||||
ts.forEach(node.members, checkSourceElement);
|
||||
if (produceDiagnostics) {
|
||||
checkTypeForDuplicateIndexSignatures(node);
|
||||
checkUnusedTypeParameters(node);
|
||||
registerForUnusedIdentifiersCheck(node);
|
||||
}
|
||||
}
|
||||
function checkTypeAliasDeclaration(node) {
|
||||
@@ -30814,7 +30843,7 @@ var ts;
|
||||
writeLine();
|
||||
var sourceMappingURL = sourceMap.getSourceMappingURL();
|
||||
if (sourceMappingURL) {
|
||||
write("//# sourceMappingURL=" + sourceMappingURL);
|
||||
write("//# " + "sourceMappingURL" + "=" + sourceMappingURL);
|
||||
}
|
||||
writeEmittedFiles(writer.getText(), jsFilePath, sourceMapFilePath, compilerOptions.emitBOM, sourceFiles);
|
||||
sourceMap.reset();
|
||||
@@ -34464,13 +34493,13 @@ var ts;
|
||||
if (isES6ExportedDeclaration(node) && !(node.flags & 512) && decoratedClassAlias === undefined) {
|
||||
write("export ");
|
||||
}
|
||||
if (!isHoistedDeclarationInSystemModule) {
|
||||
write("let ");
|
||||
}
|
||||
if (decoratedClassAlias !== undefined) {
|
||||
write("" + decoratedClassAlias);
|
||||
write("let " + decoratedClassAlias);
|
||||
}
|
||||
else {
|
||||
if (!isHoistedDeclarationInSystemModule) {
|
||||
write("let ");
|
||||
}
|
||||
emitDeclarationName(node);
|
||||
}
|
||||
write(" = ");
|
||||
@@ -36714,7 +36743,7 @@ var ts;
|
||||
ts.emitTime = 0;
|
||||
ts.ioReadTime = 0;
|
||||
ts.ioWriteTime = 0;
|
||||
ts.version = "2.0.0";
|
||||
ts.version = "2.1.0";
|
||||
var emptyArray = [];
|
||||
var defaultTypeRoots = ["node_modules/@types"];
|
||||
function findConfigFile(searchPath, fileExists) {
|
||||
@@ -36794,12 +36823,7 @@ var ts;
|
||||
return { resolvedModule: resolvedFileName ? { resolvedFileName: resolvedFileName, isExternalLibraryImport: isExternalLibraryImport } : undefined, failedLookupLocations: failedLookupLocations };
|
||||
}
|
||||
function moduleHasNonRelativeName(moduleName) {
|
||||
if (ts.isRootedDiskPath(moduleName)) {
|
||||
return false;
|
||||
}
|
||||
var i = moduleName.lastIndexOf("./", 1);
|
||||
var startsWithDotSlashOrDotDotSlash = i === 0 || (i === 1 && moduleName.charCodeAt(0) === 46);
|
||||
return !startsWithDotSlashOrDotDotSlash;
|
||||
return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName));
|
||||
}
|
||||
function tryReadTypesSection(packageJsonPath, baseDirectory, state) {
|
||||
var jsonContent;
|
||||
@@ -37455,6 +37479,22 @@ var ts;
|
||||
return ts.sortAndDeduplicateDiagnostics(diagnostics);
|
||||
}
|
||||
ts.getPreEmitDiagnostics = getPreEmitDiagnostics;
|
||||
function formatDiagnostics(diagnostics, host) {
|
||||
var output = "";
|
||||
for (var _i = 0, diagnostics_1 = diagnostics; _i < diagnostics_1.length; _i++) {
|
||||
var diagnostic = diagnostics_1[_i];
|
||||
if (diagnostic.file) {
|
||||
var _a = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start), line = _a.line, character = _a.character;
|
||||
var fileName = diagnostic.file.fileName;
|
||||
var relativeFileName = ts.convertToRelativePath(fileName, host.getCurrentDirectory(), function (fileName) { return host.getCanonicalFileName(fileName); });
|
||||
output += relativeFileName + "(" + (line + 1) + "," + (character + 1) + "): ";
|
||||
}
|
||||
var category = ts.DiagnosticCategory[diagnostic.category].toLowerCase();
|
||||
output += category + " TS" + diagnostic.code + ": " + flattenDiagnosticMessageText(diagnostic.messageText, host.getNewLine()) + host.getNewLine();
|
||||
}
|
||||
return output;
|
||||
}
|
||||
ts.formatDiagnostics = formatDiagnostics;
|
||||
function flattenDiagnosticMessageText(messageText, newLine) {
|
||||
if (typeof messageText === "string") {
|
||||
return messageText;
|
||||
@@ -37530,7 +37570,7 @@ var ts;
|
||||
var resolvedTypeReferenceDirectives = {};
|
||||
var fileProcessingDiagnostics = ts.createDiagnosticCollection();
|
||||
var maxNodeModulesJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 2;
|
||||
var currentNodeModulesJsDepth = 0;
|
||||
var currentNodeModulesDepth = 0;
|
||||
var modulesWithElidedImports = {};
|
||||
var sourceFilesFoundSearchingNodeModules = {};
|
||||
var start = new Date().getTime();
|
||||
@@ -37754,8 +37794,7 @@ var ts;
|
||||
return noDiagnosticsTypeChecker || (noDiagnosticsTypeChecker = ts.createTypeChecker(program, false));
|
||||
}
|
||||
function emit(sourceFile, writeFileCallback, cancellationToken) {
|
||||
var _this = this;
|
||||
return runWithCancellationToken(function () { return emitWorker(_this, sourceFile, writeFileCallback, cancellationToken); });
|
||||
return runWithCancellationToken(function () { return emitWorker(program, sourceFile, writeFileCallback, cancellationToken); });
|
||||
}
|
||||
function isEmitBlocked(emitFileName) {
|
||||
return hasEmitBlockingDiagnostics.contains(ts.toPath(emitFileName, currentDirectory, getCanonicalFileName));
|
||||
@@ -38162,8 +38201,17 @@ var ts;
|
||||
if (file_1 && options.forceConsistentCasingInFileNames && ts.getNormalizedAbsolutePath(file_1.fileName, currentDirectory) !== ts.getNormalizedAbsolutePath(fileName, currentDirectory)) {
|
||||
reportFileNamesDifferOnlyInCasingError(fileName, file_1.fileName, refFile, refPos, refEnd);
|
||||
}
|
||||
if (file_1 && ts.lookUp(modulesWithElidedImports, file_1.path)) {
|
||||
if (currentNodeModulesJsDepth < maxNodeModulesJsDepth) {
|
||||
if (file_1 && ts.lookUp(sourceFilesFoundSearchingNodeModules, file_1.path) && currentNodeModulesDepth == 0) {
|
||||
sourceFilesFoundSearchingNodeModules[file_1.path] = false;
|
||||
if (!options.noResolve) {
|
||||
processReferencedFiles(file_1, ts.getDirectoryPath(fileName), isDefaultLib);
|
||||
processTypeReferenceDirectives(file_1);
|
||||
}
|
||||
modulesWithElidedImports[file_1.path] = false;
|
||||
processImportedModules(file_1, ts.getDirectoryPath(fileName));
|
||||
}
|
||||
else if (file_1 && ts.lookUp(modulesWithElidedImports, file_1.path)) {
|
||||
if (currentNodeModulesDepth < maxNodeModulesJsDepth) {
|
||||
modulesWithElidedImports[file_1.path] = false;
|
||||
processImportedModules(file_1, ts.getDirectoryPath(fileName));
|
||||
}
|
||||
@@ -38180,6 +38228,7 @@ var ts;
|
||||
});
|
||||
filesByName.set(path, file);
|
||||
if (file) {
|
||||
sourceFilesFoundSearchingNodeModules[path] = (currentNodeModulesDepth > 0);
|
||||
file.path = path;
|
||||
if (host.useCaseSensitiveFileNames()) {
|
||||
var existingFile = filesByNameIgnoreCase.get(path);
|
||||
@@ -38280,12 +38329,9 @@ var ts;
|
||||
var isFromNodeModulesSearch = resolution && resolution.isExternalLibraryImport;
|
||||
var isJsFileFromNodeModules = isFromNodeModulesSearch && ts.hasJavaScriptFileExtension(resolution.resolvedFileName);
|
||||
if (isFromNodeModulesSearch) {
|
||||
sourceFilesFoundSearchingNodeModules[resolvedPath] = true;
|
||||
currentNodeModulesDepth++;
|
||||
}
|
||||
if (isJsFileFromNodeModules) {
|
||||
currentNodeModulesJsDepth++;
|
||||
}
|
||||
var elideImport = isJsFileFromNodeModules && currentNodeModulesJsDepth > maxNodeModulesJsDepth;
|
||||
var elideImport = isJsFileFromNodeModules && currentNodeModulesDepth > maxNodeModulesJsDepth;
|
||||
var shouldAddFile = resolution && !options.noResolve && i < file.imports.length && !elideImport;
|
||||
if (elideImport) {
|
||||
modulesWithElidedImports[file.path] = true;
|
||||
@@ -38293,8 +38339,8 @@ var ts;
|
||||
else if (shouldAddFile) {
|
||||
findSourceFile(resolution.resolvedFileName, resolvedPath, false, false, file, ts.skipTrivia(file.text, file.imports[i].pos), file.imports[i].end);
|
||||
}
|
||||
if (isJsFileFromNodeModules) {
|
||||
currentNodeModulesJsDepth--;
|
||||
if (isFromNodeModulesSearch) {
|
||||
currentNodeModulesDepth--;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39887,7 +39933,7 @@ var ts;
|
||||
return createPatternMatch(PatternMatchKind.exact, punctuationStripped, candidate === chunk.text);
|
||||
}
|
||||
else {
|
||||
return createPatternMatch(PatternMatchKind.prefix, punctuationStripped, startsWith(candidate, chunk.text));
|
||||
return createPatternMatch(PatternMatchKind.prefix, punctuationStripped, ts.startsWith(candidate, chunk.text));
|
||||
}
|
||||
}
|
||||
var isLowercase = chunk.isLowerCase;
|
||||
@@ -40059,14 +40105,6 @@ var ts;
|
||||
var str = String.fromCharCode(ch);
|
||||
return str === str.toLowerCase();
|
||||
}
|
||||
function startsWith(string, search) {
|
||||
for (var i = 0, n = search.length; i < n; i++) {
|
||||
if (string.charCodeAt(i) !== search.charCodeAt(i)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function indexOfIgnoringCase(string, value) {
|
||||
for (var i = 0, n = string.length - value.length; i <= n; i++) {
|
||||
if (startsWithIgnoringCase(string, value, i)) {
|
||||
@@ -41551,6 +41589,9 @@ var ts;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function shouldRescanJsxText(node) {
|
||||
return node && node.kind === 244;
|
||||
}
|
||||
function shouldRescanSlashToken(container) {
|
||||
return container.kind === 10;
|
||||
}
|
||||
@@ -41578,7 +41619,9 @@ var ts;
|
||||
? 3
|
||||
: shouldRescanJsxIdentifier(n)
|
||||
? 4
|
||||
: 0;
|
||||
: shouldRescanJsxText(n)
|
||||
? 5
|
||||
: 0;
|
||||
if (lastTokenInfo && expectedScanAction === lastScanAction) {
|
||||
return fixTokenKind(lastTokenInfo, n);
|
||||
}
|
||||
@@ -41606,6 +41649,10 @@ var ts;
|
||||
currentToken = scanner.scanJsxIdentifier();
|
||||
lastScanAction = 4;
|
||||
}
|
||||
else if (expectedScanAction === 5) {
|
||||
currentToken = scanner.reScanJsxToken();
|
||||
lastScanAction = 5;
|
||||
}
|
||||
else {
|
||||
lastScanAction = 0;
|
||||
}
|
||||
@@ -43854,19 +43901,20 @@ var ts;
|
||||
"version"
|
||||
];
|
||||
var jsDocCompletionEntries;
|
||||
function createNode(kind, pos, end, flags, parent) {
|
||||
var node = new NodeObject(kind, pos, end);
|
||||
node.flags = flags;
|
||||
function createNode(kind, pos, end, parent) {
|
||||
var node = kind >= 139 ? new NodeObject(kind, pos, end) :
|
||||
kind === 69 ? new IdentifierObject(kind, pos, end) :
|
||||
new TokenObject(kind, pos, end);
|
||||
node.parent = parent;
|
||||
return node;
|
||||
}
|
||||
var NodeObject = (function () {
|
||||
function NodeObject(kind, pos, end) {
|
||||
this.kind = kind;
|
||||
this.pos = pos;
|
||||
this.end = end;
|
||||
this.flags = 0;
|
||||
this.parent = undefined;
|
||||
this.kind = kind;
|
||||
}
|
||||
NodeObject.prototype.getSourceFile = function () {
|
||||
return ts.getSourceFileOfNode(this);
|
||||
@@ -43901,14 +43949,14 @@ var ts;
|
||||
var token = useJSDocScanner ? scanner.scanJSDocToken() : scanner.scan();
|
||||
var textPos = scanner.getTextPos();
|
||||
if (textPos <= end) {
|
||||
nodes.push(createNode(token, pos, textPos, 0, this));
|
||||
nodes.push(createNode(token, pos, textPos, this));
|
||||
}
|
||||
pos = textPos;
|
||||
}
|
||||
return pos;
|
||||
};
|
||||
NodeObject.prototype.createSyntaxList = function (nodes) {
|
||||
var list = createNode(282, nodes.pos, nodes.end, 0, this);
|
||||
var list = createNode(282, nodes.pos, nodes.end, this);
|
||||
list._children = [];
|
||||
var pos = nodes.pos;
|
||||
for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) {
|
||||
@@ -43993,6 +44041,73 @@ var ts;
|
||||
};
|
||||
return NodeObject;
|
||||
}());
|
||||
var TokenOrIdentifierObject = (function () {
|
||||
function TokenOrIdentifierObject(pos, end) {
|
||||
this.pos = pos;
|
||||
this.end = end;
|
||||
this.flags = 0;
|
||||
this.parent = undefined;
|
||||
}
|
||||
TokenOrIdentifierObject.prototype.getSourceFile = function () {
|
||||
return ts.getSourceFileOfNode(this);
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getStart = function (sourceFile, includeJsDocComment) {
|
||||
return ts.getTokenPosOfNode(this, sourceFile, includeJsDocComment);
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getFullStart = function () {
|
||||
return this.pos;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getEnd = function () {
|
||||
return this.end;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getWidth = function (sourceFile) {
|
||||
return this.getEnd() - this.getStart(sourceFile);
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getFullWidth = function () {
|
||||
return this.end - this.pos;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getLeadingTriviaWidth = function (sourceFile) {
|
||||
return this.getStart(sourceFile) - this.pos;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getFullText = function (sourceFile) {
|
||||
return (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end);
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getText = function (sourceFile) {
|
||||
return (sourceFile || this.getSourceFile()).text.substring(this.getStart(), this.getEnd());
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getChildCount = function (sourceFile) {
|
||||
return 0;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getChildAt = function (index, sourceFile) {
|
||||
return undefined;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getChildren = function (sourceFile) {
|
||||
return emptyArray;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getFirstToken = function (sourceFile) {
|
||||
return undefined;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getLastToken = function (sourceFile) {
|
||||
return undefined;
|
||||
};
|
||||
return TokenOrIdentifierObject;
|
||||
}());
|
||||
var TokenObject = (function (_super) {
|
||||
__extends(TokenObject, _super);
|
||||
function TokenObject(kind, pos, end) {
|
||||
_super.call(this, pos, end);
|
||||
this.kind = kind;
|
||||
}
|
||||
return TokenObject;
|
||||
}(TokenOrIdentifierObject));
|
||||
var IdentifierObject = (function (_super) {
|
||||
__extends(IdentifierObject, _super);
|
||||
function IdentifierObject(kind, pos, end) {
|
||||
_super.call(this, pos, end);
|
||||
}
|
||||
return IdentifierObject;
|
||||
}(TokenOrIdentifierObject));
|
||||
IdentifierObject.prototype.kind = 69;
|
||||
var SymbolObject = (function () {
|
||||
function SymbolObject(flags, name) {
|
||||
this.flags = flags;
|
||||
@@ -49673,6 +49788,8 @@ var ts;
|
||||
function initializeServices() {
|
||||
ts.objectAllocator = {
|
||||
getNodeConstructor: function () { return NodeObject; },
|
||||
getTokenConstructor: function () { return TokenObject; },
|
||||
getIdentifierConstructor: function () { return IdentifierObject; },
|
||||
getSourceFileConstructor: function () { return SourceFileObject; },
|
||||
getSymbolConstructor: function () { return SymbolObject; },
|
||||
getTypeConstructor: function () { return TypeObject; },
|
||||
@@ -50793,7 +50910,6 @@ var ts;
|
||||
if (isOpen === void 0) { isOpen = false; }
|
||||
this.host = host;
|
||||
this.fileName = fileName;
|
||||
this.content = content;
|
||||
this.isOpen = isOpen;
|
||||
this.children = [];
|
||||
this.formatCodeOptions = ts.clone(CompilerService.getDefaultFormatCodeOptions(this.host));
|
||||
@@ -52419,7 +52535,7 @@ var ts;
|
||||
done: false,
|
||||
leaf: function (relativeStart, relativeLength, ll) {
|
||||
if (!f(ll, relativeStart, relativeLength)) {
|
||||
this.done = true;
|
||||
walkFns.done = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -52835,7 +52951,7 @@ var ts;
|
||||
server.LineLeaf = LineLeaf;
|
||||
})(server = ts.server || (ts.server = {}));
|
||||
})(ts || (ts = {}));
|
||||
var debugObjectHost = this;
|
||||
var debugObjectHost = new Function("return this")();
|
||||
var ts;
|
||||
(function (ts) {
|
||||
function logInternalError(logger, err) {
|
||||
@@ -52963,7 +53079,7 @@ var ts;
|
||||
return this.shimHost.getCurrentDirectory();
|
||||
};
|
||||
LanguageServiceShimHostAdapter.prototype.getDirectories = function (path) {
|
||||
return this.shimHost.getDirectories(path);
|
||||
return JSON.parse(this.shimHost.getDirectories(path));
|
||||
};
|
||||
LanguageServiceShimHostAdapter.prototype.getDefaultLibFileName = function (options) {
|
||||
return this.shimHost.getDefaultLibFileName(JSON.stringify(options));
|
||||
|
||||
Vendored
+10
-4
@@ -409,7 +409,10 @@ declare namespace ts {
|
||||
interface ModifiersArray extends NodeArray<Modifier> {
|
||||
flags: NodeFlags;
|
||||
}
|
||||
interface Modifier extends Node {
|
||||
interface Token extends Node {
|
||||
__tokenTag: any;
|
||||
}
|
||||
interface Modifier extends Token {
|
||||
}
|
||||
interface Identifier extends PrimaryExpression {
|
||||
text: string;
|
||||
@@ -1696,7 +1699,6 @@ declare namespace ts {
|
||||
getCancellationToken?(): CancellationToken;
|
||||
getDefaultLibFileName(options: CompilerOptions): string;
|
||||
getDefaultLibLocation?(): string;
|
||||
getDefaultTypeDirectiveNames?(rootPath: string): string[];
|
||||
writeFile: WriteFileCallback;
|
||||
getCurrentDirectory(): string;
|
||||
getDirectories(path: string): string[];
|
||||
@@ -1842,8 +1844,6 @@ declare namespace ts {
|
||||
function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange;
|
||||
function getTypeParameterOwner(d: Declaration): Declaration;
|
||||
function isParameterPropertyDeclaration(node: ParameterDeclaration): boolean;
|
||||
function startsWith(str: string, prefix: string): boolean;
|
||||
function endsWith(str: string, suffix: string): boolean;
|
||||
}
|
||||
declare namespace ts {
|
||||
function createNode(kind: SyntaxKind, pos?: number, end?: number): Node;
|
||||
@@ -1868,6 +1868,12 @@ declare namespace ts {
|
||||
function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations;
|
||||
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
|
||||
function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[];
|
||||
interface FormatDiagnosticsHost {
|
||||
getCurrentDirectory(): string;
|
||||
getCanonicalFileName(fileName: string): string;
|
||||
getNewLine(): string;
|
||||
}
|
||||
function formatDiagnostics(diagnostics: Diagnostic[], host: FormatDiagnosticsHost): string;
|
||||
function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;
|
||||
/**
|
||||
* Given a set of options and a set of root files, returns the set of type directive names
|
||||
|
||||
+210
-83
@@ -1756,10 +1756,19 @@ var ts;
|
||||
return true;
|
||||
}
|
||||
ts.containsPath = containsPath;
|
||||
/* @internal */
|
||||
function startsWith(str, prefix) {
|
||||
return str.lastIndexOf(prefix, 0) === 0;
|
||||
}
|
||||
ts.startsWith = startsWith;
|
||||
/* @internal */
|
||||
function endsWith(str, suffix) {
|
||||
var expectedPos = str.length - suffix.length;
|
||||
return expectedPos >= 0 && str.indexOf(suffix, expectedPos) === expectedPos;
|
||||
}
|
||||
ts.endsWith = endsWith;
|
||||
function fileExtensionIs(path, extension) {
|
||||
var pathLen = path.length;
|
||||
var extLen = extension.length;
|
||||
return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension;
|
||||
return path.length > extension.length && endsWith(path, extension);
|
||||
}
|
||||
ts.fileExtensionIs = fileExtensionIs;
|
||||
function fileExtensionIsAny(path, extensions) {
|
||||
@@ -2070,6 +2079,8 @@ var ts;
|
||||
}
|
||||
ts.objectAllocator = {
|
||||
getNodeConstructor: function () { return Node; },
|
||||
getTokenConstructor: function () { return Node; },
|
||||
getIdentifierConstructor: function () { return Node; },
|
||||
getSourceFileConstructor: function () { return Node; },
|
||||
getSymbolConstructor: function () { return Symbol; },
|
||||
getTypeConstructor: function () { return Type; },
|
||||
@@ -2216,7 +2227,7 @@ var ts;
|
||||
function readDirectory(path, extensions, excludes, includes) {
|
||||
return ts.matchFiles(path, extensions, excludes, includes, /*useCaseSensitiveFileNames*/ false, shell.CurrentDirectory, getAccessibleFileSystemEntries);
|
||||
}
|
||||
return {
|
||||
var wscriptSystem = {
|
||||
args: args,
|
||||
newLine: "\r\n",
|
||||
useCaseSensitiveFileNames: false,
|
||||
@@ -2235,7 +2246,7 @@ var ts;
|
||||
return fso.FolderExists(path);
|
||||
},
|
||||
createDirectory: function (directoryName) {
|
||||
if (!this.directoryExists(directoryName)) {
|
||||
if (!wscriptSystem.directoryExists(directoryName)) {
|
||||
fso.CreateFolder(directoryName);
|
||||
}
|
||||
},
|
||||
@@ -2255,6 +2266,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
};
|
||||
return wscriptSystem;
|
||||
}
|
||||
function getNodeSystem() {
|
||||
var _fs = require("fs");
|
||||
@@ -2444,7 +2456,7 @@ var ts;
|
||||
function getDirectories(path) {
|
||||
return ts.filter(_fs.readdirSync(path), function (p) { return fileSystemEntryExists(ts.combinePaths(path, p), 1 /* Directory */); });
|
||||
}
|
||||
return {
|
||||
var nodeSystem = {
|
||||
args: process.argv.slice(2),
|
||||
newLine: _os.EOL,
|
||||
useCaseSensitiveFileNames: useCaseSensitiveFileNames,
|
||||
@@ -2500,7 +2512,7 @@ var ts;
|
||||
fileExists: fileExists,
|
||||
directoryExists: directoryExists,
|
||||
createDirectory: function (directoryName) {
|
||||
if (!this.directoryExists(directoryName)) {
|
||||
if (!nodeSystem.directoryExists(directoryName)) {
|
||||
_fs.mkdirSync(directoryName);
|
||||
}
|
||||
},
|
||||
@@ -2548,6 +2560,7 @@ var ts;
|
||||
return _fs.realpathSync(path);
|
||||
}
|
||||
};
|
||||
return nodeSystem;
|
||||
}
|
||||
function getChakraSystem() {
|
||||
var realpath = ChakraHost.realpath && (function (path) { return ChakraHost.realpath(path); });
|
||||
@@ -3304,8 +3317,8 @@ var ts;
|
||||
Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system: { code: 6131, category: ts.DiagnosticCategory.Error, key: "Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system_6131", message: "Cannot compile modules using option '{0}' unless the '--module' flag is 'amd' or 'system'." },
|
||||
File_name_0_has_a_1_extension_stripping_it: { code: 6132, category: ts.DiagnosticCategory.Message, key: "File_name_0_has_a_1_extension_stripping_it_6132", message: "File name '{0}' has a '{1}' extension - stripping it" },
|
||||
_0_is_declared_but_never_used: { code: 6133, category: ts.DiagnosticCategory.Error, key: "_0_is_declared_but_never_used_6133", message: "'{0}' is declared but never used." },
|
||||
Report_Errors_on_Unused_Locals: { code: 6134, category: ts.DiagnosticCategory.Message, key: "Report_Errors_on_Unused_Locals_6134", message: "Report Errors on Unused Locals." },
|
||||
Report_Errors_on_Unused_Parameters: { code: 6135, category: ts.DiagnosticCategory.Message, key: "Report_Errors_on_Unused_Parameters_6135", message: "Report Errors on Unused Parameters." },
|
||||
Report_errors_on_unused_locals: { code: 6134, category: ts.DiagnosticCategory.Message, key: "Report_errors_on_unused_locals_6134", message: "Report errors on unused locals." },
|
||||
Report_errors_on_unused_parameters: { code: 6135, category: ts.DiagnosticCategory.Message, key: "Report_errors_on_unused_parameters_6135", message: "Report errors on unused parameters." },
|
||||
The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files: { code: 6136, category: ts.DiagnosticCategory.Message, key: "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136", message: "The maximum dependency depth to search under node_modules and load JavaScript files" },
|
||||
No_types_specified_in_package_json_but_allowJs_is_set_so_returning_main_value_of_0: { code: 6137, category: ts.DiagnosticCategory.Message, key: "No_types_specified_in_package_json_but_allowJs_is_set_so_returning_main_value_of_0_6137", message: "No types specified in 'package.json' but 'allowJs' is set, so returning 'main' value of '{0}'" },
|
||||
Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_an_1_type_7005", message: "Variable '{0}' implicitly has an '{1}' type." },
|
||||
@@ -6153,7 +6166,7 @@ var ts;
|
||||
function isExternalModuleNameRelative(moduleName) {
|
||||
// TypeScript 1.0 spec (April 2014): 11.2.1
|
||||
// An external module name is "relative" if the first term is "." or "..".
|
||||
return moduleName.substr(0, 2) === "./" || moduleName.substr(0, 3) === "../" || moduleName.substr(0, 2) === ".\\" || moduleName.substr(0, 3) === "..\\";
|
||||
return /^\.\.?($|[\\/])/.test(moduleName);
|
||||
}
|
||||
ts.isExternalModuleNameRelative = isExternalModuleNameRelative;
|
||||
function isInstantiatedModule(node, preserveConstEnums) {
|
||||
@@ -7916,15 +7929,6 @@ var ts;
|
||||
return node.flags & 92 /* ParameterPropertyModifier */ && node.parent.kind === 148 /* Constructor */ && ts.isClassLike(node.parent.parent);
|
||||
}
|
||||
ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration;
|
||||
function startsWith(str, prefix) {
|
||||
return str.lastIndexOf(prefix, 0) === 0;
|
||||
}
|
||||
ts.startsWith = startsWith;
|
||||
function endsWith(str, suffix) {
|
||||
var expectedPos = str.length - suffix.length;
|
||||
return str.indexOf(suffix, expectedPos) === expectedPos;
|
||||
}
|
||||
ts.endsWith = endsWith;
|
||||
})(ts || (ts = {}));
|
||||
/// <reference path="utilities.ts"/>
|
||||
/// <reference path="scanner.ts"/>
|
||||
@@ -7932,11 +7936,19 @@ var ts;
|
||||
(function (ts) {
|
||||
/* @internal */ ts.parseTime = 0;
|
||||
var NodeConstructor;
|
||||
var TokenConstructor;
|
||||
var IdentifierConstructor;
|
||||
var SourceFileConstructor;
|
||||
function createNode(kind, pos, end) {
|
||||
if (kind === 256 /* SourceFile */) {
|
||||
return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end);
|
||||
}
|
||||
else if (kind === 69 /* Identifier */) {
|
||||
return new (IdentifierConstructor || (IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor()))(kind, pos, end);
|
||||
}
|
||||
else if (kind < 139 /* FirstNode */) {
|
||||
return new (TokenConstructor || (TokenConstructor = ts.objectAllocator.getTokenConstructor()))(kind, pos, end);
|
||||
}
|
||||
else {
|
||||
return new (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor()))(kind, pos, end);
|
||||
}
|
||||
@@ -8386,6 +8398,8 @@ var ts;
|
||||
var disallowInAndDecoratorContext = 4194304 /* DisallowInContext */ | 16777216 /* DecoratorContext */;
|
||||
// capture constructors in 'initializeState' to avoid null checks
|
||||
var NodeConstructor;
|
||||
var TokenConstructor;
|
||||
var IdentifierConstructor;
|
||||
var SourceFileConstructor;
|
||||
var sourceFile;
|
||||
var parseDiagnostics;
|
||||
@@ -8485,6 +8499,8 @@ var ts;
|
||||
}
|
||||
function initializeState(fileName, _sourceText, languageVersion, _syntaxCursor, scriptKind) {
|
||||
NodeConstructor = ts.objectAllocator.getNodeConstructor();
|
||||
TokenConstructor = ts.objectAllocator.getTokenConstructor();
|
||||
IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor();
|
||||
SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor();
|
||||
sourceText = _sourceText;
|
||||
syntaxCursor = _syntaxCursor;
|
||||
@@ -8855,7 +8871,9 @@ var ts;
|
||||
if (!(pos >= 0)) {
|
||||
pos = scanner.getStartPos();
|
||||
}
|
||||
return new NodeConstructor(kind, pos, pos);
|
||||
return kind >= 139 /* FirstNode */ ? new NodeConstructor(kind, pos, pos) :
|
||||
kind === 69 /* Identifier */ ? new IdentifierConstructor(kind, pos, pos) :
|
||||
new TokenConstructor(kind, pos, pos);
|
||||
}
|
||||
function finishNode(node, end) {
|
||||
node.end = end === undefined ? scanner.getStartPos() : end;
|
||||
@@ -13524,6 +13542,9 @@ var ts;
|
||||
case 55 /* AtToken */:
|
||||
if (canParseTag) {
|
||||
parentTagTerminated = !tryParseChildTag(jsDocTypeLiteral);
|
||||
if (!parentTagTerminated) {
|
||||
resumePos = scanner.getStartPos();
|
||||
}
|
||||
}
|
||||
seenAsterisk = false;
|
||||
break;
|
||||
@@ -18991,22 +19012,24 @@ var ts;
|
||||
if (declaration.kind === 235 /* ExportAssignment */) {
|
||||
return links.type = checkExpression(declaration.expression);
|
||||
}
|
||||
if (declaration.flags & 134217728 /* JavaScriptFile */ && declaration.kind === 280 /* JSDocPropertyTag */ && declaration.typeExpression) {
|
||||
return links.type = getTypeFromTypeNode(declaration.typeExpression.type);
|
||||
}
|
||||
// Handle variable, parameter or property
|
||||
if (!pushTypeResolution(symbol, 0 /* Type */)) {
|
||||
return unknownType;
|
||||
}
|
||||
var type = undefined;
|
||||
// Handle module.exports = expr or this.p = expr
|
||||
if (declaration.kind === 187 /* BinaryExpression */) {
|
||||
type = getUnionType(ts.map(symbol.declarations, function (decl) { return checkExpressionCached(decl.right); }));
|
||||
}
|
||||
else if (declaration.kind === 172 /* PropertyAccessExpression */) {
|
||||
// Declarations only exist for property access expressions for certain
|
||||
// special assignment kinds
|
||||
if (declaration.parent.kind === 187 /* BinaryExpression */) {
|
||||
// Handle exports.p = expr or className.prototype.method = expr
|
||||
type = checkExpressionCached(declaration.parent.right);
|
||||
}
|
||||
// Handle certain special assignment kinds, which happen to union across multiple declarations:
|
||||
// * module.exports = expr
|
||||
// * exports.p = expr
|
||||
// * this.p = expr
|
||||
// * className.prototype.method = expr
|
||||
if (declaration.kind === 187 /* BinaryExpression */ ||
|
||||
declaration.kind === 172 /* PropertyAccessExpression */ && declaration.parent.kind === 187 /* BinaryExpression */) {
|
||||
type = getUnionType(ts.map(symbol.declarations, function (decl) { return decl.kind === 187 /* BinaryExpression */ ?
|
||||
checkExpressionCached(decl.right) :
|
||||
checkExpressionCached(decl.parent.right); }));
|
||||
}
|
||||
if (type === undefined) {
|
||||
type = getWidenedTypeForVariableLikeDeclaration(declaration, /*reportErrors*/ true);
|
||||
@@ -26761,7 +26784,7 @@ var ts;
|
||||
function getInferredClassType(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
if (!links.inferredClassType) {
|
||||
links.inferredClassType = createAnonymousType(undefined, symbol.members, emptyArray, emptyArray, /*stringIndexType*/ undefined, /*numberIndexType*/ undefined);
|
||||
links.inferredClassType = createAnonymousType(symbol, symbol.members, emptyArray, emptyArray, /*stringIndexType*/ undefined, /*numberIndexType*/ undefined);
|
||||
}
|
||||
return links.inferredClassType;
|
||||
}
|
||||
@@ -28202,7 +28225,7 @@ var ts;
|
||||
checkAsyncFunctionReturnType(node);
|
||||
}
|
||||
}
|
||||
if (!node.body) {
|
||||
if (noUnusedIdentifiers && !node.body) {
|
||||
checkUnusedTypeParameters(node);
|
||||
}
|
||||
}
|
||||
@@ -29341,6 +29364,7 @@ var ts;
|
||||
var parameter = local_1.valueDeclaration;
|
||||
if (compilerOptions.noUnusedParameters &&
|
||||
!ts.isParameterPropertyDeclaration(parameter) &&
|
||||
!parameterIsThisKeyword(parameter) &&
|
||||
!parameterNameStartsWithUnderscore(parameter)) {
|
||||
error(local_1.valueDeclaration.name, ts.Diagnostics._0_is_declared_but_never_used, local_1.name);
|
||||
}
|
||||
@@ -29356,6 +29380,9 @@ var ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
function parameterIsThisKeyword(parameter) {
|
||||
return parameter.name && parameter.name.originalKeywordKind === 97 /* ThisKeyword */;
|
||||
}
|
||||
function parameterNameStartsWithUnderscore(parameter) {
|
||||
return parameter.name && parameter.name.kind === 69 /* Identifier */ && parameter.name.text.charCodeAt(0) === 95 /* _ */;
|
||||
}
|
||||
@@ -29384,9 +29411,16 @@ var ts;
|
||||
function checkUnusedTypeParameters(node) {
|
||||
if (compilerOptions.noUnusedLocals && !ts.isInAmbientContext(node)) {
|
||||
if (node.typeParameters) {
|
||||
// Only report errors on the last declaration for the type parameter container;
|
||||
// this ensures that all uses have been accounted for.
|
||||
var symbol = getSymbolOfNode(node);
|
||||
var lastDeclaration = symbol && symbol.declarations && ts.lastOrUndefined(symbol.declarations);
|
||||
if (lastDeclaration !== node) {
|
||||
return;
|
||||
}
|
||||
for (var _i = 0, _a = node.typeParameters; _i < _a.length; _i++) {
|
||||
var typeParameter = _a[_i];
|
||||
if (!typeParameter.symbol.isReferenced) {
|
||||
if (!getMergedSymbol(typeParameter.symbol).isReferenced) {
|
||||
error(typeParameter.name, ts.Diagnostics._0_is_declared_but_never_used, typeParameter.symbol.name);
|
||||
}
|
||||
}
|
||||
@@ -30719,7 +30753,7 @@ var ts;
|
||||
ts.forEach(node.members, checkSourceElement);
|
||||
if (produceDiagnostics) {
|
||||
checkTypeForDuplicateIndexSignatures(node);
|
||||
checkUnusedTypeParameters(node);
|
||||
registerForUnusedIdentifiersCheck(node);
|
||||
}
|
||||
}
|
||||
function checkTypeAliasDeclaration(node) {
|
||||
@@ -35983,7 +36017,7 @@ var ts;
|
||||
writeLine();
|
||||
var sourceMappingURL = sourceMap.getSourceMappingURL();
|
||||
if (sourceMappingURL) {
|
||||
write("//# sourceMappingURL=" + sourceMappingURL);
|
||||
write("//# " + "sourceMappingURL" + "=" + sourceMappingURL); // Sometimes tools can sometimes see this line as a source mapping url comment
|
||||
}
|
||||
writeEmittedFiles(writer.getText(), jsFilePath, sourceMapFilePath, /*writeByteOrderMark*/ compilerOptions.emitBOM, sourceFiles);
|
||||
// reset the state
|
||||
@@ -37880,7 +37914,7 @@ var ts;
|
||||
* if we should also export the value after its it changed
|
||||
* - check if node is a source level declaration to emit it differently,
|
||||
* i.e non-exported variable statement 'var x = 1' is hoisted so
|
||||
* we we emit variable statement 'var' should be dropped.
|
||||
* when we emit variable statement 'var' should be dropped.
|
||||
*/
|
||||
function isSourceFileLevelDeclarationInSystemJsModule(node, isExported) {
|
||||
if (!node || !isCurrentFileSystemExternalModule()) {
|
||||
@@ -40347,13 +40381,13 @@ var ts;
|
||||
if (isES6ExportedDeclaration(node) && !(node.flags & 512 /* Default */) && decoratedClassAlias === undefined) {
|
||||
write("export ");
|
||||
}
|
||||
if (!isHoistedDeclarationInSystemModule) {
|
||||
write("let ");
|
||||
}
|
||||
if (decoratedClassAlias !== undefined) {
|
||||
write("" + decoratedClassAlias);
|
||||
write("let " + decoratedClassAlias);
|
||||
}
|
||||
else {
|
||||
if (!isHoistedDeclarationInSystemModule) {
|
||||
write("let ");
|
||||
}
|
||||
emitDeclarationName(node);
|
||||
}
|
||||
write(" = ");
|
||||
@@ -40372,7 +40406,9 @@ var ts;
|
||||
//
|
||||
// We'll emit:
|
||||
//
|
||||
// (_temp = class C { ... }, _temp.a = 1, _temp.b = 2, _temp)
|
||||
// let C_1 = class C{};
|
||||
// C_1.a = 1;
|
||||
// C_1.b = 2; // so forth and so on
|
||||
//
|
||||
// This keeps the expression as an expression, while ensuring that the static parts
|
||||
// of it have been initialized by the time it is used.
|
||||
@@ -42936,7 +42972,7 @@ var ts;
|
||||
/* @internal */ ts.ioReadTime = 0;
|
||||
/* @internal */ ts.ioWriteTime = 0;
|
||||
/** The version of the TypeScript compiler release */
|
||||
ts.version = "2.0.0";
|
||||
ts.version = "2.1.0";
|
||||
var emptyArray = [];
|
||||
var defaultTypeRoots = ["node_modules/@types"];
|
||||
function findConfigFile(searchPath, fileExists) {
|
||||
@@ -43025,12 +43061,7 @@ var ts;
|
||||
return { resolvedModule: resolvedFileName ? { resolvedFileName: resolvedFileName, isExternalLibraryImport: isExternalLibraryImport } : undefined, failedLookupLocations: failedLookupLocations };
|
||||
}
|
||||
function moduleHasNonRelativeName(moduleName) {
|
||||
if (ts.isRootedDiskPath(moduleName)) {
|
||||
return false;
|
||||
}
|
||||
var i = moduleName.lastIndexOf("./", 1);
|
||||
var startsWithDotSlashOrDotDotSlash = i === 0 || (i === 1 && moduleName.charCodeAt(0) === 46 /* dot */);
|
||||
return !startsWithDotSlashOrDotDotSlash;
|
||||
return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName));
|
||||
}
|
||||
function tryReadTypesSection(packageJsonPath, baseDirectory, state) {
|
||||
var jsonContent;
|
||||
@@ -43797,6 +43828,22 @@ var ts;
|
||||
return ts.sortAndDeduplicateDiagnostics(diagnostics);
|
||||
}
|
||||
ts.getPreEmitDiagnostics = getPreEmitDiagnostics;
|
||||
function formatDiagnostics(diagnostics, host) {
|
||||
var output = "";
|
||||
for (var _i = 0, diagnostics_1 = diagnostics; _i < diagnostics_1.length; _i++) {
|
||||
var diagnostic = diagnostics_1[_i];
|
||||
if (diagnostic.file) {
|
||||
var _a = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start), line = _a.line, character = _a.character;
|
||||
var fileName = diagnostic.file.fileName;
|
||||
var relativeFileName = ts.convertToRelativePath(fileName, host.getCurrentDirectory(), function (fileName) { return host.getCanonicalFileName(fileName); });
|
||||
output += relativeFileName + "(" + (line + 1) + "," + (character + 1) + "): ";
|
||||
}
|
||||
var category = ts.DiagnosticCategory[diagnostic.category].toLowerCase();
|
||||
output += category + " TS" + diagnostic.code + ": " + flattenDiagnosticMessageText(diagnostic.messageText, host.getNewLine()) + host.getNewLine();
|
||||
}
|
||||
return output;
|
||||
}
|
||||
ts.formatDiagnostics = formatDiagnostics;
|
||||
function flattenDiagnosticMessageText(messageText, newLine) {
|
||||
if (typeof messageText === "string") {
|
||||
return messageText;
|
||||
@@ -43889,11 +43936,11 @@ var ts;
|
||||
// As all these operations happen - and are nested - within the createProgram call, they close over the below variables.
|
||||
// The current resolution depth is tracked by incrementing/decrementing as the depth first search progresses.
|
||||
var maxNodeModulesJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 2;
|
||||
var currentNodeModulesJsDepth = 0;
|
||||
var currentNodeModulesDepth = 0;
|
||||
// If a module has some of its imports skipped due to being at the depth limit under node_modules, then track
|
||||
// this, as it may be imported at a shallower depth later, and then it will need its skipped imports processed.
|
||||
var modulesWithElidedImports = {};
|
||||
// Track source files that are JavaScript files found by searching under node_modules, as these shouldn't be compiled.
|
||||
// Track source files that are source files found by searching under node_modules, as these shouldn't be compiled.
|
||||
var sourceFilesFoundSearchingNodeModules = {};
|
||||
var start = new Date().getTime();
|
||||
host = host || createCompilerHost(options);
|
||||
@@ -44150,8 +44197,7 @@ var ts;
|
||||
return noDiagnosticsTypeChecker || (noDiagnosticsTypeChecker = ts.createTypeChecker(program, /*produceDiagnostics:*/ false));
|
||||
}
|
||||
function emit(sourceFile, writeFileCallback, cancellationToken) {
|
||||
var _this = this;
|
||||
return runWithCancellationToken(function () { return emitWorker(_this, sourceFile, writeFileCallback, cancellationToken); });
|
||||
return runWithCancellationToken(function () { return emitWorker(program, sourceFile, writeFileCallback, cancellationToken); });
|
||||
}
|
||||
function isEmitBlocked(emitFileName) {
|
||||
return hasEmitBlockingDiagnostics.contains(ts.toPath(emitFileName, currentDirectory, getCanonicalFileName));
|
||||
@@ -44603,9 +44649,19 @@ var ts;
|
||||
if (file_1 && options.forceConsistentCasingInFileNames && ts.getNormalizedAbsolutePath(file_1.fileName, currentDirectory) !== ts.getNormalizedAbsolutePath(fileName, currentDirectory)) {
|
||||
reportFileNamesDifferOnlyInCasingError(fileName, file_1.fileName, refFile, refPos, refEnd);
|
||||
}
|
||||
// See if we need to reprocess the imports due to prior skipped imports
|
||||
if (file_1 && ts.lookUp(modulesWithElidedImports, file_1.path)) {
|
||||
if (currentNodeModulesJsDepth < maxNodeModulesJsDepth) {
|
||||
// If the file was previously found via a node_modules search, but is now being processed as a root file,
|
||||
// then everything it sucks in may also be marked incorrectly, and needs to be checked again.
|
||||
if (file_1 && ts.lookUp(sourceFilesFoundSearchingNodeModules, file_1.path) && currentNodeModulesDepth == 0) {
|
||||
sourceFilesFoundSearchingNodeModules[file_1.path] = false;
|
||||
if (!options.noResolve) {
|
||||
processReferencedFiles(file_1, ts.getDirectoryPath(fileName), isDefaultLib);
|
||||
processTypeReferenceDirectives(file_1);
|
||||
}
|
||||
modulesWithElidedImports[file_1.path] = false;
|
||||
processImportedModules(file_1, ts.getDirectoryPath(fileName));
|
||||
}
|
||||
else if (file_1 && ts.lookUp(modulesWithElidedImports, file_1.path)) {
|
||||
if (currentNodeModulesDepth < maxNodeModulesJsDepth) {
|
||||
modulesWithElidedImports[file_1.path] = false;
|
||||
processImportedModules(file_1, ts.getDirectoryPath(fileName));
|
||||
}
|
||||
@@ -44623,6 +44679,7 @@ var ts;
|
||||
});
|
||||
filesByName.set(path, file);
|
||||
if (file) {
|
||||
sourceFilesFoundSearchingNodeModules[path] = (currentNodeModulesDepth > 0);
|
||||
file.path = path;
|
||||
if (host.useCaseSensitiveFileNames()) {
|
||||
// for case-sensitive file systems check if we've already seen some file with similar filename ignoring case
|
||||
@@ -44737,12 +44794,9 @@ var ts;
|
||||
var isFromNodeModulesSearch = resolution && resolution.isExternalLibraryImport;
|
||||
var isJsFileFromNodeModules = isFromNodeModulesSearch && ts.hasJavaScriptFileExtension(resolution.resolvedFileName);
|
||||
if (isFromNodeModulesSearch) {
|
||||
sourceFilesFoundSearchingNodeModules[resolvedPath] = true;
|
||||
currentNodeModulesDepth++;
|
||||
}
|
||||
if (isJsFileFromNodeModules) {
|
||||
currentNodeModulesJsDepth++;
|
||||
}
|
||||
var elideImport = isJsFileFromNodeModules && currentNodeModulesJsDepth > maxNodeModulesJsDepth;
|
||||
var elideImport = isJsFileFromNodeModules && currentNodeModulesDepth > maxNodeModulesJsDepth;
|
||||
var shouldAddFile = resolution && !options.noResolve && i < file.imports.length && !elideImport;
|
||||
if (elideImport) {
|
||||
modulesWithElidedImports[file.path] = true;
|
||||
@@ -44751,8 +44805,8 @@ var ts;
|
||||
findSourceFile(resolution.resolvedFileName, resolvedPath,
|
||||
/*isDefaultLib*/ false, /*isReference*/ false, file, ts.skipTrivia(file.text, file.imports[i].pos), file.imports[i].end);
|
||||
}
|
||||
if (isJsFileFromNodeModules) {
|
||||
currentNodeModulesJsDepth--;
|
||||
if (isFromNodeModulesSearch) {
|
||||
currentNodeModulesDepth--;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45090,12 +45144,12 @@ var ts;
|
||||
{
|
||||
name: "noUnusedLocals",
|
||||
type: "boolean",
|
||||
description: ts.Diagnostics.Report_Errors_on_Unused_Locals
|
||||
description: ts.Diagnostics.Report_errors_on_unused_locals
|
||||
},
|
||||
{
|
||||
name: "noUnusedParameters",
|
||||
type: "boolean",
|
||||
description: ts.Diagnostics.Report_Errors_on_Unused_Parameters
|
||||
description: ts.Diagnostics.Report_errors_on_unused_parameters
|
||||
},
|
||||
{
|
||||
name: "noLib",
|
||||
@@ -47087,7 +47141,7 @@ var ts;
|
||||
else {
|
||||
// b) Check if the part is a prefix of the candidate, in a case insensitive or sensitive
|
||||
// manner. If it does, return that there was a prefix match.
|
||||
return createPatternMatch(PatternMatchKind.prefix, punctuationStripped, /*isCaseSensitive:*/ startsWith(candidate, chunk.text));
|
||||
return createPatternMatch(PatternMatchKind.prefix, punctuationStripped, /*isCaseSensitive:*/ ts.startsWith(candidate, chunk.text));
|
||||
}
|
||||
}
|
||||
var isLowercase = chunk.isLowerCase;
|
||||
@@ -47353,14 +47407,6 @@ var ts;
|
||||
var str = String.fromCharCode(ch);
|
||||
return str === str.toLowerCase();
|
||||
}
|
||||
function startsWith(string, search) {
|
||||
for (var i = 0, n = search.length; i < n; i++) {
|
||||
if (string.charCodeAt(i) !== search.charCodeAt(i)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// Assumes 'value' is already lowercase.
|
||||
function indexOfIgnoringCase(string, value) {
|
||||
for (var i = 0, n = string.length - value.length; i <= n; i++) {
|
||||
@@ -49205,6 +49251,7 @@ var ts;
|
||||
ScanAction[ScanAction["RescanSlashToken"] = 2] = "RescanSlashToken";
|
||||
ScanAction[ScanAction["RescanTemplateToken"] = 3] = "RescanTemplateToken";
|
||||
ScanAction[ScanAction["RescanJsxIdentifier"] = 4] = "RescanJsxIdentifier";
|
||||
ScanAction[ScanAction["RescanJsxText"] = 5] = "RescanJsxText";
|
||||
})(ScanAction || (ScanAction = {}));
|
||||
function getFormattingScanner(sourceFile, startPos, endPos) {
|
||||
ts.Debug.assert(scanner === undefined);
|
||||
@@ -49296,6 +49343,9 @@ var ts;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function shouldRescanJsxText(node) {
|
||||
return node && node.kind === 244 /* JsxText */;
|
||||
}
|
||||
function shouldRescanSlashToken(container) {
|
||||
return container.kind === 10 /* RegularExpressionLiteral */;
|
||||
}
|
||||
@@ -49326,7 +49376,9 @@ var ts;
|
||||
? 3 /* RescanTemplateToken */
|
||||
: shouldRescanJsxIdentifier(n)
|
||||
? 4 /* RescanJsxIdentifier */
|
||||
: 0 /* Scan */;
|
||||
: shouldRescanJsxText(n)
|
||||
? 5 /* RescanJsxText */
|
||||
: 0 /* Scan */;
|
||||
if (lastTokenInfo && expectedScanAction === lastScanAction) {
|
||||
// readTokenInfo was called before with the same expected scan action.
|
||||
// No need to re-scan text, return existing 'lastTokenInfo'
|
||||
@@ -49361,6 +49413,10 @@ var ts;
|
||||
currentToken = scanner.scanJsxIdentifier();
|
||||
lastScanAction = 4 /* RescanJsxIdentifier */;
|
||||
}
|
||||
else if (expectedScanAction === 5 /* RescanJsxText */) {
|
||||
currentToken = scanner.reScanJsxToken();
|
||||
lastScanAction = 5 /* RescanJsxText */;
|
||||
}
|
||||
else {
|
||||
lastScanAction = 0 /* Scan */;
|
||||
}
|
||||
@@ -52033,19 +52089,20 @@ var ts;
|
||||
"version"
|
||||
];
|
||||
var jsDocCompletionEntries;
|
||||
function createNode(kind, pos, end, flags, parent) {
|
||||
var node = new NodeObject(kind, pos, end);
|
||||
node.flags = flags;
|
||||
function createNode(kind, pos, end, parent) {
|
||||
var node = kind >= 139 /* FirstNode */ ? new NodeObject(kind, pos, end) :
|
||||
kind === 69 /* Identifier */ ? new IdentifierObject(kind, pos, end) :
|
||||
new TokenObject(kind, pos, end);
|
||||
node.parent = parent;
|
||||
return node;
|
||||
}
|
||||
var NodeObject = (function () {
|
||||
function NodeObject(kind, pos, end) {
|
||||
this.kind = kind;
|
||||
this.pos = pos;
|
||||
this.end = end;
|
||||
this.flags = 0 /* None */;
|
||||
this.parent = undefined;
|
||||
this.kind = kind;
|
||||
}
|
||||
NodeObject.prototype.getSourceFile = function () {
|
||||
return ts.getSourceFileOfNode(this);
|
||||
@@ -52080,14 +52137,14 @@ var ts;
|
||||
var token = useJSDocScanner ? scanner.scanJSDocToken() : scanner.scan();
|
||||
var textPos = scanner.getTextPos();
|
||||
if (textPos <= end) {
|
||||
nodes.push(createNode(token, pos, textPos, 0, this));
|
||||
nodes.push(createNode(token, pos, textPos, this));
|
||||
}
|
||||
pos = textPos;
|
||||
}
|
||||
return pos;
|
||||
};
|
||||
NodeObject.prototype.createSyntaxList = function (nodes) {
|
||||
var list = createNode(282 /* SyntaxList */, nodes.pos, nodes.end, 0, this);
|
||||
var list = createNode(282 /* SyntaxList */, nodes.pos, nodes.end, this);
|
||||
list._children = [];
|
||||
var pos = nodes.pos;
|
||||
for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) {
|
||||
@@ -52173,6 +52230,74 @@ var ts;
|
||||
};
|
||||
return NodeObject;
|
||||
}());
|
||||
var TokenOrIdentifierObject = (function () {
|
||||
function TokenOrIdentifierObject(pos, end) {
|
||||
// Set properties in same order as NodeObject
|
||||
this.pos = pos;
|
||||
this.end = end;
|
||||
this.flags = 0 /* None */;
|
||||
this.parent = undefined;
|
||||
}
|
||||
TokenOrIdentifierObject.prototype.getSourceFile = function () {
|
||||
return ts.getSourceFileOfNode(this);
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getStart = function (sourceFile, includeJsDocComment) {
|
||||
return ts.getTokenPosOfNode(this, sourceFile, includeJsDocComment);
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getFullStart = function () {
|
||||
return this.pos;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getEnd = function () {
|
||||
return this.end;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getWidth = function (sourceFile) {
|
||||
return this.getEnd() - this.getStart(sourceFile);
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getFullWidth = function () {
|
||||
return this.end - this.pos;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getLeadingTriviaWidth = function (sourceFile) {
|
||||
return this.getStart(sourceFile) - this.pos;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getFullText = function (sourceFile) {
|
||||
return (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end);
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getText = function (sourceFile) {
|
||||
return (sourceFile || this.getSourceFile()).text.substring(this.getStart(), this.getEnd());
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getChildCount = function (sourceFile) {
|
||||
return 0;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getChildAt = function (index, sourceFile) {
|
||||
return undefined;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getChildren = function (sourceFile) {
|
||||
return emptyArray;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getFirstToken = function (sourceFile) {
|
||||
return undefined;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getLastToken = function (sourceFile) {
|
||||
return undefined;
|
||||
};
|
||||
return TokenOrIdentifierObject;
|
||||
}());
|
||||
var TokenObject = (function (_super) {
|
||||
__extends(TokenObject, _super);
|
||||
function TokenObject(kind, pos, end) {
|
||||
_super.call(this, pos, end);
|
||||
this.kind = kind;
|
||||
}
|
||||
return TokenObject;
|
||||
}(TokenOrIdentifierObject));
|
||||
var IdentifierObject = (function (_super) {
|
||||
__extends(IdentifierObject, _super);
|
||||
function IdentifierObject(kind, pos, end) {
|
||||
_super.call(this, pos, end);
|
||||
}
|
||||
return IdentifierObject;
|
||||
}(TokenOrIdentifierObject));
|
||||
IdentifierObject.prototype.kind = 69 /* Identifier */;
|
||||
var SymbolObject = (function () {
|
||||
function SymbolObject(flags, name) {
|
||||
this.flags = flags;
|
||||
@@ -58937,6 +59062,8 @@ var ts;
|
||||
function initializeServices() {
|
||||
ts.objectAllocator = {
|
||||
getNodeConstructor: function () { return NodeObject; },
|
||||
getTokenConstructor: function () { return TokenObject; },
|
||||
getIdentifierConstructor: function () { return IdentifierObject; },
|
||||
getSourceFileConstructor: function () { return SourceFileObject; },
|
||||
getSymbolConstructor: function () { return SymbolObject; },
|
||||
getTypeConstructor: function () { return TypeObject; },
|
||||
@@ -59562,7 +59689,7 @@ var ts;
|
||||
//
|
||||
/// <reference path='services.ts' />
|
||||
/* @internal */
|
||||
var debugObjectHost = this;
|
||||
var debugObjectHost = new Function("return this")();
|
||||
// We need to use 'null' to interface with the managed side.
|
||||
/* tslint:disable:no-null-keyword */
|
||||
/* tslint:disable:no-in-operator */
|
||||
@@ -59701,7 +59828,7 @@ var ts;
|
||||
return this.shimHost.getCurrentDirectory();
|
||||
};
|
||||
LanguageServiceShimHostAdapter.prototype.getDirectories = function (path) {
|
||||
return this.shimHost.getDirectories(path);
|
||||
return JSON.parse(this.shimHost.getDirectories(path));
|
||||
};
|
||||
LanguageServiceShimHostAdapter.prototype.getDefaultLibFileName = function (options) {
|
||||
return this.shimHost.getDefaultLibFileName(JSON.stringify(options));
|
||||
|
||||
Vendored
+10
-4
@@ -409,7 +409,10 @@ declare namespace ts {
|
||||
interface ModifiersArray extends NodeArray<Modifier> {
|
||||
flags: NodeFlags;
|
||||
}
|
||||
interface Modifier extends Node {
|
||||
interface Token extends Node {
|
||||
__tokenTag: any;
|
||||
}
|
||||
interface Modifier extends Token {
|
||||
}
|
||||
interface Identifier extends PrimaryExpression {
|
||||
text: string;
|
||||
@@ -1696,7 +1699,6 @@ declare namespace ts {
|
||||
getCancellationToken?(): CancellationToken;
|
||||
getDefaultLibFileName(options: CompilerOptions): string;
|
||||
getDefaultLibLocation?(): string;
|
||||
getDefaultTypeDirectiveNames?(rootPath: string): string[];
|
||||
writeFile: WriteFileCallback;
|
||||
getCurrentDirectory(): string;
|
||||
getDirectories(path: string): string[];
|
||||
@@ -1842,8 +1844,6 @@ declare namespace ts {
|
||||
function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange;
|
||||
function getTypeParameterOwner(d: Declaration): Declaration;
|
||||
function isParameterPropertyDeclaration(node: ParameterDeclaration): boolean;
|
||||
function startsWith(str: string, prefix: string): boolean;
|
||||
function endsWith(str: string, suffix: string): boolean;
|
||||
}
|
||||
declare namespace ts {
|
||||
function createNode(kind: SyntaxKind, pos?: number, end?: number): Node;
|
||||
@@ -1868,6 +1868,12 @@ declare namespace ts {
|
||||
function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations;
|
||||
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
|
||||
function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[];
|
||||
interface FormatDiagnosticsHost {
|
||||
getCurrentDirectory(): string;
|
||||
getCanonicalFileName(fileName: string): string;
|
||||
getNewLine(): string;
|
||||
}
|
||||
function formatDiagnostics(diagnostics: Diagnostic[], host: FormatDiagnosticsHost): string;
|
||||
function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;
|
||||
/**
|
||||
* Given a set of options and a set of root files, returns the set of type directive names
|
||||
|
||||
+210
-83
@@ -1756,10 +1756,19 @@ var ts;
|
||||
return true;
|
||||
}
|
||||
ts.containsPath = containsPath;
|
||||
/* @internal */
|
||||
function startsWith(str, prefix) {
|
||||
return str.lastIndexOf(prefix, 0) === 0;
|
||||
}
|
||||
ts.startsWith = startsWith;
|
||||
/* @internal */
|
||||
function endsWith(str, suffix) {
|
||||
var expectedPos = str.length - suffix.length;
|
||||
return expectedPos >= 0 && str.indexOf(suffix, expectedPos) === expectedPos;
|
||||
}
|
||||
ts.endsWith = endsWith;
|
||||
function fileExtensionIs(path, extension) {
|
||||
var pathLen = path.length;
|
||||
var extLen = extension.length;
|
||||
return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension;
|
||||
return path.length > extension.length && endsWith(path, extension);
|
||||
}
|
||||
ts.fileExtensionIs = fileExtensionIs;
|
||||
function fileExtensionIsAny(path, extensions) {
|
||||
@@ -2070,6 +2079,8 @@ var ts;
|
||||
}
|
||||
ts.objectAllocator = {
|
||||
getNodeConstructor: function () { return Node; },
|
||||
getTokenConstructor: function () { return Node; },
|
||||
getIdentifierConstructor: function () { return Node; },
|
||||
getSourceFileConstructor: function () { return Node; },
|
||||
getSymbolConstructor: function () { return Symbol; },
|
||||
getTypeConstructor: function () { return Type; },
|
||||
@@ -2216,7 +2227,7 @@ var ts;
|
||||
function readDirectory(path, extensions, excludes, includes) {
|
||||
return ts.matchFiles(path, extensions, excludes, includes, /*useCaseSensitiveFileNames*/ false, shell.CurrentDirectory, getAccessibleFileSystemEntries);
|
||||
}
|
||||
return {
|
||||
var wscriptSystem = {
|
||||
args: args,
|
||||
newLine: "\r\n",
|
||||
useCaseSensitiveFileNames: false,
|
||||
@@ -2235,7 +2246,7 @@ var ts;
|
||||
return fso.FolderExists(path);
|
||||
},
|
||||
createDirectory: function (directoryName) {
|
||||
if (!this.directoryExists(directoryName)) {
|
||||
if (!wscriptSystem.directoryExists(directoryName)) {
|
||||
fso.CreateFolder(directoryName);
|
||||
}
|
||||
},
|
||||
@@ -2255,6 +2266,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
};
|
||||
return wscriptSystem;
|
||||
}
|
||||
function getNodeSystem() {
|
||||
var _fs = require("fs");
|
||||
@@ -2444,7 +2456,7 @@ var ts;
|
||||
function getDirectories(path) {
|
||||
return ts.filter(_fs.readdirSync(path), function (p) { return fileSystemEntryExists(ts.combinePaths(path, p), 1 /* Directory */); });
|
||||
}
|
||||
return {
|
||||
var nodeSystem = {
|
||||
args: process.argv.slice(2),
|
||||
newLine: _os.EOL,
|
||||
useCaseSensitiveFileNames: useCaseSensitiveFileNames,
|
||||
@@ -2500,7 +2512,7 @@ var ts;
|
||||
fileExists: fileExists,
|
||||
directoryExists: directoryExists,
|
||||
createDirectory: function (directoryName) {
|
||||
if (!this.directoryExists(directoryName)) {
|
||||
if (!nodeSystem.directoryExists(directoryName)) {
|
||||
_fs.mkdirSync(directoryName);
|
||||
}
|
||||
},
|
||||
@@ -2548,6 +2560,7 @@ var ts;
|
||||
return _fs.realpathSync(path);
|
||||
}
|
||||
};
|
||||
return nodeSystem;
|
||||
}
|
||||
function getChakraSystem() {
|
||||
var realpath = ChakraHost.realpath && (function (path) { return ChakraHost.realpath(path); });
|
||||
@@ -3304,8 +3317,8 @@ var ts;
|
||||
Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system: { code: 6131, category: ts.DiagnosticCategory.Error, key: "Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system_6131", message: "Cannot compile modules using option '{0}' unless the '--module' flag is 'amd' or 'system'." },
|
||||
File_name_0_has_a_1_extension_stripping_it: { code: 6132, category: ts.DiagnosticCategory.Message, key: "File_name_0_has_a_1_extension_stripping_it_6132", message: "File name '{0}' has a '{1}' extension - stripping it" },
|
||||
_0_is_declared_but_never_used: { code: 6133, category: ts.DiagnosticCategory.Error, key: "_0_is_declared_but_never_used_6133", message: "'{0}' is declared but never used." },
|
||||
Report_Errors_on_Unused_Locals: { code: 6134, category: ts.DiagnosticCategory.Message, key: "Report_Errors_on_Unused_Locals_6134", message: "Report Errors on Unused Locals." },
|
||||
Report_Errors_on_Unused_Parameters: { code: 6135, category: ts.DiagnosticCategory.Message, key: "Report_Errors_on_Unused_Parameters_6135", message: "Report Errors on Unused Parameters." },
|
||||
Report_errors_on_unused_locals: { code: 6134, category: ts.DiagnosticCategory.Message, key: "Report_errors_on_unused_locals_6134", message: "Report errors on unused locals." },
|
||||
Report_errors_on_unused_parameters: { code: 6135, category: ts.DiagnosticCategory.Message, key: "Report_errors_on_unused_parameters_6135", message: "Report errors on unused parameters." },
|
||||
The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files: { code: 6136, category: ts.DiagnosticCategory.Message, key: "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136", message: "The maximum dependency depth to search under node_modules and load JavaScript files" },
|
||||
No_types_specified_in_package_json_but_allowJs_is_set_so_returning_main_value_of_0: { code: 6137, category: ts.DiagnosticCategory.Message, key: "No_types_specified_in_package_json_but_allowJs_is_set_so_returning_main_value_of_0_6137", message: "No types specified in 'package.json' but 'allowJs' is set, so returning 'main' value of '{0}'" },
|
||||
Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_an_1_type_7005", message: "Variable '{0}' implicitly has an '{1}' type." },
|
||||
@@ -6153,7 +6166,7 @@ var ts;
|
||||
function isExternalModuleNameRelative(moduleName) {
|
||||
// TypeScript 1.0 spec (April 2014): 11.2.1
|
||||
// An external module name is "relative" if the first term is "." or "..".
|
||||
return moduleName.substr(0, 2) === "./" || moduleName.substr(0, 3) === "../" || moduleName.substr(0, 2) === ".\\" || moduleName.substr(0, 3) === "..\\";
|
||||
return /^\.\.?($|[\\/])/.test(moduleName);
|
||||
}
|
||||
ts.isExternalModuleNameRelative = isExternalModuleNameRelative;
|
||||
function isInstantiatedModule(node, preserveConstEnums) {
|
||||
@@ -7916,15 +7929,6 @@ var ts;
|
||||
return node.flags & 92 /* ParameterPropertyModifier */ && node.parent.kind === 148 /* Constructor */ && ts.isClassLike(node.parent.parent);
|
||||
}
|
||||
ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration;
|
||||
function startsWith(str, prefix) {
|
||||
return str.lastIndexOf(prefix, 0) === 0;
|
||||
}
|
||||
ts.startsWith = startsWith;
|
||||
function endsWith(str, suffix) {
|
||||
var expectedPos = str.length - suffix.length;
|
||||
return str.indexOf(suffix, expectedPos) === expectedPos;
|
||||
}
|
||||
ts.endsWith = endsWith;
|
||||
})(ts || (ts = {}));
|
||||
/// <reference path="utilities.ts"/>
|
||||
/// <reference path="scanner.ts"/>
|
||||
@@ -7932,11 +7936,19 @@ var ts;
|
||||
(function (ts) {
|
||||
/* @internal */ ts.parseTime = 0;
|
||||
var NodeConstructor;
|
||||
var TokenConstructor;
|
||||
var IdentifierConstructor;
|
||||
var SourceFileConstructor;
|
||||
function createNode(kind, pos, end) {
|
||||
if (kind === 256 /* SourceFile */) {
|
||||
return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end);
|
||||
}
|
||||
else if (kind === 69 /* Identifier */) {
|
||||
return new (IdentifierConstructor || (IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor()))(kind, pos, end);
|
||||
}
|
||||
else if (kind < 139 /* FirstNode */) {
|
||||
return new (TokenConstructor || (TokenConstructor = ts.objectAllocator.getTokenConstructor()))(kind, pos, end);
|
||||
}
|
||||
else {
|
||||
return new (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor()))(kind, pos, end);
|
||||
}
|
||||
@@ -8386,6 +8398,8 @@ var ts;
|
||||
var disallowInAndDecoratorContext = 4194304 /* DisallowInContext */ | 16777216 /* DecoratorContext */;
|
||||
// capture constructors in 'initializeState' to avoid null checks
|
||||
var NodeConstructor;
|
||||
var TokenConstructor;
|
||||
var IdentifierConstructor;
|
||||
var SourceFileConstructor;
|
||||
var sourceFile;
|
||||
var parseDiagnostics;
|
||||
@@ -8485,6 +8499,8 @@ var ts;
|
||||
}
|
||||
function initializeState(fileName, _sourceText, languageVersion, _syntaxCursor, scriptKind) {
|
||||
NodeConstructor = ts.objectAllocator.getNodeConstructor();
|
||||
TokenConstructor = ts.objectAllocator.getTokenConstructor();
|
||||
IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor();
|
||||
SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor();
|
||||
sourceText = _sourceText;
|
||||
syntaxCursor = _syntaxCursor;
|
||||
@@ -8855,7 +8871,9 @@ var ts;
|
||||
if (!(pos >= 0)) {
|
||||
pos = scanner.getStartPos();
|
||||
}
|
||||
return new NodeConstructor(kind, pos, pos);
|
||||
return kind >= 139 /* FirstNode */ ? new NodeConstructor(kind, pos, pos) :
|
||||
kind === 69 /* Identifier */ ? new IdentifierConstructor(kind, pos, pos) :
|
||||
new TokenConstructor(kind, pos, pos);
|
||||
}
|
||||
function finishNode(node, end) {
|
||||
node.end = end === undefined ? scanner.getStartPos() : end;
|
||||
@@ -13524,6 +13542,9 @@ var ts;
|
||||
case 55 /* AtToken */:
|
||||
if (canParseTag) {
|
||||
parentTagTerminated = !tryParseChildTag(jsDocTypeLiteral);
|
||||
if (!parentTagTerminated) {
|
||||
resumePos = scanner.getStartPos();
|
||||
}
|
||||
}
|
||||
seenAsterisk = false;
|
||||
break;
|
||||
@@ -18991,22 +19012,24 @@ var ts;
|
||||
if (declaration.kind === 235 /* ExportAssignment */) {
|
||||
return links.type = checkExpression(declaration.expression);
|
||||
}
|
||||
if (declaration.flags & 134217728 /* JavaScriptFile */ && declaration.kind === 280 /* JSDocPropertyTag */ && declaration.typeExpression) {
|
||||
return links.type = getTypeFromTypeNode(declaration.typeExpression.type);
|
||||
}
|
||||
// Handle variable, parameter or property
|
||||
if (!pushTypeResolution(symbol, 0 /* Type */)) {
|
||||
return unknownType;
|
||||
}
|
||||
var type = undefined;
|
||||
// Handle module.exports = expr or this.p = expr
|
||||
if (declaration.kind === 187 /* BinaryExpression */) {
|
||||
type = getUnionType(ts.map(symbol.declarations, function (decl) { return checkExpressionCached(decl.right); }));
|
||||
}
|
||||
else if (declaration.kind === 172 /* PropertyAccessExpression */) {
|
||||
// Declarations only exist for property access expressions for certain
|
||||
// special assignment kinds
|
||||
if (declaration.parent.kind === 187 /* BinaryExpression */) {
|
||||
// Handle exports.p = expr or className.prototype.method = expr
|
||||
type = checkExpressionCached(declaration.parent.right);
|
||||
}
|
||||
// Handle certain special assignment kinds, which happen to union across multiple declarations:
|
||||
// * module.exports = expr
|
||||
// * exports.p = expr
|
||||
// * this.p = expr
|
||||
// * className.prototype.method = expr
|
||||
if (declaration.kind === 187 /* BinaryExpression */ ||
|
||||
declaration.kind === 172 /* PropertyAccessExpression */ && declaration.parent.kind === 187 /* BinaryExpression */) {
|
||||
type = getUnionType(ts.map(symbol.declarations, function (decl) { return decl.kind === 187 /* BinaryExpression */ ?
|
||||
checkExpressionCached(decl.right) :
|
||||
checkExpressionCached(decl.parent.right); }));
|
||||
}
|
||||
if (type === undefined) {
|
||||
type = getWidenedTypeForVariableLikeDeclaration(declaration, /*reportErrors*/ true);
|
||||
@@ -26761,7 +26784,7 @@ var ts;
|
||||
function getInferredClassType(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
if (!links.inferredClassType) {
|
||||
links.inferredClassType = createAnonymousType(undefined, symbol.members, emptyArray, emptyArray, /*stringIndexType*/ undefined, /*numberIndexType*/ undefined);
|
||||
links.inferredClassType = createAnonymousType(symbol, symbol.members, emptyArray, emptyArray, /*stringIndexType*/ undefined, /*numberIndexType*/ undefined);
|
||||
}
|
||||
return links.inferredClassType;
|
||||
}
|
||||
@@ -28202,7 +28225,7 @@ var ts;
|
||||
checkAsyncFunctionReturnType(node);
|
||||
}
|
||||
}
|
||||
if (!node.body) {
|
||||
if (noUnusedIdentifiers && !node.body) {
|
||||
checkUnusedTypeParameters(node);
|
||||
}
|
||||
}
|
||||
@@ -29341,6 +29364,7 @@ var ts;
|
||||
var parameter = local_1.valueDeclaration;
|
||||
if (compilerOptions.noUnusedParameters &&
|
||||
!ts.isParameterPropertyDeclaration(parameter) &&
|
||||
!parameterIsThisKeyword(parameter) &&
|
||||
!parameterNameStartsWithUnderscore(parameter)) {
|
||||
error(local_1.valueDeclaration.name, ts.Diagnostics._0_is_declared_but_never_used, local_1.name);
|
||||
}
|
||||
@@ -29356,6 +29380,9 @@ var ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
function parameterIsThisKeyword(parameter) {
|
||||
return parameter.name && parameter.name.originalKeywordKind === 97 /* ThisKeyword */;
|
||||
}
|
||||
function parameterNameStartsWithUnderscore(parameter) {
|
||||
return parameter.name && parameter.name.kind === 69 /* Identifier */ && parameter.name.text.charCodeAt(0) === 95 /* _ */;
|
||||
}
|
||||
@@ -29384,9 +29411,16 @@ var ts;
|
||||
function checkUnusedTypeParameters(node) {
|
||||
if (compilerOptions.noUnusedLocals && !ts.isInAmbientContext(node)) {
|
||||
if (node.typeParameters) {
|
||||
// Only report errors on the last declaration for the type parameter container;
|
||||
// this ensures that all uses have been accounted for.
|
||||
var symbol = getSymbolOfNode(node);
|
||||
var lastDeclaration = symbol && symbol.declarations && ts.lastOrUndefined(symbol.declarations);
|
||||
if (lastDeclaration !== node) {
|
||||
return;
|
||||
}
|
||||
for (var _i = 0, _a = node.typeParameters; _i < _a.length; _i++) {
|
||||
var typeParameter = _a[_i];
|
||||
if (!typeParameter.symbol.isReferenced) {
|
||||
if (!getMergedSymbol(typeParameter.symbol).isReferenced) {
|
||||
error(typeParameter.name, ts.Diagnostics._0_is_declared_but_never_used, typeParameter.symbol.name);
|
||||
}
|
||||
}
|
||||
@@ -30719,7 +30753,7 @@ var ts;
|
||||
ts.forEach(node.members, checkSourceElement);
|
||||
if (produceDiagnostics) {
|
||||
checkTypeForDuplicateIndexSignatures(node);
|
||||
checkUnusedTypeParameters(node);
|
||||
registerForUnusedIdentifiersCheck(node);
|
||||
}
|
||||
}
|
||||
function checkTypeAliasDeclaration(node) {
|
||||
@@ -35983,7 +36017,7 @@ var ts;
|
||||
writeLine();
|
||||
var sourceMappingURL = sourceMap.getSourceMappingURL();
|
||||
if (sourceMappingURL) {
|
||||
write("//# sourceMappingURL=" + sourceMappingURL);
|
||||
write("//# " + "sourceMappingURL" + "=" + sourceMappingURL); // Sometimes tools can sometimes see this line as a source mapping url comment
|
||||
}
|
||||
writeEmittedFiles(writer.getText(), jsFilePath, sourceMapFilePath, /*writeByteOrderMark*/ compilerOptions.emitBOM, sourceFiles);
|
||||
// reset the state
|
||||
@@ -37880,7 +37914,7 @@ var ts;
|
||||
* if we should also export the value after its it changed
|
||||
* - check if node is a source level declaration to emit it differently,
|
||||
* i.e non-exported variable statement 'var x = 1' is hoisted so
|
||||
* we we emit variable statement 'var' should be dropped.
|
||||
* when we emit variable statement 'var' should be dropped.
|
||||
*/
|
||||
function isSourceFileLevelDeclarationInSystemJsModule(node, isExported) {
|
||||
if (!node || !isCurrentFileSystemExternalModule()) {
|
||||
@@ -40347,13 +40381,13 @@ var ts;
|
||||
if (isES6ExportedDeclaration(node) && !(node.flags & 512 /* Default */) && decoratedClassAlias === undefined) {
|
||||
write("export ");
|
||||
}
|
||||
if (!isHoistedDeclarationInSystemModule) {
|
||||
write("let ");
|
||||
}
|
||||
if (decoratedClassAlias !== undefined) {
|
||||
write("" + decoratedClassAlias);
|
||||
write("let " + decoratedClassAlias);
|
||||
}
|
||||
else {
|
||||
if (!isHoistedDeclarationInSystemModule) {
|
||||
write("let ");
|
||||
}
|
||||
emitDeclarationName(node);
|
||||
}
|
||||
write(" = ");
|
||||
@@ -40372,7 +40406,9 @@ var ts;
|
||||
//
|
||||
// We'll emit:
|
||||
//
|
||||
// (_temp = class C { ... }, _temp.a = 1, _temp.b = 2, _temp)
|
||||
// let C_1 = class C{};
|
||||
// C_1.a = 1;
|
||||
// C_1.b = 2; // so forth and so on
|
||||
//
|
||||
// This keeps the expression as an expression, while ensuring that the static parts
|
||||
// of it have been initialized by the time it is used.
|
||||
@@ -42936,7 +42972,7 @@ var ts;
|
||||
/* @internal */ ts.ioReadTime = 0;
|
||||
/* @internal */ ts.ioWriteTime = 0;
|
||||
/** The version of the TypeScript compiler release */
|
||||
ts.version = "2.0.0";
|
||||
ts.version = "2.1.0";
|
||||
var emptyArray = [];
|
||||
var defaultTypeRoots = ["node_modules/@types"];
|
||||
function findConfigFile(searchPath, fileExists) {
|
||||
@@ -43025,12 +43061,7 @@ var ts;
|
||||
return { resolvedModule: resolvedFileName ? { resolvedFileName: resolvedFileName, isExternalLibraryImport: isExternalLibraryImport } : undefined, failedLookupLocations: failedLookupLocations };
|
||||
}
|
||||
function moduleHasNonRelativeName(moduleName) {
|
||||
if (ts.isRootedDiskPath(moduleName)) {
|
||||
return false;
|
||||
}
|
||||
var i = moduleName.lastIndexOf("./", 1);
|
||||
var startsWithDotSlashOrDotDotSlash = i === 0 || (i === 1 && moduleName.charCodeAt(0) === 46 /* dot */);
|
||||
return !startsWithDotSlashOrDotDotSlash;
|
||||
return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName));
|
||||
}
|
||||
function tryReadTypesSection(packageJsonPath, baseDirectory, state) {
|
||||
var jsonContent;
|
||||
@@ -43797,6 +43828,22 @@ var ts;
|
||||
return ts.sortAndDeduplicateDiagnostics(diagnostics);
|
||||
}
|
||||
ts.getPreEmitDiagnostics = getPreEmitDiagnostics;
|
||||
function formatDiagnostics(diagnostics, host) {
|
||||
var output = "";
|
||||
for (var _i = 0, diagnostics_1 = diagnostics; _i < diagnostics_1.length; _i++) {
|
||||
var diagnostic = diagnostics_1[_i];
|
||||
if (diagnostic.file) {
|
||||
var _a = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start), line = _a.line, character = _a.character;
|
||||
var fileName = diagnostic.file.fileName;
|
||||
var relativeFileName = ts.convertToRelativePath(fileName, host.getCurrentDirectory(), function (fileName) { return host.getCanonicalFileName(fileName); });
|
||||
output += relativeFileName + "(" + (line + 1) + "," + (character + 1) + "): ";
|
||||
}
|
||||
var category = ts.DiagnosticCategory[diagnostic.category].toLowerCase();
|
||||
output += category + " TS" + diagnostic.code + ": " + flattenDiagnosticMessageText(diagnostic.messageText, host.getNewLine()) + host.getNewLine();
|
||||
}
|
||||
return output;
|
||||
}
|
||||
ts.formatDiagnostics = formatDiagnostics;
|
||||
function flattenDiagnosticMessageText(messageText, newLine) {
|
||||
if (typeof messageText === "string") {
|
||||
return messageText;
|
||||
@@ -43889,11 +43936,11 @@ var ts;
|
||||
// As all these operations happen - and are nested - within the createProgram call, they close over the below variables.
|
||||
// The current resolution depth is tracked by incrementing/decrementing as the depth first search progresses.
|
||||
var maxNodeModulesJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 2;
|
||||
var currentNodeModulesJsDepth = 0;
|
||||
var currentNodeModulesDepth = 0;
|
||||
// If a module has some of its imports skipped due to being at the depth limit under node_modules, then track
|
||||
// this, as it may be imported at a shallower depth later, and then it will need its skipped imports processed.
|
||||
var modulesWithElidedImports = {};
|
||||
// Track source files that are JavaScript files found by searching under node_modules, as these shouldn't be compiled.
|
||||
// Track source files that are source files found by searching under node_modules, as these shouldn't be compiled.
|
||||
var sourceFilesFoundSearchingNodeModules = {};
|
||||
var start = new Date().getTime();
|
||||
host = host || createCompilerHost(options);
|
||||
@@ -44150,8 +44197,7 @@ var ts;
|
||||
return noDiagnosticsTypeChecker || (noDiagnosticsTypeChecker = ts.createTypeChecker(program, /*produceDiagnostics:*/ false));
|
||||
}
|
||||
function emit(sourceFile, writeFileCallback, cancellationToken) {
|
||||
var _this = this;
|
||||
return runWithCancellationToken(function () { return emitWorker(_this, sourceFile, writeFileCallback, cancellationToken); });
|
||||
return runWithCancellationToken(function () { return emitWorker(program, sourceFile, writeFileCallback, cancellationToken); });
|
||||
}
|
||||
function isEmitBlocked(emitFileName) {
|
||||
return hasEmitBlockingDiagnostics.contains(ts.toPath(emitFileName, currentDirectory, getCanonicalFileName));
|
||||
@@ -44603,9 +44649,19 @@ var ts;
|
||||
if (file_1 && options.forceConsistentCasingInFileNames && ts.getNormalizedAbsolutePath(file_1.fileName, currentDirectory) !== ts.getNormalizedAbsolutePath(fileName, currentDirectory)) {
|
||||
reportFileNamesDifferOnlyInCasingError(fileName, file_1.fileName, refFile, refPos, refEnd);
|
||||
}
|
||||
// See if we need to reprocess the imports due to prior skipped imports
|
||||
if (file_1 && ts.lookUp(modulesWithElidedImports, file_1.path)) {
|
||||
if (currentNodeModulesJsDepth < maxNodeModulesJsDepth) {
|
||||
// If the file was previously found via a node_modules search, but is now being processed as a root file,
|
||||
// then everything it sucks in may also be marked incorrectly, and needs to be checked again.
|
||||
if (file_1 && ts.lookUp(sourceFilesFoundSearchingNodeModules, file_1.path) && currentNodeModulesDepth == 0) {
|
||||
sourceFilesFoundSearchingNodeModules[file_1.path] = false;
|
||||
if (!options.noResolve) {
|
||||
processReferencedFiles(file_1, ts.getDirectoryPath(fileName), isDefaultLib);
|
||||
processTypeReferenceDirectives(file_1);
|
||||
}
|
||||
modulesWithElidedImports[file_1.path] = false;
|
||||
processImportedModules(file_1, ts.getDirectoryPath(fileName));
|
||||
}
|
||||
else if (file_1 && ts.lookUp(modulesWithElidedImports, file_1.path)) {
|
||||
if (currentNodeModulesDepth < maxNodeModulesJsDepth) {
|
||||
modulesWithElidedImports[file_1.path] = false;
|
||||
processImportedModules(file_1, ts.getDirectoryPath(fileName));
|
||||
}
|
||||
@@ -44623,6 +44679,7 @@ var ts;
|
||||
});
|
||||
filesByName.set(path, file);
|
||||
if (file) {
|
||||
sourceFilesFoundSearchingNodeModules[path] = (currentNodeModulesDepth > 0);
|
||||
file.path = path;
|
||||
if (host.useCaseSensitiveFileNames()) {
|
||||
// for case-sensitive file systems check if we've already seen some file with similar filename ignoring case
|
||||
@@ -44737,12 +44794,9 @@ var ts;
|
||||
var isFromNodeModulesSearch = resolution && resolution.isExternalLibraryImport;
|
||||
var isJsFileFromNodeModules = isFromNodeModulesSearch && ts.hasJavaScriptFileExtension(resolution.resolvedFileName);
|
||||
if (isFromNodeModulesSearch) {
|
||||
sourceFilesFoundSearchingNodeModules[resolvedPath] = true;
|
||||
currentNodeModulesDepth++;
|
||||
}
|
||||
if (isJsFileFromNodeModules) {
|
||||
currentNodeModulesJsDepth++;
|
||||
}
|
||||
var elideImport = isJsFileFromNodeModules && currentNodeModulesJsDepth > maxNodeModulesJsDepth;
|
||||
var elideImport = isJsFileFromNodeModules && currentNodeModulesDepth > maxNodeModulesJsDepth;
|
||||
var shouldAddFile = resolution && !options.noResolve && i < file.imports.length && !elideImport;
|
||||
if (elideImport) {
|
||||
modulesWithElidedImports[file.path] = true;
|
||||
@@ -44751,8 +44805,8 @@ var ts;
|
||||
findSourceFile(resolution.resolvedFileName, resolvedPath,
|
||||
/*isDefaultLib*/ false, /*isReference*/ false, file, ts.skipTrivia(file.text, file.imports[i].pos), file.imports[i].end);
|
||||
}
|
||||
if (isJsFileFromNodeModules) {
|
||||
currentNodeModulesJsDepth--;
|
||||
if (isFromNodeModulesSearch) {
|
||||
currentNodeModulesDepth--;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45090,12 +45144,12 @@ var ts;
|
||||
{
|
||||
name: "noUnusedLocals",
|
||||
type: "boolean",
|
||||
description: ts.Diagnostics.Report_Errors_on_Unused_Locals
|
||||
description: ts.Diagnostics.Report_errors_on_unused_locals
|
||||
},
|
||||
{
|
||||
name: "noUnusedParameters",
|
||||
type: "boolean",
|
||||
description: ts.Diagnostics.Report_Errors_on_Unused_Parameters
|
||||
description: ts.Diagnostics.Report_errors_on_unused_parameters
|
||||
},
|
||||
{
|
||||
name: "noLib",
|
||||
@@ -47087,7 +47141,7 @@ var ts;
|
||||
else {
|
||||
// b) Check if the part is a prefix of the candidate, in a case insensitive or sensitive
|
||||
// manner. If it does, return that there was a prefix match.
|
||||
return createPatternMatch(PatternMatchKind.prefix, punctuationStripped, /*isCaseSensitive:*/ startsWith(candidate, chunk.text));
|
||||
return createPatternMatch(PatternMatchKind.prefix, punctuationStripped, /*isCaseSensitive:*/ ts.startsWith(candidate, chunk.text));
|
||||
}
|
||||
}
|
||||
var isLowercase = chunk.isLowerCase;
|
||||
@@ -47353,14 +47407,6 @@ var ts;
|
||||
var str = String.fromCharCode(ch);
|
||||
return str === str.toLowerCase();
|
||||
}
|
||||
function startsWith(string, search) {
|
||||
for (var i = 0, n = search.length; i < n; i++) {
|
||||
if (string.charCodeAt(i) !== search.charCodeAt(i)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// Assumes 'value' is already lowercase.
|
||||
function indexOfIgnoringCase(string, value) {
|
||||
for (var i = 0, n = string.length - value.length; i <= n; i++) {
|
||||
@@ -49205,6 +49251,7 @@ var ts;
|
||||
ScanAction[ScanAction["RescanSlashToken"] = 2] = "RescanSlashToken";
|
||||
ScanAction[ScanAction["RescanTemplateToken"] = 3] = "RescanTemplateToken";
|
||||
ScanAction[ScanAction["RescanJsxIdentifier"] = 4] = "RescanJsxIdentifier";
|
||||
ScanAction[ScanAction["RescanJsxText"] = 5] = "RescanJsxText";
|
||||
})(ScanAction || (ScanAction = {}));
|
||||
function getFormattingScanner(sourceFile, startPos, endPos) {
|
||||
ts.Debug.assert(scanner === undefined);
|
||||
@@ -49296,6 +49343,9 @@ var ts;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function shouldRescanJsxText(node) {
|
||||
return node && node.kind === 244 /* JsxText */;
|
||||
}
|
||||
function shouldRescanSlashToken(container) {
|
||||
return container.kind === 10 /* RegularExpressionLiteral */;
|
||||
}
|
||||
@@ -49326,7 +49376,9 @@ var ts;
|
||||
? 3 /* RescanTemplateToken */
|
||||
: shouldRescanJsxIdentifier(n)
|
||||
? 4 /* RescanJsxIdentifier */
|
||||
: 0 /* Scan */;
|
||||
: shouldRescanJsxText(n)
|
||||
? 5 /* RescanJsxText */
|
||||
: 0 /* Scan */;
|
||||
if (lastTokenInfo && expectedScanAction === lastScanAction) {
|
||||
// readTokenInfo was called before with the same expected scan action.
|
||||
// No need to re-scan text, return existing 'lastTokenInfo'
|
||||
@@ -49361,6 +49413,10 @@ var ts;
|
||||
currentToken = scanner.scanJsxIdentifier();
|
||||
lastScanAction = 4 /* RescanJsxIdentifier */;
|
||||
}
|
||||
else if (expectedScanAction === 5 /* RescanJsxText */) {
|
||||
currentToken = scanner.reScanJsxToken();
|
||||
lastScanAction = 5 /* RescanJsxText */;
|
||||
}
|
||||
else {
|
||||
lastScanAction = 0 /* Scan */;
|
||||
}
|
||||
@@ -52033,19 +52089,20 @@ var ts;
|
||||
"version"
|
||||
];
|
||||
var jsDocCompletionEntries;
|
||||
function createNode(kind, pos, end, flags, parent) {
|
||||
var node = new NodeObject(kind, pos, end);
|
||||
node.flags = flags;
|
||||
function createNode(kind, pos, end, parent) {
|
||||
var node = kind >= 139 /* FirstNode */ ? new NodeObject(kind, pos, end) :
|
||||
kind === 69 /* Identifier */ ? new IdentifierObject(kind, pos, end) :
|
||||
new TokenObject(kind, pos, end);
|
||||
node.parent = parent;
|
||||
return node;
|
||||
}
|
||||
var NodeObject = (function () {
|
||||
function NodeObject(kind, pos, end) {
|
||||
this.kind = kind;
|
||||
this.pos = pos;
|
||||
this.end = end;
|
||||
this.flags = 0 /* None */;
|
||||
this.parent = undefined;
|
||||
this.kind = kind;
|
||||
}
|
||||
NodeObject.prototype.getSourceFile = function () {
|
||||
return ts.getSourceFileOfNode(this);
|
||||
@@ -52080,14 +52137,14 @@ var ts;
|
||||
var token = useJSDocScanner ? scanner.scanJSDocToken() : scanner.scan();
|
||||
var textPos = scanner.getTextPos();
|
||||
if (textPos <= end) {
|
||||
nodes.push(createNode(token, pos, textPos, 0, this));
|
||||
nodes.push(createNode(token, pos, textPos, this));
|
||||
}
|
||||
pos = textPos;
|
||||
}
|
||||
return pos;
|
||||
};
|
||||
NodeObject.prototype.createSyntaxList = function (nodes) {
|
||||
var list = createNode(282 /* SyntaxList */, nodes.pos, nodes.end, 0, this);
|
||||
var list = createNode(282 /* SyntaxList */, nodes.pos, nodes.end, this);
|
||||
list._children = [];
|
||||
var pos = nodes.pos;
|
||||
for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) {
|
||||
@@ -52173,6 +52230,74 @@ var ts;
|
||||
};
|
||||
return NodeObject;
|
||||
}());
|
||||
var TokenOrIdentifierObject = (function () {
|
||||
function TokenOrIdentifierObject(pos, end) {
|
||||
// Set properties in same order as NodeObject
|
||||
this.pos = pos;
|
||||
this.end = end;
|
||||
this.flags = 0 /* None */;
|
||||
this.parent = undefined;
|
||||
}
|
||||
TokenOrIdentifierObject.prototype.getSourceFile = function () {
|
||||
return ts.getSourceFileOfNode(this);
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getStart = function (sourceFile, includeJsDocComment) {
|
||||
return ts.getTokenPosOfNode(this, sourceFile, includeJsDocComment);
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getFullStart = function () {
|
||||
return this.pos;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getEnd = function () {
|
||||
return this.end;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getWidth = function (sourceFile) {
|
||||
return this.getEnd() - this.getStart(sourceFile);
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getFullWidth = function () {
|
||||
return this.end - this.pos;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getLeadingTriviaWidth = function (sourceFile) {
|
||||
return this.getStart(sourceFile) - this.pos;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getFullText = function (sourceFile) {
|
||||
return (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end);
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getText = function (sourceFile) {
|
||||
return (sourceFile || this.getSourceFile()).text.substring(this.getStart(), this.getEnd());
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getChildCount = function (sourceFile) {
|
||||
return 0;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getChildAt = function (index, sourceFile) {
|
||||
return undefined;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getChildren = function (sourceFile) {
|
||||
return emptyArray;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getFirstToken = function (sourceFile) {
|
||||
return undefined;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getLastToken = function (sourceFile) {
|
||||
return undefined;
|
||||
};
|
||||
return TokenOrIdentifierObject;
|
||||
}());
|
||||
var TokenObject = (function (_super) {
|
||||
__extends(TokenObject, _super);
|
||||
function TokenObject(kind, pos, end) {
|
||||
_super.call(this, pos, end);
|
||||
this.kind = kind;
|
||||
}
|
||||
return TokenObject;
|
||||
}(TokenOrIdentifierObject));
|
||||
var IdentifierObject = (function (_super) {
|
||||
__extends(IdentifierObject, _super);
|
||||
function IdentifierObject(kind, pos, end) {
|
||||
_super.call(this, pos, end);
|
||||
}
|
||||
return IdentifierObject;
|
||||
}(TokenOrIdentifierObject));
|
||||
IdentifierObject.prototype.kind = 69 /* Identifier */;
|
||||
var SymbolObject = (function () {
|
||||
function SymbolObject(flags, name) {
|
||||
this.flags = flags;
|
||||
@@ -58937,6 +59062,8 @@ var ts;
|
||||
function initializeServices() {
|
||||
ts.objectAllocator = {
|
||||
getNodeConstructor: function () { return NodeObject; },
|
||||
getTokenConstructor: function () { return TokenObject; },
|
||||
getIdentifierConstructor: function () { return IdentifierObject; },
|
||||
getSourceFileConstructor: function () { return SourceFileObject; },
|
||||
getSymbolConstructor: function () { return SymbolObject; },
|
||||
getTypeConstructor: function () { return TypeObject; },
|
||||
@@ -59562,7 +59689,7 @@ var ts;
|
||||
//
|
||||
/// <reference path='services.ts' />
|
||||
/* @internal */
|
||||
var debugObjectHost = this;
|
||||
var debugObjectHost = new Function("return this")();
|
||||
// We need to use 'null' to interface with the managed side.
|
||||
/* tslint:disable:no-null-keyword */
|
||||
/* tslint:disable:no-in-operator */
|
||||
@@ -59701,7 +59828,7 @@ var ts;
|
||||
return this.shimHost.getCurrentDirectory();
|
||||
};
|
||||
LanguageServiceShimHostAdapter.prototype.getDirectories = function (path) {
|
||||
return this.shimHost.getDirectories(path);
|
||||
return JSON.parse(this.shimHost.getDirectories(path));
|
||||
};
|
||||
LanguageServiceShimHostAdapter.prototype.getDefaultLibFileName = function (options) {
|
||||
return this.shimHost.getDefaultLibFileName(JSON.stringify(options));
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/browserify": "latest",
|
||||
"@types/convert-source-map": "latest",
|
||||
"@types/chai": "latest",
|
||||
"@types/del": "latest",
|
||||
"@types/glob": "latest",
|
||||
@@ -50,6 +51,7 @@
|
||||
"@types/through2": "latest",
|
||||
"browserify": "latest",
|
||||
"chai": "latest",
|
||||
"convert-source-map": "latest",
|
||||
"del": "latest",
|
||||
"gulp": "latest",
|
||||
"gulp-clone": "latest",
|
||||
@@ -68,6 +70,7 @@
|
||||
"mocha": "latest",
|
||||
"mocha-fivemat-progress-reporter": "latest",
|
||||
"run-sequence": "latest",
|
||||
"sorcery": "latest",
|
||||
"through2": "latest",
|
||||
"ts-node": "latest",
|
||||
"tsd": "latest",
|
||||
|
||||
Vendored
+3
-1
@@ -19,4 +19,6 @@ declare module "into-stream" {
|
||||
export function obj(content: any): NodeJS.ReadableStream
|
||||
}
|
||||
export = IntoStream;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "sorcery";
|
||||
|
||||
+10
-3
@@ -13277,7 +13277,7 @@ namespace ts {
|
||||
checkAsyncFunctionReturnType(<FunctionLikeDeclaration>node);
|
||||
}
|
||||
}
|
||||
if (!(<FunctionDeclaration>node).body) {
|
||||
if (noUnusedIdentifiers && !(<FunctionDeclaration>node).body) {
|
||||
checkUnusedTypeParameters(node);
|
||||
}
|
||||
}
|
||||
@@ -14612,8 +14612,15 @@ namespace ts {
|
||||
function checkUnusedTypeParameters(node: ClassDeclaration | ClassExpression | FunctionDeclaration | MethodDeclaration | FunctionExpression | ArrowFunction | ConstructorDeclaration | SignatureDeclaration | InterfaceDeclaration) {
|
||||
if (compilerOptions.noUnusedLocals && !isInAmbientContext(node)) {
|
||||
if (node.typeParameters) {
|
||||
// Only report errors on the last declaration for the type parameter container;
|
||||
// this ensures that all uses have been accounted for.
|
||||
const symbol = getSymbolOfNode(node);
|
||||
const lastDeclaration = symbol && symbol.declarations && lastOrUndefined(symbol.declarations);
|
||||
if (lastDeclaration !== node) {
|
||||
return;
|
||||
}
|
||||
for (const typeParameter of node.typeParameters) {
|
||||
if (!typeParameter.symbol.isReferenced) {
|
||||
if (!getMergedSymbol(typeParameter.symbol).isReferenced) {
|
||||
error(typeParameter.name, Diagnostics._0_is_declared_but_never_used, typeParameter.symbol.name);
|
||||
}
|
||||
}
|
||||
@@ -16122,7 +16129,7 @@ namespace ts {
|
||||
|
||||
if (produceDiagnostics) {
|
||||
checkTypeForDuplicateIndexSignatures(node);
|
||||
checkUnusedTypeParameters(node);
|
||||
registerForUnusedIdentifiersCheck(node);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -135,12 +135,12 @@ namespace ts {
|
||||
{
|
||||
name: "noUnusedLocals",
|
||||
type: "boolean",
|
||||
description: Diagnostics.Report_Errors_on_Unused_Locals,
|
||||
description: Diagnostics.Report_errors_on_unused_locals,
|
||||
},
|
||||
{
|
||||
name: "noUnusedParameters",
|
||||
type: "boolean",
|
||||
description: Diagnostics.Report_Errors_on_Unused_Parameters
|
||||
description: Diagnostics.Report_errors_on_unused_parameters,
|
||||
},
|
||||
{
|
||||
name: "noLib",
|
||||
|
||||
@@ -1240,6 +1240,8 @@ namespace ts {
|
||||
|
||||
export interface ObjectAllocator {
|
||||
getNodeConstructor(): new (kind: SyntaxKind, pos?: number, end?: number) => Node;
|
||||
getTokenConstructor(): new (kind: SyntaxKind, pos?: number, end?: number) => Token;
|
||||
getIdentifierConstructor(): new (kind: SyntaxKind, pos?: number, end?: number) => Token;
|
||||
getSourceFileConstructor(): new (kind: SyntaxKind, pos?: number, end?: number) => SourceFile;
|
||||
getSymbolConstructor(): new (flags: SymbolFlags, name: string) => Symbol;
|
||||
getTypeConstructor(): new (checker: TypeChecker, flags: TypeFlags) => Type;
|
||||
@@ -1269,6 +1271,8 @@ namespace ts {
|
||||
|
||||
export let objectAllocator: ObjectAllocator = {
|
||||
getNodeConstructor: () => <any>Node,
|
||||
getTokenConstructor: () => <any>Node,
|
||||
getIdentifierConstructor: () => <any>Node,
|
||||
getSourceFileConstructor: () => <any>Node,
|
||||
getSymbolConstructor: () => <any>Symbol,
|
||||
getTypeConstructor: () => <any>Type,
|
||||
|
||||
@@ -2800,11 +2800,11 @@
|
||||
"category": "Error",
|
||||
"code": 6133
|
||||
},
|
||||
"Report Errors on Unused Locals.": {
|
||||
"Report errors on unused locals.": {
|
||||
"category": "Message",
|
||||
"code": 6134
|
||||
},
|
||||
"Report Errors on Unused Parameters.": {
|
||||
"Report errors on unused parameters.": {
|
||||
"category": "Message",
|
||||
"code": 6135
|
||||
},
|
||||
|
||||
@@ -614,7 +614,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
|
||||
const sourceMappingURL = sourceMap.getSourceMappingURL();
|
||||
if (sourceMappingURL) {
|
||||
write(`//# sourceMappingURL=${sourceMappingURL}`);
|
||||
write(`//# ${"sourceMappingURL"}=${sourceMappingURL}`); // Sometimes tools can sometimes see this line as a source mapping url comment
|
||||
}
|
||||
|
||||
writeEmittedFiles(writer.getText(), jsFilePath, sourceMapFilePath, /*writeByteOrderMark*/ compilerOptions.emitBOM, sourceFiles);
|
||||
@@ -2749,7 +2749,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
* if we should also export the value after its it changed
|
||||
* - check if node is a source level declaration to emit it differently,
|
||||
* i.e non-exported variable statement 'var x = 1' is hoisted so
|
||||
* we we emit variable statement 'var' should be dropped.
|
||||
* when we emit variable statement 'var' should be dropped.
|
||||
*/
|
||||
function isSourceFileLevelDeclarationInSystemJsModule(node: Node, isExported: boolean): boolean {
|
||||
if (!node || !isCurrentFileSystemExternalModule()) {
|
||||
@@ -5503,16 +5503,15 @@ const _super = (function (geti, seti) {
|
||||
write("export ");
|
||||
}
|
||||
|
||||
if (!isHoistedDeclarationInSystemModule) {
|
||||
write("let ");
|
||||
}
|
||||
if (decoratedClassAlias !== undefined) {
|
||||
write(`${decoratedClassAlias}`);
|
||||
write(`let ${decoratedClassAlias}`);
|
||||
}
|
||||
else {
|
||||
if (!isHoistedDeclarationInSystemModule) {
|
||||
write("let ");
|
||||
}
|
||||
emitDeclarationName(node);
|
||||
}
|
||||
|
||||
write(" = ");
|
||||
}
|
||||
else if (isES6ExportedDeclaration(node)) {
|
||||
@@ -5530,7 +5529,9 @@ const _super = (function (geti, seti) {
|
||||
//
|
||||
// We'll emit:
|
||||
//
|
||||
// (_temp = class C { ... }, _temp.a = 1, _temp.b = 2, _temp)
|
||||
// let C_1 = class C{};
|
||||
// C_1.a = 1;
|
||||
// C_1.b = 2; // so forth and so on
|
||||
//
|
||||
// This keeps the expression as an expression, while ensuring that the static parts
|
||||
// of it have been initialized by the time it is used.
|
||||
|
||||
+18
-4
@@ -5,12 +5,20 @@ namespace ts {
|
||||
/* @internal */ export let parseTime = 0;
|
||||
|
||||
let NodeConstructor: new (kind: SyntaxKind, pos: number, end: number) => Node;
|
||||
let TokenConstructor: new (kind: SyntaxKind, pos: number, end: number) => Node;
|
||||
let IdentifierConstructor: new (kind: SyntaxKind, pos: number, end: number) => Node;
|
||||
let SourceFileConstructor: new (kind: SyntaxKind, pos: number, end: number) => Node;
|
||||
|
||||
export function createNode(kind: SyntaxKind, pos?: number, end?: number): Node {
|
||||
if (kind === SyntaxKind.SourceFile) {
|
||||
return new (SourceFileConstructor || (SourceFileConstructor = objectAllocator.getSourceFileConstructor()))(kind, pos, end);
|
||||
}
|
||||
else if (kind === SyntaxKind.Identifier) {
|
||||
return new (IdentifierConstructor || (IdentifierConstructor = objectAllocator.getIdentifierConstructor()))(kind, pos, end);
|
||||
}
|
||||
else if (kind < SyntaxKind.FirstNode) {
|
||||
return new (TokenConstructor || (TokenConstructor = objectAllocator.getTokenConstructor()))(kind, pos, end);
|
||||
}
|
||||
else {
|
||||
return new (NodeConstructor || (NodeConstructor = objectAllocator.getNodeConstructor()))(kind, pos, end);
|
||||
}
|
||||
@@ -499,6 +507,8 @@ namespace ts {
|
||||
|
||||
// capture constructors in 'initializeState' to avoid null checks
|
||||
let NodeConstructor: new (kind: SyntaxKind, pos: number, end: number) => Node;
|
||||
let TokenConstructor: new (kind: SyntaxKind, pos: number, end: number) => Node;
|
||||
let IdentifierConstructor: new (kind: SyntaxKind, pos: number, end: number) => Node;
|
||||
let SourceFileConstructor: new (kind: SyntaxKind, pos: number, end: number) => Node;
|
||||
|
||||
let sourceFile: SourceFile;
|
||||
@@ -609,6 +619,8 @@ namespace ts {
|
||||
|
||||
function initializeState(fileName: string, _sourceText: string, languageVersion: ScriptTarget, _syntaxCursor: IncrementalParser.SyntaxCursor, scriptKind: ScriptKind) {
|
||||
NodeConstructor = objectAllocator.getNodeConstructor();
|
||||
TokenConstructor = objectAllocator.getTokenConstructor();
|
||||
IdentifierConstructor = objectAllocator.getIdentifierConstructor();
|
||||
SourceFileConstructor = objectAllocator.getSourceFileConstructor();
|
||||
|
||||
sourceText = _sourceText;
|
||||
@@ -1019,13 +1031,15 @@ namespace ts {
|
||||
}
|
||||
|
||||
// note: this function creates only node
|
||||
function createNode(kind: SyntaxKind, pos?: number): Node {
|
||||
function createNode(kind: SyntaxKind, pos?: number): Node | Token | Identifier {
|
||||
nodeCount++;
|
||||
if (!(pos >= 0)) {
|
||||
pos = scanner.getStartPos();
|
||||
}
|
||||
|
||||
return new NodeConstructor(kind, pos, pos);
|
||||
return kind >= SyntaxKind.FirstNode ? new NodeConstructor(kind, pos, pos) :
|
||||
kind === SyntaxKind.Identifier ? new IdentifierConstructor(kind, pos, pos) :
|
||||
new TokenConstructor(kind, pos, pos);
|
||||
}
|
||||
|
||||
function finishNode<T extends Node>(node: T, end?: number): T {
|
||||
@@ -5097,7 +5111,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
flags |= modifierToFlag(modifierKind);
|
||||
modifiers.push(finishNode(createNode(modifierKind, modifierStart)));
|
||||
modifiers.push(finishNode(<Modifier>createNode(modifierKind, modifierStart)));
|
||||
}
|
||||
if (modifiers) {
|
||||
modifiers.flags = flags;
|
||||
@@ -5116,7 +5130,7 @@ namespace ts {
|
||||
modifiers = <ModifiersArray>[];
|
||||
modifiers.pos = modifierStart;
|
||||
flags |= modifierToFlag(modifierKind);
|
||||
modifiers.push(finishNode(createNode(modifierKind, modifierStart)));
|
||||
modifiers.push(finishNode(<Modifier>createNode(modifierKind, modifierStart)));
|
||||
modifiers.flags = flags;
|
||||
modifiers.end = scanner.getStartPos();
|
||||
}
|
||||
|
||||
@@ -991,7 +991,13 @@ namespace ts {
|
||||
return sortAndDeduplicateDiagnostics(diagnostics);
|
||||
}
|
||||
|
||||
export function formatDiagnostics(diagnostics: Diagnostic[], host: CompilerHost): string {
|
||||
export interface FormatDiagnosticsHost {
|
||||
getCurrentDirectory(): string;
|
||||
getCanonicalFileName(fileName: string): string;
|
||||
getNewLine(): string;
|
||||
}
|
||||
|
||||
export function formatDiagnostics(diagnostics: Diagnostic[], host: FormatDiagnosticsHost): string {
|
||||
let output = "";
|
||||
|
||||
for (const diagnostic of diagnostics) {
|
||||
|
||||
+27
-16
@@ -6,9 +6,19 @@ namespace ts {
|
||||
fileWatcher?: FileWatcher;
|
||||
}
|
||||
|
||||
let reportDiagnostic = reportDiagnosticSimply;
|
||||
const defaultFormatDiagnosticsHost: FormatDiagnosticsHost = {
|
||||
getCurrentDirectory: () => sys.getCurrentDirectory(),
|
||||
getNewLine: () => sys.newLine,
|
||||
getCanonicalFileName: createGetCanonicalFileName(sys.useCaseSensitiveFileNames)
|
||||
};
|
||||
|
||||
function reportDiagnostics(diagnostics: Diagnostic[], host: CompilerHost): void {
|
||||
let reportDiagnosticWorker = reportDiagnosticSimply;
|
||||
|
||||
function reportDiagnostic(diagnostic: Diagnostic, host: FormatDiagnosticsHost) {
|
||||
reportDiagnosticWorker(diagnostic, host || defaultFormatDiagnosticsHost);
|
||||
}
|
||||
|
||||
function reportDiagnostics(diagnostics: Diagnostic[], host: FormatDiagnosticsHost): void {
|
||||
for (const diagnostic of diagnostics) {
|
||||
reportDiagnostic(diagnostic, host);
|
||||
}
|
||||
@@ -101,7 +111,7 @@ namespace ts {
|
||||
return <string>diagnostic.messageText;
|
||||
}
|
||||
|
||||
function reportDiagnosticSimply(diagnostic: Diagnostic, host: CompilerHost): void {
|
||||
function reportDiagnosticSimply(diagnostic: Diagnostic, host: FormatDiagnosticsHost): void {
|
||||
sys.write(ts.formatDiagnostics([diagnostic], host));
|
||||
}
|
||||
|
||||
@@ -122,7 +132,7 @@ namespace ts {
|
||||
return formatStyle + text + resetEscapeSequence;
|
||||
}
|
||||
|
||||
function reportDiagnosticWithColorAndContext(diagnostic: Diagnostic, host: CompilerHost): void {
|
||||
function reportDiagnosticWithColorAndContext(diagnostic: Diagnostic, host: FormatDiagnosticsHost): void {
|
||||
let output = "";
|
||||
|
||||
if (diagnostic.file) {
|
||||
@@ -257,7 +267,7 @@ namespace ts {
|
||||
|
||||
if (commandLine.options.locale) {
|
||||
if (!isJSONSupported()) {
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--locale"), /* compilerHost */ undefined);
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--locale"), /* host */ undefined);
|
||||
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
}
|
||||
validateLocaleAndSetLanguage(commandLine.options.locale, commandLine.errors);
|
||||
@@ -288,11 +298,11 @@ namespace ts {
|
||||
|
||||
if (commandLine.options.project) {
|
||||
if (!isJSONSupported()) {
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--project"), /* compilerHost */ undefined);
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--project"), /* host */ undefined);
|
||||
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
}
|
||||
if (commandLine.fileNames.length !== 0) {
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Option_project_cannot_be_mixed_with_source_files_on_a_command_line), /* compilerHost */ undefined);
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Option_project_cannot_be_mixed_with_source_files_on_a_command_line), /* host */ undefined);
|
||||
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
}
|
||||
|
||||
@@ -300,14 +310,14 @@ namespace ts {
|
||||
if (!fileOrDirectory /* current directory "." */ || sys.directoryExists(fileOrDirectory)) {
|
||||
configFileName = combinePaths(fileOrDirectory, "tsconfig.json");
|
||||
if (!sys.fileExists(configFileName)) {
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0, commandLine.options.project), /* compilerHost */ undefined);
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0, commandLine.options.project), /* host */ undefined);
|
||||
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
}
|
||||
}
|
||||
else {
|
||||
configFileName = fileOrDirectory;
|
||||
if (!sys.fileExists(configFileName)) {
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_specified_path_does_not_exist_Colon_0, commandLine.options.project), /* compilerHost */ undefined);
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_specified_path_does_not_exist_Colon_0, commandLine.options.project), /* host */ undefined);
|
||||
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
}
|
||||
}
|
||||
@@ -325,7 +335,7 @@ namespace ts {
|
||||
|
||||
if (isWatchSet(commandLine.options)) {
|
||||
if (!sys.watchFile) {
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--watch"), /* compilerHost */ undefined);
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--watch"), /* host */ undefined);
|
||||
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
}
|
||||
if (configFileName) {
|
||||
@@ -370,7 +380,8 @@ namespace ts {
|
||||
sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
return;
|
||||
}
|
||||
const configParseResult = parseJsonConfigFileContent(configObject, sys, getNormalizedAbsolutePath(getDirectoryPath(configFileName), sys.getCurrentDirectory()), commandLine.options, configFileName);
|
||||
const cwd = sys.getCurrentDirectory();
|
||||
const configParseResult = parseJsonConfigFileContent(configObject, sys, getNormalizedAbsolutePath(getDirectoryPath(configFileName), cwd), commandLine.options, getNormalizedAbsolutePath(configFileName, cwd));
|
||||
if (configParseResult.errors.length > 0) {
|
||||
reportDiagnostics(configParseResult.errors, /* compilerHost */ undefined);
|
||||
sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
@@ -378,7 +389,7 @@ namespace ts {
|
||||
}
|
||||
if (isWatchSet(configParseResult.options)) {
|
||||
if (!sys.watchFile) {
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--watch"), /* compilerHost */ undefined);
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--watch"), /* host */ undefined);
|
||||
sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
}
|
||||
|
||||
@@ -417,7 +428,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
if (compilerOptions.pretty) {
|
||||
reportDiagnostic = reportDiagnosticWithColorAndContext;
|
||||
reportDiagnosticWorker = reportDiagnosticWithColorAndContext;
|
||||
}
|
||||
|
||||
// reset the cache of existing files
|
||||
@@ -642,7 +653,7 @@ namespace ts {
|
||||
// Build up the list of examples.
|
||||
const padding = makePadding(marginLength);
|
||||
output += getDiagnosticText(Diagnostics.Examples_Colon_0, makePadding(marginLength - examplesLength) + "tsc hello.ts") + sys.newLine;
|
||||
output += padding + "tsc --out file.js file.ts" + sys.newLine;
|
||||
output += padding + "tsc --outFile file.js file.ts" + sys.newLine;
|
||||
output += padding + "tsc @args.txt" + sys.newLine;
|
||||
output += sys.newLine;
|
||||
|
||||
@@ -742,7 +753,7 @@ namespace ts {
|
||||
const currentDirectory = sys.getCurrentDirectory();
|
||||
const file = normalizePath(combinePaths(currentDirectory, "tsconfig.json"));
|
||||
if (sys.fileExists(file)) {
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.A_tsconfig_json_file_is_already_defined_at_Colon_0, file), /* compilerHost */ undefined);
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.A_tsconfig_json_file_is_already_defined_at_Colon_0, file), /* host */ undefined);
|
||||
}
|
||||
else {
|
||||
const compilerOptions = extend(options, defaultInitCompilerOptions);
|
||||
@@ -762,7 +773,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
sys.writeFile(file, JSON.stringify(configurations, undefined, 4));
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Successfully_created_a_tsconfig_json_file), /* compilerHost */ undefined);
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Successfully_created_a_tsconfig_json_file), /* host */ undefined);
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
@@ -472,6 +472,10 @@ namespace ts {
|
||||
flags: NodeFlags;
|
||||
}
|
||||
|
||||
export interface Token extends Node {
|
||||
__tokenTag: any;
|
||||
}
|
||||
|
||||
// @kind(SyntaxKind.AbstractKeyword)
|
||||
// @kind(SyntaxKind.AsyncKeyword)
|
||||
// @kind(SyntaxKind.ConstKeyword)
|
||||
@@ -482,7 +486,7 @@ namespace ts {
|
||||
// @kind(SyntaxKind.PrivateKeyword)
|
||||
// @kind(SyntaxKind.ProtectedKeyword)
|
||||
// @kind(SyntaxKind.StaticKeyword)
|
||||
export interface Modifier extends Node { }
|
||||
export interface Modifier extends Token { }
|
||||
|
||||
// @kind(SyntaxKind.Identifier)
|
||||
export interface Identifier extends PrimaryExpression {
|
||||
@@ -2909,7 +2913,6 @@ namespace ts {
|
||||
getCancellationToken?(): CancellationToken;
|
||||
getDefaultLibFileName(options: CompilerOptions): string;
|
||||
getDefaultLibLocation?(): string;
|
||||
getDefaultTypeDirectiveNames?(rootPath: string): string[];
|
||||
writeFile: WriteFileCallback;
|
||||
getCurrentDirectory(): string;
|
||||
getDirectories(path: string): string[];
|
||||
|
||||
@@ -50,7 +50,9 @@ class CompilerBaselineRunner extends RunnerBase {
|
||||
}
|
||||
|
||||
private makeUnitName(name: string, root: string) {
|
||||
return ts.isRootedDiskPath(name) ? name : ts.combinePaths(root, name);
|
||||
const path = ts.toPath(name, root, (fileName) => Harness.Compiler.getCanonicalFileName(fileName));
|
||||
const pathStart = ts.toPath(Harness.IO.getCurrentDirectory(), "", (fileName) => Harness.Compiler.getCanonicalFileName(fileName));
|
||||
return path.replace(pathStart, "/");
|
||||
};
|
||||
|
||||
public checkTestCodeOutput(fileName: string) {
|
||||
|
||||
@@ -328,7 +328,7 @@ class ProjectRunner extends RunnerBase {
|
||||
|
||||
if (Harness.Compiler.isJS(fileName)) {
|
||||
// Make sure if there is URl we have it cleaned up
|
||||
const indexOfSourceMapUrl = data.lastIndexOf("//# sourceMappingURL=");
|
||||
const indexOfSourceMapUrl = data.lastIndexOf(`//# ${"sourceMappingURL"}=`); // This line can be seen as a sourceMappingURL comment
|
||||
if (indexOfSourceMapUrl !== -1) {
|
||||
data = data.substring(0, indexOfSourceMapUrl + 21) + cleanProjectUrl(data.substring(indexOfSourceMapUrl + 21));
|
||||
}
|
||||
|
||||
@@ -196,9 +196,10 @@ namespace ts {
|
||||
];
|
||||
let jsDocCompletionEntries: CompletionEntry[];
|
||||
|
||||
function createNode(kind: SyntaxKind, pos: number, end: number, flags: NodeFlags, parent?: Node): NodeObject {
|
||||
const node = new NodeObject(kind, pos, end);
|
||||
node.flags = flags;
|
||||
function createNode(kind: SyntaxKind, pos: number, end: number, parent?: Node): NodeObject | TokenObject | IdentifierObject {
|
||||
const node = kind >= SyntaxKind.FirstNode ? new NodeObject(kind, pos, end) :
|
||||
kind === SyntaxKind.Identifier ? new IdentifierObject(kind, pos, end) :
|
||||
new TokenObject(kind, pos, end);
|
||||
node.parent = parent;
|
||||
return node;
|
||||
}
|
||||
@@ -213,11 +214,11 @@ namespace ts {
|
||||
private _children: Node[];
|
||||
|
||||
constructor(kind: SyntaxKind, pos: number, end: number) {
|
||||
this.kind = kind;
|
||||
this.pos = pos;
|
||||
this.end = end;
|
||||
this.flags = NodeFlags.None;
|
||||
this.parent = undefined;
|
||||
this.kind = kind;
|
||||
}
|
||||
|
||||
public getSourceFile(): SourceFile {
|
||||
@@ -262,7 +263,7 @@ namespace ts {
|
||||
const token = useJSDocScanner ? scanner.scanJSDocToken() : scanner.scan();
|
||||
const textPos = scanner.getTextPos();
|
||||
if (textPos <= end) {
|
||||
nodes.push(createNode(token, pos, textPos, 0, this));
|
||||
nodes.push(createNode(token, pos, textPos, this));
|
||||
}
|
||||
pos = textPos;
|
||||
}
|
||||
@@ -270,7 +271,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
private createSyntaxList(nodes: NodeArray<Node>): Node {
|
||||
const list = createNode(SyntaxKind.SyntaxList, nodes.pos, nodes.end, 0, this);
|
||||
const list = <NodeObject>createNode(SyntaxKind.SyntaxList, nodes.pos, nodes.end, this);
|
||||
list._children = [];
|
||||
let pos = nodes.pos;
|
||||
|
||||
@@ -361,6 +362,95 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
class TokenOrIdentifierObject implements Token {
|
||||
public kind: SyntaxKind;
|
||||
public pos: number;
|
||||
public end: number;
|
||||
public flags: NodeFlags;
|
||||
public parent: Node;
|
||||
public jsDocComments: JSDocComment[];
|
||||
public __tokenTag: any;
|
||||
|
||||
constructor(pos: number, end: number) {
|
||||
// Set properties in same order as NodeObject
|
||||
this.pos = pos;
|
||||
this.end = end;
|
||||
this.flags = NodeFlags.None;
|
||||
this.parent = undefined;
|
||||
}
|
||||
|
||||
public getSourceFile(): SourceFile {
|
||||
return getSourceFileOfNode(this);
|
||||
}
|
||||
|
||||
public getStart(sourceFile?: SourceFile, includeJsDocComment?: boolean): number {
|
||||
return getTokenPosOfNode(this, sourceFile, includeJsDocComment);
|
||||
}
|
||||
|
||||
public getFullStart(): number {
|
||||
return this.pos;
|
||||
}
|
||||
|
||||
public getEnd(): number {
|
||||
return this.end;
|
||||
}
|
||||
|
||||
public getWidth(sourceFile?: SourceFile): number {
|
||||
return this.getEnd() - this.getStart(sourceFile);
|
||||
}
|
||||
|
||||
public getFullWidth(): number {
|
||||
return this.end - this.pos;
|
||||
}
|
||||
|
||||
public getLeadingTriviaWidth(sourceFile?: SourceFile): number {
|
||||
return this.getStart(sourceFile) - this.pos;
|
||||
}
|
||||
|
||||
public getFullText(sourceFile?: SourceFile): string {
|
||||
return (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end);
|
||||
}
|
||||
|
||||
public getText(sourceFile?: SourceFile): string {
|
||||
return (sourceFile || this.getSourceFile()).text.substring(this.getStart(), this.getEnd());
|
||||
}
|
||||
|
||||
public getChildCount(sourceFile?: SourceFile): number {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public getChildAt(index: number, sourceFile?: SourceFile): Node {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public getChildren(sourceFile?: SourceFile): Node[] {
|
||||
return emptyArray;
|
||||
}
|
||||
|
||||
public getFirstToken(sourceFile?: SourceFile): Node {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public getLastToken(sourceFile?: SourceFile): Node {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
class TokenObject extends TokenOrIdentifierObject {
|
||||
public kind: SyntaxKind;
|
||||
constructor(kind: SyntaxKind, pos: number, end: number) {
|
||||
super(pos, end);
|
||||
this.kind = kind;
|
||||
}
|
||||
}
|
||||
|
||||
class IdentifierObject extends TokenOrIdentifierObject {
|
||||
constructor(kind: SyntaxKind, pos: number, end: number) {
|
||||
super(pos, end);
|
||||
}
|
||||
}
|
||||
IdentifierObject.prototype.kind = SyntaxKind.Identifier;
|
||||
|
||||
class SymbolObject implements Symbol {
|
||||
flags: SymbolFlags;
|
||||
name: string;
|
||||
@@ -8785,6 +8875,8 @@ namespace ts {
|
||||
function initializeServices() {
|
||||
objectAllocator = {
|
||||
getNodeConstructor: () => NodeObject,
|
||||
getTokenConstructor: () => TokenObject,
|
||||
getIdentifierConstructor: () => IdentifierObject,
|
||||
getSourceFileConstructor: () => SourceFileObject,
|
||||
getSymbolConstructor: () => SymbolObject,
|
||||
getTypeConstructor: () => TypeObject,
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
//// [decoratedClassExportsCommonJS1.ts]
|
||||
declare var Something: any;
|
||||
@Something({ v: () => Testing123 })
|
||||
export class Testing123 {
|
||||
static prop0: string;
|
||||
static prop1 = Testing123.prop0;
|
||||
}
|
||||
|
||||
//// [decoratedClassExportsCommonJS1.js]
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
let Testing123_1 = class Testing123 {
|
||||
};
|
||||
let Testing123 = Testing123_1;
|
||||
Testing123.prop1 = Testing123.prop0;
|
||||
Testing123 = Testing123_1 = __decorate([
|
||||
Something({ v: () => Testing123 }),
|
||||
__metadata('design:paramtypes', [])
|
||||
], Testing123);
|
||||
exports.Testing123 = Testing123;
|
||||
@@ -0,0 +1,21 @@
|
||||
=== tests/cases/conformance/decorators/class/decoratedClassExportsCommonJS1.ts ===
|
||||
declare var Something: any;
|
||||
>Something : Symbol(Something, Decl(decoratedClassExportsCommonJS1.ts, 0, 11))
|
||||
|
||||
@Something({ v: () => Testing123 })
|
||||
>Something : Symbol(Something, Decl(decoratedClassExportsCommonJS1.ts, 0, 11))
|
||||
>v : Symbol(v, Decl(decoratedClassExportsCommonJS1.ts, 1, 12))
|
||||
>Testing123 : Symbol(Testing123, Decl(decoratedClassExportsCommonJS1.ts, 0, 27))
|
||||
|
||||
export class Testing123 {
|
||||
>Testing123 : Symbol(Testing123, Decl(decoratedClassExportsCommonJS1.ts, 0, 27))
|
||||
|
||||
static prop0: string;
|
||||
>prop0 : Symbol(Testing123.prop0, Decl(decoratedClassExportsCommonJS1.ts, 2, 25))
|
||||
|
||||
static prop1 = Testing123.prop0;
|
||||
>prop1 : Symbol(Testing123.prop1, Decl(decoratedClassExportsCommonJS1.ts, 3, 25))
|
||||
>Testing123.prop0 : Symbol(Testing123.prop0, Decl(decoratedClassExportsCommonJS1.ts, 2, 25))
|
||||
>Testing123 : Symbol(Testing123, Decl(decoratedClassExportsCommonJS1.ts, 0, 27))
|
||||
>prop0 : Symbol(Testing123.prop0, Decl(decoratedClassExportsCommonJS1.ts, 2, 25))
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
=== tests/cases/conformance/decorators/class/decoratedClassExportsCommonJS1.ts ===
|
||||
declare var Something: any;
|
||||
>Something : any
|
||||
|
||||
@Something({ v: () => Testing123 })
|
||||
>Something({ v: () => Testing123 }) : any
|
||||
>Something : any
|
||||
>{ v: () => Testing123 } : { v: () => typeof Testing123; }
|
||||
>v : () => typeof Testing123
|
||||
>() => Testing123 : () => typeof Testing123
|
||||
>Testing123 : typeof Testing123
|
||||
|
||||
export class Testing123 {
|
||||
>Testing123 : Testing123
|
||||
|
||||
static prop0: string;
|
||||
>prop0 : string
|
||||
|
||||
static prop1 = Testing123.prop0;
|
||||
>prop1 : string
|
||||
>Testing123.prop0 : string
|
||||
>Testing123 : typeof Testing123
|
||||
>prop0 : string
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
//// [a.ts]
|
||||
|
||||
declare function forwardRef(x: any): any;
|
||||
declare var Something: any;
|
||||
@Something({ v: () => Testing123 })
|
||||
export class Testing123 { }
|
||||
|
||||
//// [a.js]
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
let Testing123_1 = class Testing123 {
|
||||
};
|
||||
let Testing123 = Testing123_1;
|
||||
Testing123 = Testing123_1 = __decorate([
|
||||
Something({ v: () => Testing123 }),
|
||||
__metadata('design:paramtypes', [])
|
||||
], Testing123);
|
||||
exports.Testing123 = Testing123;
|
||||
@@ -0,0 +1,17 @@
|
||||
=== tests/cases/conformance/decorators/class/a.ts ===
|
||||
|
||||
declare function forwardRef(x: any): any;
|
||||
>forwardRef : Symbol(forwardRef, Decl(a.ts, 0, 0))
|
||||
>x : Symbol(x, Decl(a.ts, 1, 28))
|
||||
|
||||
declare var Something: any;
|
||||
>Something : Symbol(Something, Decl(a.ts, 2, 11))
|
||||
|
||||
@Something({ v: () => Testing123 })
|
||||
>Something : Symbol(Something, Decl(a.ts, 2, 11))
|
||||
>v : Symbol(v, Decl(a.ts, 3, 12))
|
||||
>Testing123 : Symbol(Testing123, Decl(a.ts, 2, 27))
|
||||
|
||||
export class Testing123 { }
|
||||
>Testing123 : Symbol(Testing123, Decl(a.ts, 2, 27))
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
=== tests/cases/conformance/decorators/class/a.ts ===
|
||||
|
||||
declare function forwardRef(x: any): any;
|
||||
>forwardRef : (x: any) => any
|
||||
>x : any
|
||||
|
||||
declare var Something: any;
|
||||
>Something : any
|
||||
|
||||
@Something({ v: () => Testing123 })
|
||||
>Something({ v: () => Testing123 }) : any
|
||||
>Something : any
|
||||
>{ v: () => Testing123 } : { v: () => typeof Testing123; }
|
||||
>v : () => typeof Testing123
|
||||
>() => Testing123 : () => typeof Testing123
|
||||
>Testing123 : typeof Testing123
|
||||
|
||||
export class Testing123 { }
|
||||
>Testing123 : Testing123
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
//// [a.ts]
|
||||
|
||||
declare function forwardRef(x: any): any;
|
||||
declare var Something: any;
|
||||
@Something({ v: () => Testing123 })
|
||||
export class Testing123 {
|
||||
static prop0: string;
|
||||
static prop1 = Testing123.prop0;
|
||||
}
|
||||
|
||||
//// [a.js]
|
||||
System.register([], function(exports_1, context_1) {
|
||||
"use strict";
|
||||
var __moduleName = context_1 && context_1.id;
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
var Testing123;
|
||||
return {
|
||||
setters:[],
|
||||
execute: function() {
|
||||
let Testing123_1 = class Testing123 {
|
||||
};
|
||||
let Testing123 = Testing123_1;
|
||||
Testing123.prop1 = Testing123.prop0;
|
||||
Testing123 = Testing123_1 = __decorate([
|
||||
Something({ v: () => Testing123 }),
|
||||
__metadata('design:paramtypes', [])
|
||||
], Testing123);
|
||||
exports_1("Testing123", Testing123);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,26 @@
|
||||
=== tests/cases/conformance/decorators/class/a.ts ===
|
||||
|
||||
declare function forwardRef(x: any): any;
|
||||
>forwardRef : Symbol(forwardRef, Decl(a.ts, 0, 0))
|
||||
>x : Symbol(x, Decl(a.ts, 1, 28))
|
||||
|
||||
declare var Something: any;
|
||||
>Something : Symbol(Something, Decl(a.ts, 2, 11))
|
||||
|
||||
@Something({ v: () => Testing123 })
|
||||
>Something : Symbol(Something, Decl(a.ts, 2, 11))
|
||||
>v : Symbol(v, Decl(a.ts, 3, 12))
|
||||
>Testing123 : Symbol(Testing123, Decl(a.ts, 2, 27))
|
||||
|
||||
export class Testing123 {
|
||||
>Testing123 : Symbol(Testing123, Decl(a.ts, 2, 27))
|
||||
|
||||
static prop0: string;
|
||||
>prop0 : Symbol(Testing123.prop0, Decl(a.ts, 4, 25))
|
||||
|
||||
static prop1 = Testing123.prop0;
|
||||
>prop1 : Symbol(Testing123.prop1, Decl(a.ts, 5, 25))
|
||||
>Testing123.prop0 : Symbol(Testing123.prop0, Decl(a.ts, 4, 25))
|
||||
>Testing123 : Symbol(Testing123, Decl(a.ts, 2, 27))
|
||||
>prop0 : Symbol(Testing123.prop0, Decl(a.ts, 4, 25))
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
=== tests/cases/conformance/decorators/class/a.ts ===
|
||||
|
||||
declare function forwardRef(x: any): any;
|
||||
>forwardRef : (x: any) => any
|
||||
>x : any
|
||||
|
||||
declare var Something: any;
|
||||
>Something : any
|
||||
|
||||
@Something({ v: () => Testing123 })
|
||||
>Something({ v: () => Testing123 }) : any
|
||||
>Something : any
|
||||
>{ v: () => Testing123 } : { v: () => typeof Testing123; }
|
||||
>v : () => typeof Testing123
|
||||
>() => Testing123 : () => typeof Testing123
|
||||
>Testing123 : typeof Testing123
|
||||
|
||||
export class Testing123 {
|
||||
>Testing123 : Testing123
|
||||
|
||||
static prop0: string;
|
||||
>prop0 : string
|
||||
|
||||
static prop1 = Testing123.prop0;
|
||||
>prop1 : string
|
||||
>Testing123.prop0 : string
|
||||
>Testing123 : typeof Testing123
|
||||
>prop0 : string
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//// [a.ts]
|
||||
|
||||
declare function forwardRef(x: any): any;
|
||||
declare var Something: any;
|
||||
@Something({ v: () => Testing123 })
|
||||
export class Testing123 { }
|
||||
|
||||
//// [a.js]
|
||||
System.register([], function(exports_1, context_1) {
|
||||
"use strict";
|
||||
var __moduleName = context_1 && context_1.id;
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
var Testing123;
|
||||
return {
|
||||
setters:[],
|
||||
execute: function() {
|
||||
let Testing123_1 = class Testing123 {
|
||||
};
|
||||
let Testing123 = Testing123_1;
|
||||
Testing123 = Testing123_1 = __decorate([
|
||||
Something({ v: () => Testing123 }),
|
||||
__metadata('design:paramtypes', [])
|
||||
], Testing123);
|
||||
exports_1("Testing123", Testing123);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,17 @@
|
||||
=== tests/cases/conformance/decorators/class/a.ts ===
|
||||
|
||||
declare function forwardRef(x: any): any;
|
||||
>forwardRef : Symbol(forwardRef, Decl(a.ts, 0, 0))
|
||||
>x : Symbol(x, Decl(a.ts, 1, 28))
|
||||
|
||||
declare var Something: any;
|
||||
>Something : Symbol(Something, Decl(a.ts, 2, 11))
|
||||
|
||||
@Something({ v: () => Testing123 })
|
||||
>Something : Symbol(Something, Decl(a.ts, 2, 11))
|
||||
>v : Symbol(v, Decl(a.ts, 3, 12))
|
||||
>Testing123 : Symbol(Testing123, Decl(a.ts, 2, 27))
|
||||
|
||||
export class Testing123 { }
|
||||
>Testing123 : Symbol(Testing123, Decl(a.ts, 2, 27))
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
=== tests/cases/conformance/decorators/class/a.ts ===
|
||||
|
||||
declare function forwardRef(x: any): any;
|
||||
>forwardRef : (x: any) => any
|
||||
>x : any
|
||||
|
||||
declare var Something: any;
|
||||
>Something : any
|
||||
|
||||
@Something({ v: () => Testing123 })
|
||||
>Something({ v: () => Testing123 }) : any
|
||||
>Something : any
|
||||
>{ v: () => Testing123 } : { v: () => typeof Testing123; }
|
||||
>v : () => typeof Testing123
|
||||
>() => Testing123 : () => typeof Testing123
|
||||
>Testing123 : typeof Testing123
|
||||
|
||||
export class Testing123 { }
|
||||
>Testing123 : Testing123
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
tests/cases/compiler/b.d.ts(2,20): error TS2305: Module '"tests/cases/compiler/a".ns' has no exported member 'IFoo'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/a.d.ts (0 errors) ====
|
||||
export = ns;
|
||||
|
||||
export as namespace ns;
|
||||
|
||||
declare namespace ns {
|
||||
export var x: number;
|
||||
export interface IFoo { }
|
||||
}
|
||||
|
||||
==== tests/cases/compiler/b.d.ts (1 errors) ====
|
||||
declare namespace ns.something {
|
||||
export var p: ns.IFoo;
|
||||
~~~~
|
||||
!!! error TS2305: Module '"tests/cases/compiler/a".ns' has no exported member 'IFoo'.
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
//// [tests/cases/compiler/unusedTypeParameters6.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
|
||||
class C<T> { }
|
||||
|
||||
//// [b.ts]
|
||||
interface C<T> { a: T; }
|
||||
|
||||
//// [a.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
}());
|
||||
//// [b.js]
|
||||
@@ -0,0 +1,13 @@
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
|
||||
class C<T> { }
|
||||
>C : Symbol(C, Decl(a.ts, 0, 0), Decl(b.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(a.ts, 1, 8), Decl(b.ts, 0, 12))
|
||||
|
||||
=== tests/cases/compiler/b.ts ===
|
||||
interface C<T> { a: T; }
|
||||
>C : Symbol(C, Decl(a.ts, 0, 0), Decl(b.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(a.ts, 1, 8), Decl(b.ts, 0, 12))
|
||||
>a : Symbol(C.a, Decl(b.ts, 0, 16))
|
||||
>T : Symbol(T, Decl(a.ts, 1, 8), Decl(b.ts, 0, 12))
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
|
||||
class C<T> { }
|
||||
>C : C<T>
|
||||
>T : T
|
||||
|
||||
=== tests/cases/compiler/b.ts ===
|
||||
interface C<T> { a: T; }
|
||||
>C : C<T>
|
||||
>T : T
|
||||
>a : T
|
||||
>T : T
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
//// [tests/cases/compiler/unusedTypeParameters7.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
|
||||
class C<T> { a: T; }
|
||||
|
||||
//// [b.ts]
|
||||
interface C<T> { }
|
||||
|
||||
//// [a.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
}());
|
||||
//// [b.js]
|
||||
@@ -0,0 +1,13 @@
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
|
||||
class C<T> { a: T; }
|
||||
>C : Symbol(C, Decl(a.ts, 0, 0), Decl(b.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(a.ts, 1, 8), Decl(b.ts, 0, 12))
|
||||
>a : Symbol(C.a, Decl(a.ts, 1, 12))
|
||||
>T : Symbol(T, Decl(a.ts, 1, 8), Decl(b.ts, 0, 12))
|
||||
|
||||
=== tests/cases/compiler/b.ts ===
|
||||
interface C<T> { }
|
||||
>C : Symbol(C, Decl(a.ts, 0, 0), Decl(b.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(a.ts, 1, 8), Decl(b.ts, 0, 12))
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
|
||||
class C<T> { a: T; }
|
||||
>C : C<T>
|
||||
>T : T
|
||||
>a : T
|
||||
>T : T
|
||||
|
||||
=== tests/cases/compiler/b.ts ===
|
||||
interface C<T> { }
|
||||
>C : C<T>
|
||||
>T : T
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
tests/cases/compiler/b.ts(1,13): error TS6133: 'T' is declared but never used.
|
||||
|
||||
|
||||
==== tests/cases/compiler/a.ts (0 errors) ====
|
||||
|
||||
class C<T> { }
|
||||
|
||||
==== tests/cases/compiler/b.ts (1 errors) ====
|
||||
interface C<T> { }
|
||||
~
|
||||
!!! error TS6133: 'T' is declared but never used.
|
||||
@@ -0,0 +1,16 @@
|
||||
//// [tests/cases/compiler/unusedTypeParameters8.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
|
||||
class C<T> { }
|
||||
|
||||
//// [b.ts]
|
||||
interface C<T> { }
|
||||
|
||||
//// [a.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
}());
|
||||
//// [b.js]
|
||||
@@ -0,0 +1,30 @@
|
||||
//// [unusedTypeParameters9.ts]
|
||||
|
||||
// clas + interface
|
||||
class C1<T> { }
|
||||
interface C1<T> { a: T; }
|
||||
|
||||
// interface + class
|
||||
class C2<T> { a: T; }
|
||||
interface C2<T> { }
|
||||
|
||||
// interfaces
|
||||
interface C3<T> { a(c: (p: T) => void): void; }
|
||||
interface C3<T> { b: string; }
|
||||
interface C3<T> { c: number; }
|
||||
interface C3<T> { d: boolean; }
|
||||
interface C3<T> { e: any; }
|
||||
|
||||
//// [unusedTypeParameters9.js]
|
||||
// clas + interface
|
||||
var C1 = (function () {
|
||||
function C1() {
|
||||
}
|
||||
return C1;
|
||||
}());
|
||||
// interface + class
|
||||
var C2 = (function () {
|
||||
function C2() {
|
||||
}
|
||||
return C2;
|
||||
}());
|
||||
@@ -0,0 +1,53 @@
|
||||
=== tests/cases/compiler/unusedTypeParameters9.ts ===
|
||||
|
||||
// clas + interface
|
||||
class C1<T> { }
|
||||
>C1 : Symbol(C1, Decl(unusedTypeParameters9.ts, 0, 0), Decl(unusedTypeParameters9.ts, 2, 15))
|
||||
>T : Symbol(T, Decl(unusedTypeParameters9.ts, 2, 9), Decl(unusedTypeParameters9.ts, 3, 13))
|
||||
|
||||
interface C1<T> { a: T; }
|
||||
>C1 : Symbol(C1, Decl(unusedTypeParameters9.ts, 0, 0), Decl(unusedTypeParameters9.ts, 2, 15))
|
||||
>T : Symbol(T, Decl(unusedTypeParameters9.ts, 2, 9), Decl(unusedTypeParameters9.ts, 3, 13))
|
||||
>a : Symbol(C1.a, Decl(unusedTypeParameters9.ts, 3, 17))
|
||||
>T : Symbol(T, Decl(unusedTypeParameters9.ts, 2, 9), Decl(unusedTypeParameters9.ts, 3, 13))
|
||||
|
||||
// interface + class
|
||||
class C2<T> { a: T; }
|
||||
>C2 : Symbol(C2, Decl(unusedTypeParameters9.ts, 3, 25), Decl(unusedTypeParameters9.ts, 6, 21))
|
||||
>T : Symbol(T, Decl(unusedTypeParameters9.ts, 6, 9), Decl(unusedTypeParameters9.ts, 7, 13))
|
||||
>a : Symbol(C2.a, Decl(unusedTypeParameters9.ts, 6, 13))
|
||||
>T : Symbol(T, Decl(unusedTypeParameters9.ts, 6, 9), Decl(unusedTypeParameters9.ts, 7, 13))
|
||||
|
||||
interface C2<T> { }
|
||||
>C2 : Symbol(C2, Decl(unusedTypeParameters9.ts, 3, 25), Decl(unusedTypeParameters9.ts, 6, 21))
|
||||
>T : Symbol(T, Decl(unusedTypeParameters9.ts, 6, 9), Decl(unusedTypeParameters9.ts, 7, 13))
|
||||
|
||||
// interfaces
|
||||
interface C3<T> { a(c: (p: T) => void): void; }
|
||||
>C3 : Symbol(C3, Decl(unusedTypeParameters9.ts, 7, 19), Decl(unusedTypeParameters9.ts, 10, 47), Decl(unusedTypeParameters9.ts, 11, 30), Decl(unusedTypeParameters9.ts, 12, 30), Decl(unusedTypeParameters9.ts, 13, 32))
|
||||
>T : Symbol(T, Decl(unusedTypeParameters9.ts, 10, 13), Decl(unusedTypeParameters9.ts, 11, 13), Decl(unusedTypeParameters9.ts, 12, 13), Decl(unusedTypeParameters9.ts, 13, 13), Decl(unusedTypeParameters9.ts, 14, 13))
|
||||
>a : Symbol(C3.a, Decl(unusedTypeParameters9.ts, 10, 17))
|
||||
>c : Symbol(c, Decl(unusedTypeParameters9.ts, 10, 20))
|
||||
>p : Symbol(p, Decl(unusedTypeParameters9.ts, 10, 24))
|
||||
>T : Symbol(T, Decl(unusedTypeParameters9.ts, 10, 13), Decl(unusedTypeParameters9.ts, 11, 13), Decl(unusedTypeParameters9.ts, 12, 13), Decl(unusedTypeParameters9.ts, 13, 13), Decl(unusedTypeParameters9.ts, 14, 13))
|
||||
|
||||
interface C3<T> { b: string; }
|
||||
>C3 : Symbol(C3, Decl(unusedTypeParameters9.ts, 7, 19), Decl(unusedTypeParameters9.ts, 10, 47), Decl(unusedTypeParameters9.ts, 11, 30), Decl(unusedTypeParameters9.ts, 12, 30), Decl(unusedTypeParameters9.ts, 13, 32))
|
||||
>T : Symbol(T, Decl(unusedTypeParameters9.ts, 10, 13), Decl(unusedTypeParameters9.ts, 11, 13), Decl(unusedTypeParameters9.ts, 12, 13), Decl(unusedTypeParameters9.ts, 13, 13), Decl(unusedTypeParameters9.ts, 14, 13))
|
||||
>b : Symbol(C3.b, Decl(unusedTypeParameters9.ts, 11, 17))
|
||||
|
||||
interface C3<T> { c: number; }
|
||||
>C3 : Symbol(C3, Decl(unusedTypeParameters9.ts, 7, 19), Decl(unusedTypeParameters9.ts, 10, 47), Decl(unusedTypeParameters9.ts, 11, 30), Decl(unusedTypeParameters9.ts, 12, 30), Decl(unusedTypeParameters9.ts, 13, 32))
|
||||
>T : Symbol(T, Decl(unusedTypeParameters9.ts, 10, 13), Decl(unusedTypeParameters9.ts, 11, 13), Decl(unusedTypeParameters9.ts, 12, 13), Decl(unusedTypeParameters9.ts, 13, 13), Decl(unusedTypeParameters9.ts, 14, 13))
|
||||
>c : Symbol(C3.c, Decl(unusedTypeParameters9.ts, 12, 17))
|
||||
|
||||
interface C3<T> { d: boolean; }
|
||||
>C3 : Symbol(C3, Decl(unusedTypeParameters9.ts, 7, 19), Decl(unusedTypeParameters9.ts, 10, 47), Decl(unusedTypeParameters9.ts, 11, 30), Decl(unusedTypeParameters9.ts, 12, 30), Decl(unusedTypeParameters9.ts, 13, 32))
|
||||
>T : Symbol(T, Decl(unusedTypeParameters9.ts, 10, 13), Decl(unusedTypeParameters9.ts, 11, 13), Decl(unusedTypeParameters9.ts, 12, 13), Decl(unusedTypeParameters9.ts, 13, 13), Decl(unusedTypeParameters9.ts, 14, 13))
|
||||
>d : Symbol(C3.d, Decl(unusedTypeParameters9.ts, 13, 17))
|
||||
|
||||
interface C3<T> { e: any; }
|
||||
>C3 : Symbol(C3, Decl(unusedTypeParameters9.ts, 7, 19), Decl(unusedTypeParameters9.ts, 10, 47), Decl(unusedTypeParameters9.ts, 11, 30), Decl(unusedTypeParameters9.ts, 12, 30), Decl(unusedTypeParameters9.ts, 13, 32))
|
||||
>T : Symbol(T, Decl(unusedTypeParameters9.ts, 10, 13), Decl(unusedTypeParameters9.ts, 11, 13), Decl(unusedTypeParameters9.ts, 12, 13), Decl(unusedTypeParameters9.ts, 13, 13), Decl(unusedTypeParameters9.ts, 14, 13))
|
||||
>e : Symbol(C3.e, Decl(unusedTypeParameters9.ts, 14, 17))
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
=== tests/cases/compiler/unusedTypeParameters9.ts ===
|
||||
|
||||
// clas + interface
|
||||
class C1<T> { }
|
||||
>C1 : C1<T>
|
||||
>T : T
|
||||
|
||||
interface C1<T> { a: T; }
|
||||
>C1 : C1<T>
|
||||
>T : T
|
||||
>a : T
|
||||
>T : T
|
||||
|
||||
// interface + class
|
||||
class C2<T> { a: T; }
|
||||
>C2 : C2<T>
|
||||
>T : T
|
||||
>a : T
|
||||
>T : T
|
||||
|
||||
interface C2<T> { }
|
||||
>C2 : C2<T>
|
||||
>T : T
|
||||
|
||||
// interfaces
|
||||
interface C3<T> { a(c: (p: T) => void): void; }
|
||||
>C3 : C3<T>
|
||||
>T : T
|
||||
>a : (c: (p: T) => void) => void
|
||||
>c : (p: T) => void
|
||||
>p : T
|
||||
>T : T
|
||||
|
||||
interface C3<T> { b: string; }
|
||||
>C3 : C3<T>
|
||||
>T : T
|
||||
>b : string
|
||||
|
||||
interface C3<T> { c: number; }
|
||||
>C3 : C3<T>
|
||||
>T : T
|
||||
>c : number
|
||||
|
||||
interface C3<T> { d: boolean; }
|
||||
>C3 : C3<T>
|
||||
>T : T
|
||||
>d : boolean
|
||||
|
||||
interface C3<T> { e: any; }
|
||||
>C3 : C3<T>
|
||||
>T : T
|
||||
>e : any
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
// @filename: a.d.ts
|
||||
export = ns;
|
||||
|
||||
export as namespace ns;
|
||||
|
||||
declare namespace ns {
|
||||
export var x: number;
|
||||
export interface IFoo { }
|
||||
}
|
||||
|
||||
// @filename: b.d.ts
|
||||
declare namespace ns.something {
|
||||
export var p: ns.IFoo;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
//@noUnusedLocals:true
|
||||
//@noUnusedParameters:true
|
||||
|
||||
// @fileName: a.ts
|
||||
class C<T> { }
|
||||
|
||||
// @fileName: b.ts
|
||||
interface C<T> { a: T; }
|
||||
@@ -0,0 +1,8 @@
|
||||
//@noUnusedLocals:true
|
||||
//@noUnusedParameters:true
|
||||
|
||||
// @fileName: a.ts
|
||||
class C<T> { a: T; }
|
||||
|
||||
// @fileName: b.ts
|
||||
interface C<T> { }
|
||||
@@ -0,0 +1,8 @@
|
||||
//@noUnusedLocals:true
|
||||
//@noUnusedParameters:true
|
||||
|
||||
// @fileName: a.ts
|
||||
class C<T> { }
|
||||
|
||||
// @fileName: b.ts
|
||||
interface C<T> { }
|
||||
@@ -0,0 +1,17 @@
|
||||
//@noUnusedLocals:true
|
||||
//@noUnusedParameters:true
|
||||
|
||||
// clas + interface
|
||||
class C1<T> { }
|
||||
interface C1<T> { a: T; }
|
||||
|
||||
// interface + class
|
||||
class C2<T> { a: T; }
|
||||
interface C2<T> { }
|
||||
|
||||
// interfaces
|
||||
interface C3<T> { a(c: (p: T) => void): void; }
|
||||
interface C3<T> { b: string; }
|
||||
interface C3<T> { c: number; }
|
||||
interface C3<T> { d: boolean; }
|
||||
interface C3<T> { e: any; }
|
||||
@@ -0,0 +1,13 @@
|
||||
// @target: es6
|
||||
// @experimentaldecorators: true
|
||||
// @emitDecoratorMetadata: true
|
||||
// @module: commonjs
|
||||
// @filename: a.ts
|
||||
|
||||
declare function forwardRef(x: any): any;
|
||||
declare var Something: any;
|
||||
@Something({ v: () => Testing123 })
|
||||
export class Testing123 {
|
||||
static prop0: string;
|
||||
static prop1 = Testing123.prop0;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// @target: es6
|
||||
// @experimentaldecorators: true
|
||||
// @emitDecoratorMetadata: true
|
||||
// @module: commonjs
|
||||
// @filename: a.ts
|
||||
|
||||
declare function forwardRef(x: any): any;
|
||||
declare var Something: any;
|
||||
@Something({ v: () => Testing123 })
|
||||
export class Testing123 { }
|
||||
@@ -0,0 +1,13 @@
|
||||
// @target: es6
|
||||
// @experimentaldecorators: true
|
||||
// @emitDecoratorMetadata: true
|
||||
// @module: system
|
||||
// @filename: a.ts
|
||||
|
||||
declare function forwardRef(x: any): any;
|
||||
declare var Something: any;
|
||||
@Something({ v: () => Testing123 })
|
||||
export class Testing123 {
|
||||
static prop0: string;
|
||||
static prop1 = Testing123.prop0;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// @target: es6
|
||||
// @experimentaldecorators: true
|
||||
// @emitDecoratorMetadata: true
|
||||
// @module: system
|
||||
// @filename: a.ts
|
||||
|
||||
declare function forwardRef(x: any): any;
|
||||
declare var Something: any;
|
||||
@Something({ v: () => Testing123 })
|
||||
export class Testing123 { }
|
||||
@@ -1,4 +1,4 @@
|
||||
/// <reference path='..\src\harness\external\node.d.ts'/>
|
||||
/// <reference types="node" />
|
||||
|
||||
import http = require("http");
|
||||
import fs = require("fs");
|
||||
|
||||
Reference in New Issue
Block a user