mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' into asyncFunctions
This commit is contained in:
+3
-1
@@ -21,6 +21,7 @@ tests/services/baselines/local/*
|
||||
tests/baselines/prototyping/local/*
|
||||
tests/baselines/rwc/*
|
||||
tests/baselines/test262/*
|
||||
tests/baselines/reference/projectOutput/*
|
||||
tests/baselines/local/projectOutput/*
|
||||
tests/services/baselines/prototyping/local/*
|
||||
tests/services/browser/typescriptServices.js
|
||||
@@ -46,4 +47,5 @@ scripts/*.js.map
|
||||
coverage/
|
||||
internal/
|
||||
**/.DS_Store
|
||||
.settings/
|
||||
.settings/*
|
||||
!.settings/tasks.json
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
// Available variables which can be used inside of strings.
|
||||
// ${workspaceRoot}: the root folder of the team
|
||||
// ${file}: the current opened file
|
||||
// ${fileBasename}: the current opened file's basename
|
||||
// ${fileDirname}: the current opened file's dirname
|
||||
// ${fileExtname}: the current opened file's extension
|
||||
// ${cwd}: the current working directory of the spawned process
|
||||
{
|
||||
"version": "0.1.0",
|
||||
"command": "jake",
|
||||
"isShellCommand": true,
|
||||
"showOutput": "silent",
|
||||
"tasks": [
|
||||
{
|
||||
"taskName": "local",
|
||||
"isBuildCommand": true,
|
||||
"showOutput": "silent",
|
||||
"problemMatcher": [
|
||||
"$tsc"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -29,7 +29,7 @@ There are many ways to [contribute](https://github.com/Microsoft/TypeScript/blob
|
||||
|
||||
## Building
|
||||
|
||||
In order to build the TypeScript compiler, ensure that you have [Git](http://git-scm.com/downloads) and [Node.js](http://nodejs.org/) installed.
|
||||
In order to build the TypeScript compiler, ensure that you have [Git](http://git-scm.com/downloads) and [Node.js](http://nodejs.org/) installed. Note that you need to have autocrlf off as we track whitespace changes (`git config --global core.autocrlf false`).
|
||||
|
||||
Clone a copy of the repo:
|
||||
|
||||
|
||||
Vendored
+2
@@ -4766,6 +4766,7 @@ interface PromiseLike<T> {
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): PromiseLike<TResult>;
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): PromiseLike<TResult>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4779,6 +4780,7 @@ interface Promise<T> {
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>;
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): Promise<TResult>;
|
||||
|
||||
/**
|
||||
* Attaches a callback for only the rejection of the Promise.
|
||||
|
||||
Vendored
+2
@@ -4766,6 +4766,7 @@ interface PromiseLike<T> {
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): PromiseLike<TResult>;
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): PromiseLike<TResult>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4779,6 +4780,7 @@ interface Promise<T> {
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>;
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): Promise<TResult>;
|
||||
|
||||
/**
|
||||
* Attaches a callback for only the rejection of the Promise.
|
||||
|
||||
+164
-103
@@ -431,9 +431,13 @@ var ts;
|
||||
return 3;
|
||||
return 2;
|
||||
}
|
||||
if (path.lastIndexOf("file:///", 0) === 0) {
|
||||
return "file:///".length;
|
||||
}
|
||||
var idx = path.indexOf('://');
|
||||
if (idx !== -1)
|
||||
return idx + 3;
|
||||
if (idx !== -1) {
|
||||
return idx + "://".length;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
ts.getRootLength = getRootLength;
|
||||
@@ -584,10 +588,11 @@ var ts;
|
||||
return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension;
|
||||
}
|
||||
ts.fileExtensionIs = fileExtensionIs;
|
||||
var supportedExtensions = [".d.ts", ".ts", ".js"];
|
||||
ts.supportedExtensions = [".ts", ".d.ts"];
|
||||
var extensionsToRemove = [".d.ts", ".ts", ".js"];
|
||||
function removeFileExtension(path) {
|
||||
for (var _i = 0; _i < supportedExtensions.length; _i++) {
|
||||
var ext = supportedExtensions[_i];
|
||||
for (var _i = 0; _i < extensionsToRemove.length; _i++) {
|
||||
var ext = extensionsToRemove[_i];
|
||||
if (fileExtensionIs(path, ext)) {
|
||||
return path.substr(0, path.length - ext.length);
|
||||
}
|
||||
@@ -1358,8 +1363,8 @@ var ts;
|
||||
Unknown_compiler_option_0: { code: 5023, category: ts.DiagnosticCategory.Error, key: "Unknown compiler option '{0}'." },
|
||||
Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: ts.DiagnosticCategory.Error, key: "Compiler option '{0}' requires a value of type {1}." },
|
||||
Could_not_write_file_0_Colon_1: { code: 5033, category: ts.DiagnosticCategory.Error, key: "Could not write file '{0}': {1}" },
|
||||
Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5038, category: ts.DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option." },
|
||||
Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5039, category: ts.DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option." },
|
||||
Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5038, category: ts.DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified without specifying 'sourceMap' option." },
|
||||
Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5039, category: ts.DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option." },
|
||||
Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: ts.DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." },
|
||||
Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: ts.DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'declaration'." },
|
||||
Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: ts.DiagnosticCategory.Error, key: "Option 'project' cannot be mixed with source files on a command line." },
|
||||
@@ -1379,7 +1384,7 @@ var ts;
|
||||
Watch_input_files: { code: 6005, category: ts.DiagnosticCategory.Message, key: "Watch input files." },
|
||||
Redirect_output_structure_to_the_directory: { code: 6006, category: ts.DiagnosticCategory.Message, key: "Redirect output structure to the directory." },
|
||||
Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: ts.DiagnosticCategory.Message, key: "Do not erase const enum declarations in generated code." },
|
||||
Do_not_emit_outputs_if_any_type_checking_errors_were_reported: { code: 6008, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs if any type checking errors were reported." },
|
||||
Do_not_emit_outputs_if_any_errors_were_reported: { code: 6008, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs if any errors were reported." },
|
||||
Do_not_emit_comments_to_output: { code: 6009, category: ts.DiagnosticCategory.Message, key: "Do not emit comments to output." },
|
||||
Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs." },
|
||||
Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" },
|
||||
@@ -1412,7 +1417,7 @@ var ts;
|
||||
Corrupted_locale_file_0: { code: 6051, category: ts.DiagnosticCategory.Error, key: "Corrupted locale file {0}." },
|
||||
Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: ts.DiagnosticCategory.Message, key: "Raise error on expressions and declarations with an implied 'any' type." },
|
||||
File_0_not_found: { code: 6053, category: ts.DiagnosticCategory.Error, key: "File '{0}' not found." },
|
||||
File_0_must_have_extension_ts_or_d_ts: { code: 6054, category: ts.DiagnosticCategory.Error, key: "File '{0}' must have extension '.ts' or '.d.ts'." },
|
||||
File_0_has_unsupported_extension_The_only_supported_extensions_are_1: { code: 6054, category: ts.DiagnosticCategory.Error, key: "File '{0}' has unsupported extension. The only supported extensions are {1}." },
|
||||
Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: ts.DiagnosticCategory.Message, key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." },
|
||||
Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: ts.DiagnosticCategory.Message, key: "Do not emit declarations for code that has an '@internal' annotation." },
|
||||
Preserve_new_lines_when_emitting_code: { code: 6057, category: ts.DiagnosticCategory.Message, key: "Preserve new-lines when emitting code." },
|
||||
@@ -3068,6 +3073,9 @@ var ts;
|
||||
else if (ts.isBlockOrCatchScoped(node)) {
|
||||
bindBlockScopedVariableDeclaration(node);
|
||||
}
|
||||
else if (ts.isParameterDeclaration(node)) {
|
||||
bindDeclaration(node, 1, 107455, false);
|
||||
}
|
||||
else {
|
||||
bindDeclaration(node, 1, 107454, false);
|
||||
}
|
||||
@@ -3592,9 +3600,6 @@ var ts;
|
||||
case 141:
|
||||
case 143:
|
||||
case 144:
|
||||
case 163:
|
||||
case 164:
|
||||
case 201:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -4176,6 +4181,18 @@ var ts;
|
||||
return false;
|
||||
}
|
||||
ts.isModifier = isModifier;
|
||||
function isParameterDeclaration(node) {
|
||||
var root = getRootDeclaration(node);
|
||||
return root.kind === 130;
|
||||
}
|
||||
ts.isParameterDeclaration = isParameterDeclaration;
|
||||
function getRootDeclaration(node) {
|
||||
while (node.kind === 153) {
|
||||
node = node.parent.parent;
|
||||
}
|
||||
return node;
|
||||
}
|
||||
ts.getRootDeclaration = getRootDeclaration;
|
||||
function nodeStartsNewLexicalEnvironment(n) {
|
||||
return isFunctionLike(n) || n.kind === 206 || n.kind === 228;
|
||||
}
|
||||
@@ -5498,13 +5515,6 @@ var ts;
|
||||
return token === t && tryParse(nextTokenCanFollowModifier);
|
||||
}
|
||||
function nextTokenCanFollowModifier() {
|
||||
nextToken();
|
||||
return canFollowModifier();
|
||||
}
|
||||
function parseAnyContextualModifier() {
|
||||
return ts.isModifier(token) && tryParse(nextTokenCanFollowContextualModifier);
|
||||
}
|
||||
function nextTokenCanFollowContextualModifier() {
|
||||
if (token === 70) {
|
||||
return nextToken() === 77;
|
||||
}
|
||||
@@ -5521,6 +5531,9 @@ var ts;
|
||||
nextToken();
|
||||
return canFollowModifier();
|
||||
}
|
||||
function parseAnyContextualModifier() {
|
||||
return ts.isModifier(token) && tryParse(nextTokenCanFollowModifier);
|
||||
}
|
||||
function canFollowModifier() {
|
||||
return token === 18
|
||||
|| token === 14
|
||||
@@ -9209,10 +9222,11 @@ var ts;
|
||||
return symbol;
|
||||
}
|
||||
}
|
||||
var fileName;
|
||||
var sourceFile;
|
||||
while (true) {
|
||||
var fileName = ts.normalizePath(ts.combinePaths(searchPath, moduleName));
|
||||
sourceFile = host.getSourceFile(fileName + ".ts") || host.getSourceFile(fileName + ".d.ts");
|
||||
fileName = ts.normalizePath(ts.combinePaths(searchPath, moduleName));
|
||||
sourceFile = ts.forEach(ts.supportedExtensions, function (extension) { return host.getSourceFile(fileName + extension); });
|
||||
if (sourceFile || isRelative) {
|
||||
break;
|
||||
}
|
||||
@@ -10157,14 +10171,8 @@ var ts;
|
||||
resolutionTargets.pop();
|
||||
return resolutionResults.pop();
|
||||
}
|
||||
function getRootDeclaration(node) {
|
||||
while (node.kind === 153) {
|
||||
node = node.parent.parent;
|
||||
}
|
||||
return node;
|
||||
}
|
||||
function getDeclarationContainer(node) {
|
||||
node = getRootDeclaration(node);
|
||||
node = ts.getRootDeclaration(node);
|
||||
return node.kind === 199 ? node.parent.parent.parent : node.parent;
|
||||
}
|
||||
function getTypeOfPrototypeProperty(prototype) {
|
||||
@@ -10314,7 +10322,7 @@ var ts;
|
||||
}
|
||||
type = declaration.dotDotDotToken ? anyArrayType : anyType;
|
||||
if (reportErrors && compilerOptions.noImplicitAny) {
|
||||
var root = getRootDeclaration(declaration);
|
||||
var root = ts.getRootDeclaration(declaration);
|
||||
if (!isPrivateWithinAmbient(root) && !(root.kind === 130 && isPrivateWithinAmbient(root.parent))) {
|
||||
reportImplicitAnyError(declaration, type);
|
||||
}
|
||||
@@ -10427,7 +10435,10 @@ var ts;
|
||||
function getTypeOfAlias(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
if (!links.type) {
|
||||
links.type = getTypeOfSymbol(resolveAlias(symbol));
|
||||
var targetSymbol = resolveAlias(symbol);
|
||||
links.type = targetSymbol.flags & 107455
|
||||
? getTypeOfSymbol(targetSymbol)
|
||||
: unknownType;
|
||||
}
|
||||
return links.type;
|
||||
}
|
||||
@@ -11441,7 +11452,13 @@ var ts;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
var removeSubtypesStack = [];
|
||||
function removeSubtypes(types) {
|
||||
var typeListId = getTypeListId(types);
|
||||
if (removeSubtypesStack.lastIndexOf(typeListId) >= 0) {
|
||||
return;
|
||||
}
|
||||
removeSubtypesStack.push(typeListId);
|
||||
var i = types.length;
|
||||
while (i > 0) {
|
||||
i--;
|
||||
@@ -11449,6 +11466,7 @@ var ts;
|
||||
types.splice(i, 1);
|
||||
}
|
||||
}
|
||||
removeSubtypesStack.pop();
|
||||
}
|
||||
function containsAnyType(types) {
|
||||
for (var _i = 0; _i < types.length; _i++) {
|
||||
@@ -13004,31 +13022,33 @@ var ts;
|
||||
if (!isTypeSubtypeOf(rightType, globalFunctionType)) {
|
||||
return type;
|
||||
}
|
||||
var targetType;
|
||||
var prototypeProperty = getPropertyOfType(rightType, "prototype");
|
||||
if (prototypeProperty) {
|
||||
var targetType = getTypeOfSymbol(prototypeProperty);
|
||||
if (targetType !== anyType) {
|
||||
if (isTypeSubtypeOf(targetType, type)) {
|
||||
return targetType;
|
||||
}
|
||||
if (type.flags & 16384) {
|
||||
return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); }));
|
||||
}
|
||||
var prototypePropertyType = getTypeOfSymbol(prototypeProperty);
|
||||
if (prototypePropertyType !== anyType) {
|
||||
targetType = prototypePropertyType;
|
||||
}
|
||||
}
|
||||
var constructSignatures;
|
||||
if (rightType.flags & 2048) {
|
||||
constructSignatures = resolveDeclaredMembers(rightType).declaredConstructSignatures;
|
||||
if (!targetType) {
|
||||
var constructSignatures;
|
||||
if (rightType.flags & 2048) {
|
||||
constructSignatures = resolveDeclaredMembers(rightType).declaredConstructSignatures;
|
||||
}
|
||||
else if (rightType.flags & 32768) {
|
||||
constructSignatures = getSignaturesOfType(rightType, 1);
|
||||
}
|
||||
if (constructSignatures && constructSignatures.length) {
|
||||
targetType = getUnionType(ts.map(constructSignatures, function (signature) { return getReturnTypeOfSignature(getErasedSignature(signature)); }));
|
||||
}
|
||||
}
|
||||
else if (rightType.flags & 32768) {
|
||||
constructSignatures = getSignaturesOfType(rightType, 1);
|
||||
}
|
||||
if (constructSignatures && constructSignatures.length !== 0) {
|
||||
var instanceType = getUnionType(ts.map(constructSignatures, function (signature) { return getReturnTypeOfSignature(getErasedSignature(signature)); }));
|
||||
if (targetType) {
|
||||
if (isTypeSubtypeOf(targetType, type)) {
|
||||
return targetType;
|
||||
}
|
||||
if (type.flags & 16384) {
|
||||
return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, instanceType); }));
|
||||
return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); }));
|
||||
}
|
||||
return instanceType;
|
||||
}
|
||||
return type;
|
||||
}
|
||||
@@ -15667,7 +15687,7 @@ var ts;
|
||||
if (ts.isInAmbientContext(node)) {
|
||||
return false;
|
||||
}
|
||||
var root = getRootDeclaration(node);
|
||||
var root = ts.getRootDeclaration(node);
|
||||
if (root.kind === 130 && ts.nodeIsMissing(root.parent.body)) {
|
||||
return false;
|
||||
}
|
||||
@@ -15728,7 +15748,7 @@ var ts;
|
||||
// - ScriptBody : StatementList
|
||||
// It is a Syntax Error if any element of the LexicallyDeclaredNames of StatementList
|
||||
// also occurs in the VarDeclaredNames of StatementList.
|
||||
if ((ts.getCombinedNodeFlags(node) & 12288) !== 0 || isParameterDeclaration(node)) {
|
||||
if ((ts.getCombinedNodeFlags(node) & 12288) !== 0 || ts.isParameterDeclaration(node)) {
|
||||
return;
|
||||
}
|
||||
if (node.kind === 199 && !node.initializer) {
|
||||
@@ -15758,14 +15778,8 @@ var ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
function isParameterDeclaration(node) {
|
||||
while (node.kind === 153) {
|
||||
node = node.parent.parent;
|
||||
}
|
||||
return node.kind === 130;
|
||||
}
|
||||
function checkParameterInitializer(node) {
|
||||
if (getRootDeclaration(node).kind !== 130) {
|
||||
if (ts.getRootDeclaration(node).kind !== 130) {
|
||||
return;
|
||||
}
|
||||
var func = ts.getContainingFunction(node);
|
||||
@@ -15804,7 +15818,7 @@ var ts;
|
||||
if (ts.isBindingPattern(node.name)) {
|
||||
ts.forEach(node.name.elements, checkSourceElement);
|
||||
}
|
||||
if (node.initializer && getRootDeclaration(node).kind === 130 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) {
|
||||
if (node.initializer && ts.getRootDeclaration(node).kind === 130 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) {
|
||||
error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation);
|
||||
return;
|
||||
}
|
||||
@@ -21259,7 +21273,7 @@ var ts;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function emitListWithSpread(elements, multiLine, trailingComma) {
|
||||
function emitListWithSpread(elements, alwaysCopy, multiLine, trailingComma) {
|
||||
var pos = 0;
|
||||
var group = 0;
|
||||
var length = elements.length;
|
||||
@@ -21275,6 +21289,9 @@ var ts;
|
||||
e = e.expression;
|
||||
emitParenthesizedIf(e, group === 0 && needsParenthesisForPropertyAccessOrInvocation(e));
|
||||
pos++;
|
||||
if (pos === length && group === 0 && alwaysCopy && e.kind !== 154) {
|
||||
write(".slice()");
|
||||
}
|
||||
}
|
||||
else {
|
||||
var i = pos;
|
||||
@@ -21312,7 +21329,7 @@ var ts;
|
||||
write("]");
|
||||
}
|
||||
else {
|
||||
emitListWithSpread(elements, (node.flags & 512) !== 0, elements.hasTrailingComma);
|
||||
emitListWithSpread(elements, true, (node.flags & 512) !== 0, elements.hasTrailingComma);
|
||||
}
|
||||
}
|
||||
function emitObjectLiteralBody(node, numElements) {
|
||||
@@ -21638,7 +21655,7 @@ var ts;
|
||||
write("void 0");
|
||||
}
|
||||
write(", ");
|
||||
emitListWithSpread(node.arguments, false, false);
|
||||
emitListWithSpread(node.arguments, false, false, false);
|
||||
write(")");
|
||||
}
|
||||
function emitCallExpression(node) {
|
||||
@@ -22266,7 +22283,7 @@ var ts;
|
||||
if (node.flags & 1) {
|
||||
writeLine();
|
||||
emitStart(node);
|
||||
if (compilerOptions.module === 4) {
|
||||
if (compilerOptions.module === 4 && node.parent === currentSourceFile) {
|
||||
write(exportFunctionForFile + "(\"");
|
||||
if (node.flags & 256) {
|
||||
write("default");
|
||||
@@ -22604,12 +22621,14 @@ var ts;
|
||||
node.parent.kind === 228;
|
||||
}
|
||||
function emitVariableStatement(node) {
|
||||
var startIsEmitted = true;
|
||||
if (!(node.flags & 1)) {
|
||||
startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList);
|
||||
var startIsEmitted = false;
|
||||
if (node.flags & 1) {
|
||||
if (isES6ExportedDeclaration(node)) {
|
||||
write("export ");
|
||||
startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList);
|
||||
}
|
||||
}
|
||||
else if (isES6ExportedDeclaration(node)) {
|
||||
write("export ");
|
||||
else {
|
||||
startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList);
|
||||
}
|
||||
if (startIsEmitted) {
|
||||
@@ -23628,15 +23647,17 @@ var ts;
|
||||
if (!shouldEmitEnumDeclaration(node)) {
|
||||
return;
|
||||
}
|
||||
if (!(node.flags & 1) || isES6ExportedDeclaration(node)) {
|
||||
emitStart(node);
|
||||
if (isES6ExportedDeclaration(node)) {
|
||||
write("export ");
|
||||
if (!shouldHoistDeclarationInSystemJsModule(node)) {
|
||||
if (!(node.flags & 1) || isES6ExportedDeclaration(node)) {
|
||||
emitStart(node);
|
||||
if (isES6ExportedDeclaration(node)) {
|
||||
write("export ");
|
||||
}
|
||||
write("var ");
|
||||
emit(node.name);
|
||||
emitEnd(node);
|
||||
write(";");
|
||||
}
|
||||
write("var ");
|
||||
emit(node.name);
|
||||
emitEnd(node);
|
||||
write(";");
|
||||
}
|
||||
writeLine();
|
||||
emitStart(node);
|
||||
@@ -23658,7 +23679,7 @@ var ts;
|
||||
emitModuleMemberName(node);
|
||||
write(" = {}));");
|
||||
emitEnd(node);
|
||||
if (!isES6ExportedDeclaration(node) && node.flags & 1) {
|
||||
if (!isES6ExportedDeclaration(node) && node.flags & 1 && !shouldHoistDeclarationInSystemJsModule(node)) {
|
||||
writeLine();
|
||||
emitStart(node);
|
||||
write("var ");
|
||||
@@ -23669,6 +23690,14 @@ var ts;
|
||||
write(";");
|
||||
}
|
||||
if (languageVersion < 2 && node.parent === currentSourceFile) {
|
||||
if (compilerOptions.module === 4 && (node.flags & 1)) {
|
||||
writeLine();
|
||||
write(exportFunctionForFile + "(\"");
|
||||
emitDeclarationName(node);
|
||||
write("\", ");
|
||||
emitDeclarationName(node);
|
||||
write(")");
|
||||
}
|
||||
emitExportMemberAssignments(node.name);
|
||||
}
|
||||
}
|
||||
@@ -24255,12 +24284,25 @@ var ts;
|
||||
if (hoistedVars) {
|
||||
writeLine();
|
||||
write("var ");
|
||||
var seen = {};
|
||||
for (var i = 0; i < hoistedVars.length; ++i) {
|
||||
var local = hoistedVars[i];
|
||||
var name_21 = local.kind === 65
|
||||
? local
|
||||
: local.name;
|
||||
if (name_21) {
|
||||
var text = ts.unescapeIdentifier(name_21.text);
|
||||
if (ts.hasProperty(seen, text)) {
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
seen[text] = text;
|
||||
}
|
||||
}
|
||||
if (i !== 0) {
|
||||
write(", ");
|
||||
}
|
||||
if (local.kind === 202 || local.kind === 206) {
|
||||
if (local.kind === 202 || local.kind === 206 || local.kind === 205) {
|
||||
emitDeclarationName(local);
|
||||
}
|
||||
else {
|
||||
@@ -24291,6 +24333,9 @@ var ts;
|
||||
}
|
||||
return exportedDeclarations;
|
||||
function visit(node) {
|
||||
if (node.flags & 2) {
|
||||
return;
|
||||
}
|
||||
if (node.kind === 201) {
|
||||
if (!hoistedFunctionDeclarations) {
|
||||
hoistedFunctionDeclarations = [];
|
||||
@@ -24305,24 +24350,35 @@ var ts;
|
||||
hoistedVars.push(node);
|
||||
return;
|
||||
}
|
||||
if (node.kind === 206 && shouldEmitModuleDeclaration(node)) {
|
||||
if (!hoistedVars) {
|
||||
hoistedVars = [];
|
||||
if (node.kind === 205) {
|
||||
if (shouldEmitEnumDeclaration(node)) {
|
||||
if (!hoistedVars) {
|
||||
hoistedVars = [];
|
||||
}
|
||||
hoistedVars.push(node);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (node.kind === 206) {
|
||||
if (shouldEmitModuleDeclaration(node)) {
|
||||
if (!hoistedVars) {
|
||||
hoistedVars = [];
|
||||
}
|
||||
hoistedVars.push(node);
|
||||
}
|
||||
hoistedVars.push(node);
|
||||
return;
|
||||
}
|
||||
if (node.kind === 199 || node.kind === 153) {
|
||||
if (shouldHoistVariable(node, false)) {
|
||||
var name_21 = node.name;
|
||||
if (name_21.kind === 65) {
|
||||
var name_22 = node.name;
|
||||
if (name_22.kind === 65) {
|
||||
if (!hoistedVars) {
|
||||
hoistedVars = [];
|
||||
}
|
||||
hoistedVars.push(name_21);
|
||||
hoistedVars.push(name_22);
|
||||
}
|
||||
else {
|
||||
ts.forEachChild(name_21, visit);
|
||||
ts.forEachChild(name_22, visit);
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -24992,7 +25048,7 @@ var ts;
|
||||
ts.emitTime = 0;
|
||||
ts.ioReadTime = 0;
|
||||
ts.ioWriteTime = 0;
|
||||
ts.version = "1.5.0";
|
||||
ts.version = "1.5.2";
|
||||
var carriageReturnLineFeed = "\r\n";
|
||||
var lineFeed = "\n";
|
||||
function findConfigFile(searchPath) {
|
||||
@@ -25168,14 +25224,14 @@ var ts;
|
||||
if (options.noEmitOnError && getPreEmitDiagnostics(this).length > 0) {
|
||||
return { diagnostics: [], sourceMaps: undefined, emitSkipped: true };
|
||||
}
|
||||
var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile);
|
||||
var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(options.out ? undefined : sourceFile);
|
||||
var start = new Date().getTime();
|
||||
var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile);
|
||||
ts.emitTime += new Date().getTime() - start;
|
||||
return emitResult;
|
||||
}
|
||||
function getSourceFile(fileName) {
|
||||
fileName = host.getCanonicalFileName(fileName);
|
||||
fileName = host.getCanonicalFileName(ts.normalizeSlashes(fileName));
|
||||
return ts.hasProperty(filesByName, fileName) ? filesByName[fileName] : undefined;
|
||||
}
|
||||
function getDiagnosticsHelper(sourceFile, getDiagnostics) {
|
||||
@@ -25231,42 +25287,49 @@ var ts;
|
||||
function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) {
|
||||
var start;
|
||||
var length;
|
||||
var extensions;
|
||||
var diagnosticArgument;
|
||||
if (refEnd !== undefined && refPos !== undefined) {
|
||||
start = refPos;
|
||||
length = refEnd - refPos;
|
||||
}
|
||||
var diagnostic;
|
||||
if (hasExtension(fileName)) {
|
||||
if (!options.allowNonTsExtensions && !ts.fileExtensionIs(host.getCanonicalFileName(fileName), ".ts")) {
|
||||
diagnostic = ts.Diagnostics.File_0_must_have_extension_ts_or_d_ts;
|
||||
if (!options.allowNonTsExtensions && !ts.forEach(ts.supportedExtensions, function (extension) { return ts.fileExtensionIs(host.getCanonicalFileName(fileName), extension); })) {
|
||||
diagnostic = ts.Diagnostics.File_0_has_unsupported_extension_The_only_supported_extensions_are_1;
|
||||
diagnosticArgument = [fileName, "'" + ts.supportedExtensions.join("', '") + "'"];
|
||||
}
|
||||
else if (!findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd)) {
|
||||
diagnostic = ts.Diagnostics.File_0_not_found;
|
||||
diagnosticArgument = [fileName];
|
||||
}
|
||||
else if (refFile && host.getCanonicalFileName(fileName) === host.getCanonicalFileName(refFile.fileName)) {
|
||||
diagnostic = ts.Diagnostics.A_file_cannot_have_a_reference_to_itself;
|
||||
diagnosticArgument = [fileName];
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (options.allowNonTsExtensions && !findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd)) {
|
||||
diagnostic = ts.Diagnostics.File_0_not_found;
|
||||
diagnosticArgument = [fileName];
|
||||
}
|
||||
else if (!findSourceFile(fileName + ".ts", isDefaultLib, refFile, refPos, refEnd) && !findSourceFile(fileName + ".d.ts", isDefaultLib, refFile, refPos, refEnd)) {
|
||||
else if (!ts.forEach(ts.supportedExtensions, function (extension) { return findSourceFile(fileName + extension, isDefaultLib, refFile, refPos, refEnd); })) {
|
||||
diagnostic = ts.Diagnostics.File_0_not_found;
|
||||
fileName += ".ts";
|
||||
diagnosticArgument = [fileName];
|
||||
}
|
||||
}
|
||||
if (diagnostic) {
|
||||
if (refFile) {
|
||||
diagnostics.add(ts.createFileDiagnostic(refFile, start, length, diagnostic, fileName));
|
||||
diagnostics.add(ts.createFileDiagnostic.apply(void 0, [refFile, start, length, diagnostic].concat(diagnosticArgument)));
|
||||
}
|
||||
else {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(diagnostic, fileName));
|
||||
diagnostics.add(ts.createCompilerDiagnostic.apply(void 0, [diagnostic].concat(diagnosticArgument)));
|
||||
}
|
||||
}
|
||||
}
|
||||
function findSourceFile(fileName, isDefaultLib, refFile, refStart, refLength) {
|
||||
var canonicalName = host.getCanonicalFileName(fileName);
|
||||
var canonicalName = host.getCanonicalFileName(ts.normalizeSlashes(fileName));
|
||||
if (ts.hasProperty(filesByName, canonicalName)) {
|
||||
return getSourceFileFromCache(fileName, canonicalName, false);
|
||||
}
|
||||
@@ -25326,9 +25389,10 @@ var ts;
|
||||
var moduleNameText = moduleNameExpr.text;
|
||||
if (moduleNameText) {
|
||||
var searchPath = basePath;
|
||||
var searchName;
|
||||
while (true) {
|
||||
var searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleNameText));
|
||||
if (findModuleSourceFile(searchName + ".ts", moduleNameExpr) || findModuleSourceFile(searchName + ".d.ts", moduleNameExpr)) {
|
||||
searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleNameText));
|
||||
if (ts.forEach(ts.supportedExtensions, function (extension) { return findModuleSourceFile(searchName + extension, moduleNameExpr); })) {
|
||||
break;
|
||||
}
|
||||
var parentPath = ts.getDirectoryPath(searchPath);
|
||||
@@ -25348,10 +25412,7 @@ var ts;
|
||||
var moduleName = nameLiteral.text;
|
||||
if (moduleName) {
|
||||
var searchName = ts.normalizePath(ts.combinePaths(basePath, moduleName));
|
||||
var tsFile = findModuleSourceFile(searchName + ".ts", nameLiteral);
|
||||
if (!tsFile) {
|
||||
findModuleSourceFile(searchName + ".d.ts", nameLiteral);
|
||||
}
|
||||
ts.forEach(ts.supportedExtensions, function (extension) { return findModuleSourceFile(searchName + extension, nameLiteral); });
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -25441,10 +25502,10 @@ var ts;
|
||||
}
|
||||
if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) {
|
||||
if (options.mapRoot) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option));
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option));
|
||||
}
|
||||
if (options.sourceRoot) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option));
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -25582,7 +25643,7 @@ var ts;
|
||||
{
|
||||
name: "noEmitOnError",
|
||||
type: "boolean",
|
||||
description: ts.Diagnostics.Do_not_emit_outputs_if_any_type_checking_errors_were_reported
|
||||
description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported
|
||||
},
|
||||
{
|
||||
name: "noImplicitAny",
|
||||
|
||||
+220
-138
@@ -431,9 +431,13 @@ var ts;
|
||||
return 3;
|
||||
return 2;
|
||||
}
|
||||
if (path.lastIndexOf("file:///", 0) === 0) {
|
||||
return "file:///".length;
|
||||
}
|
||||
var idx = path.indexOf('://');
|
||||
if (idx !== -1)
|
||||
return idx + 3;
|
||||
if (idx !== -1) {
|
||||
return idx + "://".length;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
ts.getRootLength = getRootLength;
|
||||
@@ -584,10 +588,11 @@ var ts;
|
||||
return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension;
|
||||
}
|
||||
ts.fileExtensionIs = fileExtensionIs;
|
||||
var supportedExtensions = [".d.ts", ".ts", ".js"];
|
||||
ts.supportedExtensions = [".ts", ".d.ts"];
|
||||
var extensionsToRemove = [".d.ts", ".ts", ".js"];
|
||||
function removeFileExtension(path) {
|
||||
for (var _i = 0; _i < supportedExtensions.length; _i++) {
|
||||
var ext = supportedExtensions[_i];
|
||||
for (var _i = 0; _i < extensionsToRemove.length; _i++) {
|
||||
var ext = extensionsToRemove[_i];
|
||||
if (fileExtensionIs(path, ext)) {
|
||||
return path.substr(0, path.length - ext.length);
|
||||
}
|
||||
@@ -1358,8 +1363,8 @@ var ts;
|
||||
Unknown_compiler_option_0: { code: 5023, category: ts.DiagnosticCategory.Error, key: "Unknown compiler option '{0}'." },
|
||||
Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: ts.DiagnosticCategory.Error, key: "Compiler option '{0}' requires a value of type {1}." },
|
||||
Could_not_write_file_0_Colon_1: { code: 5033, category: ts.DiagnosticCategory.Error, key: "Could not write file '{0}': {1}" },
|
||||
Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5038, category: ts.DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option." },
|
||||
Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5039, category: ts.DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option." },
|
||||
Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5038, category: ts.DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified without specifying 'sourceMap' option." },
|
||||
Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5039, category: ts.DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option." },
|
||||
Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: ts.DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." },
|
||||
Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: ts.DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'declaration'." },
|
||||
Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: ts.DiagnosticCategory.Error, key: "Option 'project' cannot be mixed with source files on a command line." },
|
||||
@@ -1379,7 +1384,7 @@ var ts;
|
||||
Watch_input_files: { code: 6005, category: ts.DiagnosticCategory.Message, key: "Watch input files." },
|
||||
Redirect_output_structure_to_the_directory: { code: 6006, category: ts.DiagnosticCategory.Message, key: "Redirect output structure to the directory." },
|
||||
Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: ts.DiagnosticCategory.Message, key: "Do not erase const enum declarations in generated code." },
|
||||
Do_not_emit_outputs_if_any_type_checking_errors_were_reported: { code: 6008, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs if any type checking errors were reported." },
|
||||
Do_not_emit_outputs_if_any_errors_were_reported: { code: 6008, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs if any errors were reported." },
|
||||
Do_not_emit_comments_to_output: { code: 6009, category: ts.DiagnosticCategory.Message, key: "Do not emit comments to output." },
|
||||
Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs." },
|
||||
Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" },
|
||||
@@ -1412,7 +1417,7 @@ var ts;
|
||||
Corrupted_locale_file_0: { code: 6051, category: ts.DiagnosticCategory.Error, key: "Corrupted locale file {0}." },
|
||||
Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: ts.DiagnosticCategory.Message, key: "Raise error on expressions and declarations with an implied 'any' type." },
|
||||
File_0_not_found: { code: 6053, category: ts.DiagnosticCategory.Error, key: "File '{0}' not found." },
|
||||
File_0_must_have_extension_ts_or_d_ts: { code: 6054, category: ts.DiagnosticCategory.Error, key: "File '{0}' must have extension '.ts' or '.d.ts'." },
|
||||
File_0_has_unsupported_extension_The_only_supported_extensions_are_1: { code: 6054, category: ts.DiagnosticCategory.Error, key: "File '{0}' has unsupported extension. The only supported extensions are {1}." },
|
||||
Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: ts.DiagnosticCategory.Message, key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." },
|
||||
Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: ts.DiagnosticCategory.Message, key: "Do not emit declarations for code that has an '@internal' annotation." },
|
||||
Preserve_new_lines_when_emitting_code: { code: 6057, category: ts.DiagnosticCategory.Message, key: "Preserve new-lines when emitting code." },
|
||||
@@ -2796,7 +2801,7 @@ var ts;
|
||||
{
|
||||
name: "noEmitOnError",
|
||||
type: "boolean",
|
||||
description: ts.Diagnostics.Do_not_emit_outputs_if_any_type_checking_errors_were_reported
|
||||
description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported
|
||||
},
|
||||
{
|
||||
name: "noImplicitAny",
|
||||
@@ -3463,9 +3468,6 @@ var ts;
|
||||
case 141:
|
||||
case 143:
|
||||
case 144:
|
||||
case 163:
|
||||
case 164:
|
||||
case 201:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -4047,6 +4049,18 @@ var ts;
|
||||
return false;
|
||||
}
|
||||
ts.isModifier = isModifier;
|
||||
function isParameterDeclaration(node) {
|
||||
var root = getRootDeclaration(node);
|
||||
return root.kind === 130;
|
||||
}
|
||||
ts.isParameterDeclaration = isParameterDeclaration;
|
||||
function getRootDeclaration(node) {
|
||||
while (node.kind === 153) {
|
||||
node = node.parent.parent;
|
||||
}
|
||||
return node;
|
||||
}
|
||||
ts.getRootDeclaration = getRootDeclaration;
|
||||
function nodeStartsNewLexicalEnvironment(n) {
|
||||
return isFunctionLike(n) || n.kind === 206 || n.kind === 228;
|
||||
}
|
||||
@@ -5369,13 +5383,6 @@ var ts;
|
||||
return token === t && tryParse(nextTokenCanFollowModifier);
|
||||
}
|
||||
function nextTokenCanFollowModifier() {
|
||||
nextToken();
|
||||
return canFollowModifier();
|
||||
}
|
||||
function parseAnyContextualModifier() {
|
||||
return ts.isModifier(token) && tryParse(nextTokenCanFollowContextualModifier);
|
||||
}
|
||||
function nextTokenCanFollowContextualModifier() {
|
||||
if (token === 70) {
|
||||
return nextToken() === 77;
|
||||
}
|
||||
@@ -5392,6 +5399,9 @@ var ts;
|
||||
nextToken();
|
||||
return canFollowModifier();
|
||||
}
|
||||
function parseAnyContextualModifier() {
|
||||
return ts.isModifier(token) && tryParse(nextTokenCanFollowModifier);
|
||||
}
|
||||
function canFollowModifier() {
|
||||
return token === 18
|
||||
|| token === 14
|
||||
@@ -8737,6 +8747,9 @@ var ts;
|
||||
else if (ts.isBlockOrCatchScoped(node)) {
|
||||
bindBlockScopedVariableDeclaration(node);
|
||||
}
|
||||
else if (ts.isParameterDeclaration(node)) {
|
||||
bindDeclaration(node, 1, 107455, false);
|
||||
}
|
||||
else {
|
||||
bindDeclaration(node, 1, 107454, false);
|
||||
}
|
||||
@@ -9593,10 +9606,11 @@ var ts;
|
||||
return symbol;
|
||||
}
|
||||
}
|
||||
var fileName;
|
||||
var sourceFile;
|
||||
while (true) {
|
||||
var fileName = ts.normalizePath(ts.combinePaths(searchPath, moduleName));
|
||||
sourceFile = host.getSourceFile(fileName + ".ts") || host.getSourceFile(fileName + ".d.ts");
|
||||
fileName = ts.normalizePath(ts.combinePaths(searchPath, moduleName));
|
||||
sourceFile = ts.forEach(ts.supportedExtensions, function (extension) { return host.getSourceFile(fileName + extension); });
|
||||
if (sourceFile || isRelative) {
|
||||
break;
|
||||
}
|
||||
@@ -10541,14 +10555,8 @@ var ts;
|
||||
resolutionTargets.pop();
|
||||
return resolutionResults.pop();
|
||||
}
|
||||
function getRootDeclaration(node) {
|
||||
while (node.kind === 153) {
|
||||
node = node.parent.parent;
|
||||
}
|
||||
return node;
|
||||
}
|
||||
function getDeclarationContainer(node) {
|
||||
node = getRootDeclaration(node);
|
||||
node = ts.getRootDeclaration(node);
|
||||
return node.kind === 199 ? node.parent.parent.parent : node.parent;
|
||||
}
|
||||
function getTypeOfPrototypeProperty(prototype) {
|
||||
@@ -10698,7 +10706,7 @@ var ts;
|
||||
}
|
||||
type = declaration.dotDotDotToken ? anyArrayType : anyType;
|
||||
if (reportErrors && compilerOptions.noImplicitAny) {
|
||||
var root = getRootDeclaration(declaration);
|
||||
var root = ts.getRootDeclaration(declaration);
|
||||
if (!isPrivateWithinAmbient(root) && !(root.kind === 130 && isPrivateWithinAmbient(root.parent))) {
|
||||
reportImplicitAnyError(declaration, type);
|
||||
}
|
||||
@@ -10811,7 +10819,10 @@ var ts;
|
||||
function getTypeOfAlias(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
if (!links.type) {
|
||||
links.type = getTypeOfSymbol(resolveAlias(symbol));
|
||||
var targetSymbol = resolveAlias(symbol);
|
||||
links.type = targetSymbol.flags & 107455
|
||||
? getTypeOfSymbol(targetSymbol)
|
||||
: unknownType;
|
||||
}
|
||||
return links.type;
|
||||
}
|
||||
@@ -11825,7 +11836,13 @@ var ts;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
var removeSubtypesStack = [];
|
||||
function removeSubtypes(types) {
|
||||
var typeListId = getTypeListId(types);
|
||||
if (removeSubtypesStack.lastIndexOf(typeListId) >= 0) {
|
||||
return;
|
||||
}
|
||||
removeSubtypesStack.push(typeListId);
|
||||
var i = types.length;
|
||||
while (i > 0) {
|
||||
i--;
|
||||
@@ -11833,6 +11850,7 @@ var ts;
|
||||
types.splice(i, 1);
|
||||
}
|
||||
}
|
||||
removeSubtypesStack.pop();
|
||||
}
|
||||
function containsAnyType(types) {
|
||||
for (var _i = 0; _i < types.length; _i++) {
|
||||
@@ -13388,31 +13406,33 @@ var ts;
|
||||
if (!isTypeSubtypeOf(rightType, globalFunctionType)) {
|
||||
return type;
|
||||
}
|
||||
var targetType;
|
||||
var prototypeProperty = getPropertyOfType(rightType, "prototype");
|
||||
if (prototypeProperty) {
|
||||
var targetType = getTypeOfSymbol(prototypeProperty);
|
||||
if (targetType !== anyType) {
|
||||
if (isTypeSubtypeOf(targetType, type)) {
|
||||
return targetType;
|
||||
}
|
||||
if (type.flags & 16384) {
|
||||
return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); }));
|
||||
}
|
||||
var prototypePropertyType = getTypeOfSymbol(prototypeProperty);
|
||||
if (prototypePropertyType !== anyType) {
|
||||
targetType = prototypePropertyType;
|
||||
}
|
||||
}
|
||||
var constructSignatures;
|
||||
if (rightType.flags & 2048) {
|
||||
constructSignatures = resolveDeclaredMembers(rightType).declaredConstructSignatures;
|
||||
if (!targetType) {
|
||||
var constructSignatures;
|
||||
if (rightType.flags & 2048) {
|
||||
constructSignatures = resolveDeclaredMembers(rightType).declaredConstructSignatures;
|
||||
}
|
||||
else if (rightType.flags & 32768) {
|
||||
constructSignatures = getSignaturesOfType(rightType, 1);
|
||||
}
|
||||
if (constructSignatures && constructSignatures.length) {
|
||||
targetType = getUnionType(ts.map(constructSignatures, function (signature) { return getReturnTypeOfSignature(getErasedSignature(signature)); }));
|
||||
}
|
||||
}
|
||||
else if (rightType.flags & 32768) {
|
||||
constructSignatures = getSignaturesOfType(rightType, 1);
|
||||
}
|
||||
if (constructSignatures && constructSignatures.length !== 0) {
|
||||
var instanceType = getUnionType(ts.map(constructSignatures, function (signature) { return getReturnTypeOfSignature(getErasedSignature(signature)); }));
|
||||
if (targetType) {
|
||||
if (isTypeSubtypeOf(targetType, type)) {
|
||||
return targetType;
|
||||
}
|
||||
if (type.flags & 16384) {
|
||||
return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, instanceType); }));
|
||||
return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); }));
|
||||
}
|
||||
return instanceType;
|
||||
}
|
||||
return type;
|
||||
}
|
||||
@@ -16051,7 +16071,7 @@ var ts;
|
||||
if (ts.isInAmbientContext(node)) {
|
||||
return false;
|
||||
}
|
||||
var root = getRootDeclaration(node);
|
||||
var root = ts.getRootDeclaration(node);
|
||||
if (root.kind === 130 && ts.nodeIsMissing(root.parent.body)) {
|
||||
return false;
|
||||
}
|
||||
@@ -16112,7 +16132,7 @@ var ts;
|
||||
// - ScriptBody : StatementList
|
||||
// It is a Syntax Error if any element of the LexicallyDeclaredNames of StatementList
|
||||
// also occurs in the VarDeclaredNames of StatementList.
|
||||
if ((ts.getCombinedNodeFlags(node) & 12288) !== 0 || isParameterDeclaration(node)) {
|
||||
if ((ts.getCombinedNodeFlags(node) & 12288) !== 0 || ts.isParameterDeclaration(node)) {
|
||||
return;
|
||||
}
|
||||
if (node.kind === 199 && !node.initializer) {
|
||||
@@ -16142,14 +16162,8 @@ var ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
function isParameterDeclaration(node) {
|
||||
while (node.kind === 153) {
|
||||
node = node.parent.parent;
|
||||
}
|
||||
return node.kind === 130;
|
||||
}
|
||||
function checkParameterInitializer(node) {
|
||||
if (getRootDeclaration(node).kind !== 130) {
|
||||
if (ts.getRootDeclaration(node).kind !== 130) {
|
||||
return;
|
||||
}
|
||||
var func = ts.getContainingFunction(node);
|
||||
@@ -16188,7 +16202,7 @@ var ts;
|
||||
if (ts.isBindingPattern(node.name)) {
|
||||
ts.forEach(node.name.elements, checkSourceElement);
|
||||
}
|
||||
if (node.initializer && getRootDeclaration(node).kind === 130 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) {
|
||||
if (node.initializer && ts.getRootDeclaration(node).kind === 130 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) {
|
||||
error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation);
|
||||
return;
|
||||
}
|
||||
@@ -21643,7 +21657,7 @@ var ts;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function emitListWithSpread(elements, multiLine, trailingComma) {
|
||||
function emitListWithSpread(elements, alwaysCopy, multiLine, trailingComma) {
|
||||
var pos = 0;
|
||||
var group = 0;
|
||||
var length = elements.length;
|
||||
@@ -21659,6 +21673,9 @@ var ts;
|
||||
e = e.expression;
|
||||
emitParenthesizedIf(e, group === 0 && needsParenthesisForPropertyAccessOrInvocation(e));
|
||||
pos++;
|
||||
if (pos === length && group === 0 && alwaysCopy && e.kind !== 154) {
|
||||
write(".slice()");
|
||||
}
|
||||
}
|
||||
else {
|
||||
var i = pos;
|
||||
@@ -21696,7 +21713,7 @@ var ts;
|
||||
write("]");
|
||||
}
|
||||
else {
|
||||
emitListWithSpread(elements, (node.flags & 512) !== 0, elements.hasTrailingComma);
|
||||
emitListWithSpread(elements, true, (node.flags & 512) !== 0, elements.hasTrailingComma);
|
||||
}
|
||||
}
|
||||
function emitObjectLiteralBody(node, numElements) {
|
||||
@@ -22022,7 +22039,7 @@ var ts;
|
||||
write("void 0");
|
||||
}
|
||||
write(", ");
|
||||
emitListWithSpread(node.arguments, false, false);
|
||||
emitListWithSpread(node.arguments, false, false, false);
|
||||
write(")");
|
||||
}
|
||||
function emitCallExpression(node) {
|
||||
@@ -22650,7 +22667,7 @@ var ts;
|
||||
if (node.flags & 1) {
|
||||
writeLine();
|
||||
emitStart(node);
|
||||
if (compilerOptions.module === 4) {
|
||||
if (compilerOptions.module === 4 && node.parent === currentSourceFile) {
|
||||
write(exportFunctionForFile + "(\"");
|
||||
if (node.flags & 256) {
|
||||
write("default");
|
||||
@@ -22988,12 +23005,14 @@ var ts;
|
||||
node.parent.kind === 228;
|
||||
}
|
||||
function emitVariableStatement(node) {
|
||||
var startIsEmitted = true;
|
||||
if (!(node.flags & 1)) {
|
||||
startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList);
|
||||
var startIsEmitted = false;
|
||||
if (node.flags & 1) {
|
||||
if (isES6ExportedDeclaration(node)) {
|
||||
write("export ");
|
||||
startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList);
|
||||
}
|
||||
}
|
||||
else if (isES6ExportedDeclaration(node)) {
|
||||
write("export ");
|
||||
else {
|
||||
startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList);
|
||||
}
|
||||
if (startIsEmitted) {
|
||||
@@ -24012,15 +24031,17 @@ var ts;
|
||||
if (!shouldEmitEnumDeclaration(node)) {
|
||||
return;
|
||||
}
|
||||
if (!(node.flags & 1) || isES6ExportedDeclaration(node)) {
|
||||
emitStart(node);
|
||||
if (isES6ExportedDeclaration(node)) {
|
||||
write("export ");
|
||||
if (!shouldHoistDeclarationInSystemJsModule(node)) {
|
||||
if (!(node.flags & 1) || isES6ExportedDeclaration(node)) {
|
||||
emitStart(node);
|
||||
if (isES6ExportedDeclaration(node)) {
|
||||
write("export ");
|
||||
}
|
||||
write("var ");
|
||||
emit(node.name);
|
||||
emitEnd(node);
|
||||
write(";");
|
||||
}
|
||||
write("var ");
|
||||
emit(node.name);
|
||||
emitEnd(node);
|
||||
write(";");
|
||||
}
|
||||
writeLine();
|
||||
emitStart(node);
|
||||
@@ -24042,7 +24063,7 @@ var ts;
|
||||
emitModuleMemberName(node);
|
||||
write(" = {}));");
|
||||
emitEnd(node);
|
||||
if (!isES6ExportedDeclaration(node) && node.flags & 1) {
|
||||
if (!isES6ExportedDeclaration(node) && node.flags & 1 && !shouldHoistDeclarationInSystemJsModule(node)) {
|
||||
writeLine();
|
||||
emitStart(node);
|
||||
write("var ");
|
||||
@@ -24053,6 +24074,14 @@ var ts;
|
||||
write(";");
|
||||
}
|
||||
if (languageVersion < 2 && node.parent === currentSourceFile) {
|
||||
if (compilerOptions.module === 4 && (node.flags & 1)) {
|
||||
writeLine();
|
||||
write(exportFunctionForFile + "(\"");
|
||||
emitDeclarationName(node);
|
||||
write("\", ");
|
||||
emitDeclarationName(node);
|
||||
write(")");
|
||||
}
|
||||
emitExportMemberAssignments(node.name);
|
||||
}
|
||||
}
|
||||
@@ -24639,12 +24668,25 @@ var ts;
|
||||
if (hoistedVars) {
|
||||
writeLine();
|
||||
write("var ");
|
||||
var seen = {};
|
||||
for (var i = 0; i < hoistedVars.length; ++i) {
|
||||
var local = hoistedVars[i];
|
||||
var name_21 = local.kind === 65
|
||||
? local
|
||||
: local.name;
|
||||
if (name_21) {
|
||||
var text = ts.unescapeIdentifier(name_21.text);
|
||||
if (ts.hasProperty(seen, text)) {
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
seen[text] = text;
|
||||
}
|
||||
}
|
||||
if (i !== 0) {
|
||||
write(", ");
|
||||
}
|
||||
if (local.kind === 202 || local.kind === 206) {
|
||||
if (local.kind === 202 || local.kind === 206 || local.kind === 205) {
|
||||
emitDeclarationName(local);
|
||||
}
|
||||
else {
|
||||
@@ -24675,6 +24717,9 @@ var ts;
|
||||
}
|
||||
return exportedDeclarations;
|
||||
function visit(node) {
|
||||
if (node.flags & 2) {
|
||||
return;
|
||||
}
|
||||
if (node.kind === 201) {
|
||||
if (!hoistedFunctionDeclarations) {
|
||||
hoistedFunctionDeclarations = [];
|
||||
@@ -24689,24 +24734,35 @@ var ts;
|
||||
hoistedVars.push(node);
|
||||
return;
|
||||
}
|
||||
if (node.kind === 206 && shouldEmitModuleDeclaration(node)) {
|
||||
if (!hoistedVars) {
|
||||
hoistedVars = [];
|
||||
if (node.kind === 205) {
|
||||
if (shouldEmitEnumDeclaration(node)) {
|
||||
if (!hoistedVars) {
|
||||
hoistedVars = [];
|
||||
}
|
||||
hoistedVars.push(node);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (node.kind === 206) {
|
||||
if (shouldEmitModuleDeclaration(node)) {
|
||||
if (!hoistedVars) {
|
||||
hoistedVars = [];
|
||||
}
|
||||
hoistedVars.push(node);
|
||||
}
|
||||
hoistedVars.push(node);
|
||||
return;
|
||||
}
|
||||
if (node.kind === 199 || node.kind === 153) {
|
||||
if (shouldHoistVariable(node, false)) {
|
||||
var name_21 = node.name;
|
||||
if (name_21.kind === 65) {
|
||||
var name_22 = node.name;
|
||||
if (name_22.kind === 65) {
|
||||
if (!hoistedVars) {
|
||||
hoistedVars = [];
|
||||
}
|
||||
hoistedVars.push(name_21);
|
||||
hoistedVars.push(name_22);
|
||||
}
|
||||
else {
|
||||
ts.forEachChild(name_21, visit);
|
||||
ts.forEachChild(name_22, visit);
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -25376,7 +25432,7 @@ var ts;
|
||||
ts.emitTime = 0;
|
||||
ts.ioReadTime = 0;
|
||||
ts.ioWriteTime = 0;
|
||||
ts.version = "1.5.0";
|
||||
ts.version = "1.5.2";
|
||||
var carriageReturnLineFeed = "\r\n";
|
||||
var lineFeed = "\n";
|
||||
function findConfigFile(searchPath) {
|
||||
@@ -25552,14 +25608,14 @@ var ts;
|
||||
if (options.noEmitOnError && getPreEmitDiagnostics(this).length > 0) {
|
||||
return { diagnostics: [], sourceMaps: undefined, emitSkipped: true };
|
||||
}
|
||||
var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile);
|
||||
var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(options.out ? undefined : sourceFile);
|
||||
var start = new Date().getTime();
|
||||
var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile);
|
||||
ts.emitTime += new Date().getTime() - start;
|
||||
return emitResult;
|
||||
}
|
||||
function getSourceFile(fileName) {
|
||||
fileName = host.getCanonicalFileName(fileName);
|
||||
fileName = host.getCanonicalFileName(ts.normalizeSlashes(fileName));
|
||||
return ts.hasProperty(filesByName, fileName) ? filesByName[fileName] : undefined;
|
||||
}
|
||||
function getDiagnosticsHelper(sourceFile, getDiagnostics) {
|
||||
@@ -25615,42 +25671,49 @@ var ts;
|
||||
function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) {
|
||||
var start;
|
||||
var length;
|
||||
var extensions;
|
||||
var diagnosticArgument;
|
||||
if (refEnd !== undefined && refPos !== undefined) {
|
||||
start = refPos;
|
||||
length = refEnd - refPos;
|
||||
}
|
||||
var diagnostic;
|
||||
if (hasExtension(fileName)) {
|
||||
if (!options.allowNonTsExtensions && !ts.fileExtensionIs(host.getCanonicalFileName(fileName), ".ts")) {
|
||||
diagnostic = ts.Diagnostics.File_0_must_have_extension_ts_or_d_ts;
|
||||
if (!options.allowNonTsExtensions && !ts.forEach(ts.supportedExtensions, function (extension) { return ts.fileExtensionIs(host.getCanonicalFileName(fileName), extension); })) {
|
||||
diagnostic = ts.Diagnostics.File_0_has_unsupported_extension_The_only_supported_extensions_are_1;
|
||||
diagnosticArgument = [fileName, "'" + ts.supportedExtensions.join("', '") + "'"];
|
||||
}
|
||||
else if (!findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd)) {
|
||||
diagnostic = ts.Diagnostics.File_0_not_found;
|
||||
diagnosticArgument = [fileName];
|
||||
}
|
||||
else if (refFile && host.getCanonicalFileName(fileName) === host.getCanonicalFileName(refFile.fileName)) {
|
||||
diagnostic = ts.Diagnostics.A_file_cannot_have_a_reference_to_itself;
|
||||
diagnosticArgument = [fileName];
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (options.allowNonTsExtensions && !findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd)) {
|
||||
diagnostic = ts.Diagnostics.File_0_not_found;
|
||||
diagnosticArgument = [fileName];
|
||||
}
|
||||
else if (!findSourceFile(fileName + ".ts", isDefaultLib, refFile, refPos, refEnd) && !findSourceFile(fileName + ".d.ts", isDefaultLib, refFile, refPos, refEnd)) {
|
||||
else if (!ts.forEach(ts.supportedExtensions, function (extension) { return findSourceFile(fileName + extension, isDefaultLib, refFile, refPos, refEnd); })) {
|
||||
diagnostic = ts.Diagnostics.File_0_not_found;
|
||||
fileName += ".ts";
|
||||
diagnosticArgument = [fileName];
|
||||
}
|
||||
}
|
||||
if (diagnostic) {
|
||||
if (refFile) {
|
||||
diagnostics.add(ts.createFileDiagnostic(refFile, start, length, diagnostic, fileName));
|
||||
diagnostics.add(ts.createFileDiagnostic.apply(void 0, [refFile, start, length, diagnostic].concat(diagnosticArgument)));
|
||||
}
|
||||
else {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(diagnostic, fileName));
|
||||
diagnostics.add(ts.createCompilerDiagnostic.apply(void 0, [diagnostic].concat(diagnosticArgument)));
|
||||
}
|
||||
}
|
||||
}
|
||||
function findSourceFile(fileName, isDefaultLib, refFile, refStart, refLength) {
|
||||
var canonicalName = host.getCanonicalFileName(fileName);
|
||||
var canonicalName = host.getCanonicalFileName(ts.normalizeSlashes(fileName));
|
||||
if (ts.hasProperty(filesByName, canonicalName)) {
|
||||
return getSourceFileFromCache(fileName, canonicalName, false);
|
||||
}
|
||||
@@ -25710,9 +25773,10 @@ var ts;
|
||||
var moduleNameText = moduleNameExpr.text;
|
||||
if (moduleNameText) {
|
||||
var searchPath = basePath;
|
||||
var searchName;
|
||||
while (true) {
|
||||
var searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleNameText));
|
||||
if (findModuleSourceFile(searchName + ".ts", moduleNameExpr) || findModuleSourceFile(searchName + ".d.ts", moduleNameExpr)) {
|
||||
searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleNameText));
|
||||
if (ts.forEach(ts.supportedExtensions, function (extension) { return findModuleSourceFile(searchName + extension, moduleNameExpr); })) {
|
||||
break;
|
||||
}
|
||||
var parentPath = ts.getDirectoryPath(searchPath);
|
||||
@@ -25732,10 +25796,7 @@ var ts;
|
||||
var moduleName = nameLiteral.text;
|
||||
if (moduleName) {
|
||||
var searchName = ts.normalizePath(ts.combinePaths(basePath, moduleName));
|
||||
var tsFile = findModuleSourceFile(searchName + ".ts", nameLiteral);
|
||||
if (!tsFile) {
|
||||
findModuleSourceFile(searchName + ".d.ts", nameLiteral);
|
||||
}
|
||||
ts.forEach(ts.supportedExtensions, function (extension) { return findModuleSourceFile(searchName + extension, nameLiteral); });
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -25825,10 +25886,10 @@ var ts;
|
||||
}
|
||||
if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) {
|
||||
if (options.mapRoot) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option));
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option));
|
||||
}
|
||||
if (options.sourceRoot) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option));
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -26402,10 +26463,10 @@ var ts;
|
||||
ts.forEach(program.getSourceFiles(), function (sourceFile) {
|
||||
cancellationToken.throwIfCancellationRequested();
|
||||
var nameToDeclarations = sourceFile.getNamedDeclarations();
|
||||
for (var name_22 in nameToDeclarations) {
|
||||
var declarations = ts.getProperty(nameToDeclarations, name_22);
|
||||
for (var name_23 in nameToDeclarations) {
|
||||
var declarations = ts.getProperty(nameToDeclarations, name_23);
|
||||
if (declarations) {
|
||||
var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_22);
|
||||
var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_23);
|
||||
if (!matches) {
|
||||
continue;
|
||||
}
|
||||
@@ -26416,14 +26477,14 @@ var ts;
|
||||
if (!containers) {
|
||||
return undefined;
|
||||
}
|
||||
matches = patternMatcher.getMatches(containers, name_22);
|
||||
matches = patternMatcher.getMatches(containers, name_23);
|
||||
if (!matches) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
var fileName = sourceFile.fileName;
|
||||
var matchKind = bestMatchKind(matches);
|
||||
rawItems.push({ name: name_22, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration });
|
||||
rawItems.push({ name: name_23, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26753,9 +26814,9 @@ var ts;
|
||||
case 199:
|
||||
case 153:
|
||||
var variableDeclarationNode;
|
||||
var name_23;
|
||||
var name_24;
|
||||
if (node.kind === 153) {
|
||||
name_23 = node.name;
|
||||
name_24 = node.name;
|
||||
variableDeclarationNode = node;
|
||||
while (variableDeclarationNode && variableDeclarationNode.kind !== 199) {
|
||||
variableDeclarationNode = variableDeclarationNode.parent;
|
||||
@@ -26765,16 +26826,16 @@ var ts;
|
||||
else {
|
||||
ts.Debug.assert(!ts.isBindingPattern(node.name));
|
||||
variableDeclarationNode = node;
|
||||
name_23 = node.name;
|
||||
name_24 = node.name;
|
||||
}
|
||||
if (ts.isConst(variableDeclarationNode)) {
|
||||
return createItem(node, getTextOfNode(name_23), ts.ScriptElementKind.constElement);
|
||||
return createItem(node, getTextOfNode(name_24), ts.ScriptElementKind.constElement);
|
||||
}
|
||||
else if (ts.isLet(variableDeclarationNode)) {
|
||||
return createItem(node, getTextOfNode(name_23), ts.ScriptElementKind.letElement);
|
||||
return createItem(node, getTextOfNode(name_24), ts.ScriptElementKind.letElement);
|
||||
}
|
||||
else {
|
||||
return createItem(node, getTextOfNode(name_23), ts.ScriptElementKind.variableElement);
|
||||
return createItem(node, getTextOfNode(name_24), ts.ScriptElementKind.variableElement);
|
||||
}
|
||||
case 136:
|
||||
return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement);
|
||||
@@ -28766,9 +28827,9 @@ var ts;
|
||||
}
|
||||
Rules.prototype.getRuleName = function (rule) {
|
||||
var o = this;
|
||||
for (var name_24 in o) {
|
||||
if (o[name_24] === rule) {
|
||||
return name_24;
|
||||
for (var name_25 in o) {
|
||||
if (o[name_25] === rule) {
|
||||
return name_25;
|
||||
}
|
||||
}
|
||||
throw new Error("Unknown rule");
|
||||
@@ -31202,8 +31263,9 @@ var ts;
|
||||
})();
|
||||
ts.CancellationTokenObject = CancellationTokenObject;
|
||||
var HostCache = (function () {
|
||||
function HostCache(host) {
|
||||
function HostCache(host, getCanonicalFileName) {
|
||||
this.host = host;
|
||||
this.getCanonicalFileName = getCanonicalFileName;
|
||||
this.fileNameToEntry = {};
|
||||
var rootFileNames = host.getScriptFileNames();
|
||||
for (var _i = 0; _i < rootFileNames.length; _i++) {
|
||||
@@ -31215,6 +31277,9 @@ var ts;
|
||||
HostCache.prototype.compilationSettings = function () {
|
||||
return this._compilationSettings;
|
||||
};
|
||||
HostCache.prototype.normalizeFileName = function (fileName) {
|
||||
return this.getCanonicalFileName(ts.normalizeSlashes(fileName));
|
||||
};
|
||||
HostCache.prototype.createEntry = function (fileName) {
|
||||
var entry;
|
||||
var scriptSnapshot = this.host.getScriptSnapshot(fileName);
|
||||
@@ -31225,13 +31290,13 @@ var ts;
|
||||
scriptSnapshot: scriptSnapshot
|
||||
};
|
||||
}
|
||||
return this.fileNameToEntry[ts.normalizeSlashes(fileName)] = entry;
|
||||
return this.fileNameToEntry[this.normalizeFileName(fileName)] = entry;
|
||||
};
|
||||
HostCache.prototype.getEntry = function (fileName) {
|
||||
return ts.lookUp(this.fileNameToEntry, ts.normalizeSlashes(fileName));
|
||||
return ts.lookUp(this.fileNameToEntry, this.normalizeFileName(fileName));
|
||||
};
|
||||
HostCache.prototype.contains = function (fileName) {
|
||||
return ts.hasProperty(this.fileNameToEntry, ts.normalizeSlashes(fileName));
|
||||
return ts.hasProperty(this.fileNameToEntry, this.normalizeFileName(fileName));
|
||||
};
|
||||
HostCache.prototype.getOrCreateEntry = function (fileName) {
|
||||
if (this.contains(fileName)) {
|
||||
@@ -31243,8 +31308,10 @@ var ts;
|
||||
var _this = this;
|
||||
var fileNames = [];
|
||||
ts.forEachKey(this.fileNameToEntry, function (key) {
|
||||
if (ts.hasProperty(_this.fileNameToEntry, key) && _this.fileNameToEntry[key])
|
||||
fileNames.push(key);
|
||||
var entry = _this.getEntry(key);
|
||||
if (entry) {
|
||||
fileNames.push(entry.hostFileName);
|
||||
}
|
||||
});
|
||||
return fileNames;
|
||||
};
|
||||
@@ -31745,6 +31812,7 @@ var ts;
|
||||
var syntaxTreeCache = new SyntaxTreeCache(host);
|
||||
var ruleProvider;
|
||||
var program;
|
||||
var lastProjectVersion;
|
||||
var useCaseSensitivefileNames = false;
|
||||
var cancellationToken = new CancellationTokenObject(host.getCancellationToken && host.getCancellationToken());
|
||||
if (!ts.localizedDiagnosticMessages && host.getLocalizedDiagnosticMessages) {
|
||||
@@ -31774,7 +31842,16 @@ var ts;
|
||||
return ruleProvider;
|
||||
}
|
||||
function synchronizeHostData() {
|
||||
var hostCache = new HostCache(host);
|
||||
if (host.getProjectVersion) {
|
||||
var hostProjectVersion = host.getProjectVersion();
|
||||
if (hostProjectVersion) {
|
||||
if (lastProjectVersion === hostProjectVersion) {
|
||||
return;
|
||||
}
|
||||
lastProjectVersion = hostProjectVersion;
|
||||
}
|
||||
}
|
||||
var hostCache = new HostCache(host, getCanonicalFileName);
|
||||
if (programUpToDate()) {
|
||||
return;
|
||||
}
|
||||
@@ -31784,7 +31861,7 @@ var ts;
|
||||
var newProgram = ts.createProgram(hostCache.getRootFileNames(), newSettings, {
|
||||
getSourceFile: getOrCreateSourceFile,
|
||||
getCancellationToken: function () { return cancellationToken; },
|
||||
getCanonicalFileName: function (fileName) { return useCaseSensitivefileNames ? fileName : fileName.toLowerCase(); },
|
||||
getCanonicalFileName: getCanonicalFileName,
|
||||
useCaseSensitiveFileNames: function () { return useCaseSensitivefileNames; },
|
||||
getNewLine: function () { return host.getNewLine ? host.getNewLine() : "\r\n"; },
|
||||
getDefaultLibFileName: function (options) { return host.getDefaultLibFileName(options); },
|
||||
@@ -32211,12 +32288,14 @@ var ts;
|
||||
|| containingNodeKind === 136
|
||||
|| containingNodeKind === 159
|
||||
|| containingNodeKind === 154
|
||||
|| containingNodeKind === 170;
|
||||
|| containingNodeKind === 170
|
||||
|| containingNodeKind === 143;
|
||||
case 16:
|
||||
return containingNodeKind === 158
|
||||
|| containingNodeKind === 136
|
||||
|| containingNodeKind === 159
|
||||
|| containingNodeKind === 162;
|
||||
|| containingNodeKind === 162
|
||||
|| containingNodeKind === 150;
|
||||
case 18:
|
||||
return containingNodeKind === 154;
|
||||
case 117:
|
||||
@@ -32310,6 +32389,8 @@ var ts;
|
||||
containingNodeKind === 151;
|
||||
case 20:
|
||||
return containingNodeKind === 152;
|
||||
case 51:
|
||||
return containingNodeKind === 153;
|
||||
case 18:
|
||||
return containingNodeKind === 152;
|
||||
case 16:
|
||||
@@ -32352,6 +32433,7 @@ var ts;
|
||||
case 104:
|
||||
case 70:
|
||||
case 110:
|
||||
case 124:
|
||||
return true;
|
||||
}
|
||||
switch (previousToken.getText()) {
|
||||
@@ -32445,10 +32527,10 @@ var ts;
|
||||
for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) {
|
||||
var sourceFile = _a[_i];
|
||||
var nameTable = getNameTable(sourceFile);
|
||||
for (var name_25 in nameTable) {
|
||||
if (!allNames[name_25]) {
|
||||
allNames[name_25] = name_25;
|
||||
var displayName = getCompletionEntryDisplayName(name_25, target, true);
|
||||
for (var name_26 in nameTable) {
|
||||
if (!allNames[name_26]) {
|
||||
allNames[name_26] = name_26;
|
||||
var displayName = getCompletionEntryDisplayName(name_26, target, true);
|
||||
if (displayName) {
|
||||
var entry = {
|
||||
name: displayName,
|
||||
@@ -34127,17 +34209,17 @@ var ts;
|
||||
if (isNameOfPropertyAssignment(node)) {
|
||||
var objectLiteral = node.parent.parent;
|
||||
var contextualType = typeChecker.getContextualType(objectLiteral);
|
||||
var name_26 = node.text;
|
||||
var name_27 = node.text;
|
||||
if (contextualType) {
|
||||
if (contextualType.flags & 16384) {
|
||||
var unionProperty = contextualType.getProperty(name_26);
|
||||
var unionProperty = contextualType.getProperty(name_27);
|
||||
if (unionProperty) {
|
||||
return [unionProperty];
|
||||
}
|
||||
else {
|
||||
var result_4 = [];
|
||||
ts.forEach(contextualType.types, function (t) {
|
||||
var symbol = t.getProperty(name_26);
|
||||
var symbol = t.getProperty(name_27);
|
||||
if (symbol) {
|
||||
result_4.push(symbol);
|
||||
}
|
||||
@@ -34146,7 +34228,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var symbol_1 = contextualType.getProperty(name_26);
|
||||
var symbol_1 = contextualType.getProperty(name_27);
|
||||
if (symbol_1) {
|
||||
return [symbol_1];
|
||||
}
|
||||
@@ -34523,10 +34605,10 @@ var ts;
|
||||
var kind = triviaScanner.scan();
|
||||
var end = triviaScanner.getTextPos();
|
||||
var width = end - start;
|
||||
if (!ts.isTrivia(kind)) {
|
||||
return;
|
||||
}
|
||||
if (ts.textSpanIntersectsWith(span, start, width)) {
|
||||
if (!ts.isTrivia(kind)) {
|
||||
return;
|
||||
}
|
||||
if (ts.isComment(kind)) {
|
||||
pushClassification(start, width, 1);
|
||||
continue;
|
||||
|
||||
Vendored
+1
@@ -1379,6 +1379,7 @@ declare module "typescript" {
|
||||
interface LanguageServiceHost {
|
||||
getCompilationSettings(): CompilerOptions;
|
||||
getNewLine?(): string;
|
||||
getProjectVersion?(): string;
|
||||
getScriptFileNames(): string[];
|
||||
getScriptVersion(fileName: string): string;
|
||||
getScriptSnapshot(fileName: string): IScriptSnapshot;
|
||||
|
||||
+276
-150
@@ -1129,9 +1129,18 @@ var ts;
|
||||
return 3;
|
||||
return 2;
|
||||
}
|
||||
// Per RFC 1738 'file' URI schema has the shape file://<host>/<path>
|
||||
// if <host> is omitted then it is assumed that host value is 'localhost',
|
||||
// however slash after the omitted <host> is not removed.
|
||||
// file:///folder1/file1 - this is a correct URI
|
||||
// file://folder2/file2 - this is an incorrect URI
|
||||
if (path.lastIndexOf("file:///", 0) === 0) {
|
||||
return "file:///".length;
|
||||
}
|
||||
var idx = path.indexOf('://');
|
||||
if (idx !== -1)
|
||||
return idx + 3;
|
||||
if (idx !== -1) {
|
||||
return idx + "://".length;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
ts.getRootLength = getRootLength;
|
||||
@@ -1302,10 +1311,14 @@ var ts;
|
||||
return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension;
|
||||
}
|
||||
ts.fileExtensionIs = fileExtensionIs;
|
||||
var supportedExtensions = [".d.ts", ".ts", ".js"];
|
||||
/**
|
||||
* List of supported extensions in order of file resolution precedence.
|
||||
*/
|
||||
ts.supportedExtensions = [".ts", ".d.ts"];
|
||||
var extensionsToRemove = [".d.ts", ".ts", ".js"];
|
||||
function removeFileExtension(path) {
|
||||
for (var _i = 0; _i < supportedExtensions.length; _i++) {
|
||||
var ext = supportedExtensions[_i];
|
||||
for (var _i = 0; _i < extensionsToRemove.length; _i++) {
|
||||
var ext = extensionsToRemove[_i];
|
||||
if (fileExtensionIs(path, ext)) {
|
||||
return path.substr(0, path.length - ext.length);
|
||||
}
|
||||
@@ -2101,8 +2114,8 @@ var ts;
|
||||
Unknown_compiler_option_0: { code: 5023, category: ts.DiagnosticCategory.Error, key: "Unknown compiler option '{0}'." },
|
||||
Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: ts.DiagnosticCategory.Error, key: "Compiler option '{0}' requires a value of type {1}." },
|
||||
Could_not_write_file_0_Colon_1: { code: 5033, category: ts.DiagnosticCategory.Error, key: "Could not write file '{0}': {1}" },
|
||||
Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5038, category: ts.DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option." },
|
||||
Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5039, category: ts.DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option." },
|
||||
Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5038, category: ts.DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified without specifying 'sourceMap' option." },
|
||||
Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5039, category: ts.DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option." },
|
||||
Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: ts.DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." },
|
||||
Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: ts.DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'declaration'." },
|
||||
Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: ts.DiagnosticCategory.Error, key: "Option 'project' cannot be mixed with source files on a command line." },
|
||||
@@ -2122,7 +2135,7 @@ var ts;
|
||||
Watch_input_files: { code: 6005, category: ts.DiagnosticCategory.Message, key: "Watch input files." },
|
||||
Redirect_output_structure_to_the_directory: { code: 6006, category: ts.DiagnosticCategory.Message, key: "Redirect output structure to the directory." },
|
||||
Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: ts.DiagnosticCategory.Message, key: "Do not erase const enum declarations in generated code." },
|
||||
Do_not_emit_outputs_if_any_type_checking_errors_were_reported: { code: 6008, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs if any type checking errors were reported." },
|
||||
Do_not_emit_outputs_if_any_errors_were_reported: { code: 6008, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs if any errors were reported." },
|
||||
Do_not_emit_comments_to_output: { code: 6009, category: ts.DiagnosticCategory.Message, key: "Do not emit comments to output." },
|
||||
Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs." },
|
||||
Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" },
|
||||
@@ -2155,7 +2168,7 @@ var ts;
|
||||
Corrupted_locale_file_0: { code: 6051, category: ts.DiagnosticCategory.Error, key: "Corrupted locale file {0}." },
|
||||
Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: ts.DiagnosticCategory.Message, key: "Raise error on expressions and declarations with an implied 'any' type." },
|
||||
File_0_not_found: { code: 6053, category: ts.DiagnosticCategory.Error, key: "File '{0}' not found." },
|
||||
File_0_must_have_extension_ts_or_d_ts: { code: 6054, category: ts.DiagnosticCategory.Error, key: "File '{0}' must have extension '.ts' or '.d.ts'." },
|
||||
File_0_has_unsupported_extension_The_only_supported_extensions_are_1: { code: 6054, category: ts.DiagnosticCategory.Error, key: "File '{0}' has unsupported extension. The only supported extensions are {1}." },
|
||||
Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: ts.DiagnosticCategory.Message, key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." },
|
||||
Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: ts.DiagnosticCategory.Message, key: "Do not emit declarations for code that has an '@internal' annotation." },
|
||||
Preserve_new_lines_when_emitting_code: { code: 6057, category: ts.DiagnosticCategory.Message, key: "Preserve new-lines when emitting code." },
|
||||
@@ -3978,6 +3991,18 @@ var ts;
|
||||
else if (ts.isBlockOrCatchScoped(node)) {
|
||||
bindBlockScopedVariableDeclaration(node);
|
||||
}
|
||||
else if (ts.isParameterDeclaration(node)) {
|
||||
// It is safe to walk up parent chain to find whether the node is a destructing parameter declaration
|
||||
// because its parent chain has already been set up, since parents are set before descending into children.
|
||||
//
|
||||
// If node is a binding element in parameter declaration, we need to use ParameterExcludes.
|
||||
// Using ParameterExcludes flag allows the compiler to report an error on duplicate identifiers in Parameter Declaration
|
||||
// For example:
|
||||
// function foo([a,a]) {} // Duplicate Identifier error
|
||||
// function bar(a,a) {} // Duplicate Identifier error, parameter declaration in this case is handled in bindParameter
|
||||
// // which correctly set excluded symbols
|
||||
bindDeclaration(node, 1 /* FunctionScopedVariable */, 107455 /* ParameterExcludes */, false);
|
||||
}
|
||||
else {
|
||||
bindDeclaration(node, 1 /* FunctionScopedVariable */, 107454 /* FunctionScopedVariableExcludes */, false);
|
||||
}
|
||||
@@ -4577,9 +4602,6 @@ var ts;
|
||||
case 141 /* IndexSignature */:
|
||||
case 143 /* FunctionType */:
|
||||
case 144 /* ConstructorType */:
|
||||
case 163 /* FunctionExpression */:
|
||||
case 164 /* ArrowFunction */:
|
||||
case 201 /* FunctionDeclaration */:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -5220,6 +5242,18 @@ var ts;
|
||||
return false;
|
||||
}
|
||||
ts.isModifier = isModifier;
|
||||
function isParameterDeclaration(node) {
|
||||
var root = getRootDeclaration(node);
|
||||
return root.kind === 130 /* Parameter */;
|
||||
}
|
||||
ts.isParameterDeclaration = isParameterDeclaration;
|
||||
function getRootDeclaration(node) {
|
||||
while (node.kind === 153 /* BindingElement */) {
|
||||
node = node.parent.parent;
|
||||
}
|
||||
return node;
|
||||
}
|
||||
ts.getRootDeclaration = getRootDeclaration;
|
||||
function nodeStartsNewLexicalEnvironment(n) {
|
||||
return isFunctionLike(n) || n.kind === 206 /* ModuleDeclaration */ || n.kind === 228 /* SourceFile */;
|
||||
}
|
||||
@@ -6840,13 +6874,6 @@ var ts;
|
||||
return token === t && tryParse(nextTokenCanFollowModifier);
|
||||
}
|
||||
function nextTokenCanFollowModifier() {
|
||||
nextToken();
|
||||
return canFollowModifier();
|
||||
}
|
||||
function parseAnyContextualModifier() {
|
||||
return ts.isModifier(token) && tryParse(nextTokenCanFollowContextualModifier);
|
||||
}
|
||||
function nextTokenCanFollowContextualModifier() {
|
||||
if (token === 70 /* ConstKeyword */) {
|
||||
// 'const' is only a modifier if followed by 'enum'.
|
||||
return nextToken() === 77 /* EnumKeyword */;
|
||||
@@ -6864,6 +6891,9 @@ var ts;
|
||||
nextToken();
|
||||
return canFollowModifier();
|
||||
}
|
||||
function parseAnyContextualModifier() {
|
||||
return ts.isModifier(token) && tryParse(nextTokenCanFollowModifier);
|
||||
}
|
||||
function canFollowModifier() {
|
||||
return token === 18 /* OpenBracketToken */
|
||||
|| token === 14 /* OpenBraceToken */
|
||||
@@ -11531,10 +11561,11 @@ var ts;
|
||||
return symbol;
|
||||
}
|
||||
}
|
||||
var fileName;
|
||||
var sourceFile;
|
||||
while (true) {
|
||||
var fileName = ts.normalizePath(ts.combinePaths(searchPath, moduleName));
|
||||
sourceFile = host.getSourceFile(fileName + ".ts") || host.getSourceFile(fileName + ".d.ts");
|
||||
fileName = ts.normalizePath(ts.combinePaths(searchPath, moduleName));
|
||||
sourceFile = ts.forEach(ts.supportedExtensions, function (extension) { return host.getSourceFile(fileName + extension); });
|
||||
if (sourceFile || isRelative) {
|
||||
break;
|
||||
}
|
||||
@@ -12605,14 +12636,8 @@ var ts;
|
||||
resolutionTargets.pop();
|
||||
return resolutionResults.pop();
|
||||
}
|
||||
function getRootDeclaration(node) {
|
||||
while (node.kind === 153 /* BindingElement */) {
|
||||
node = node.parent.parent;
|
||||
}
|
||||
return node;
|
||||
}
|
||||
function getDeclarationContainer(node) {
|
||||
node = getRootDeclaration(node);
|
||||
node = ts.getRootDeclaration(node);
|
||||
// Parent chain:
|
||||
// VaribleDeclaration -> VariableDeclarationList -> VariableStatement -> 'Declaration Container'
|
||||
return node.kind === 199 /* VariableDeclaration */ ? node.parent.parent.parent : node.parent;
|
||||
@@ -12823,7 +12848,7 @@ var ts;
|
||||
type = declaration.dotDotDotToken ? anyArrayType : anyType;
|
||||
// Report implicit any errors unless this is a private property within an ambient declaration
|
||||
if (reportErrors && compilerOptions.noImplicitAny) {
|
||||
var root = getRootDeclaration(declaration);
|
||||
var root = ts.getRootDeclaration(declaration);
|
||||
if (!isPrivateWithinAmbient(root) && !(root.kind === 130 /* Parameter */ && isPrivateWithinAmbient(root.parent))) {
|
||||
reportImplicitAnyError(declaration, type);
|
||||
}
|
||||
@@ -12945,7 +12970,15 @@ var ts;
|
||||
function getTypeOfAlias(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
if (!links.type) {
|
||||
links.type = getTypeOfSymbol(resolveAlias(symbol));
|
||||
var targetSymbol = resolveAlias(symbol);
|
||||
// It only makes sense to get the type of a value symbol. If the result of resolving
|
||||
// the alias is not a value, then it has no type. To get the type associated with a
|
||||
// type symbol, call getDeclaredTypeOfSymbol.
|
||||
// This check is important because without it, a call to getTypeOfSymbol could end
|
||||
// up recursively calling getTypeOfAlias, causing a stack overflow.
|
||||
links.type = targetSymbol.flags & 107455 /* Value */
|
||||
? getTypeOfSymbol(targetSymbol)
|
||||
: unknownType;
|
||||
}
|
||||
return links.type;
|
||||
}
|
||||
@@ -14021,7 +14054,17 @@ var ts;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// Since removeSubtypes checks the subtype relation, and the subtype relation on a union
|
||||
// may attempt to reduce a union, it is possible that removeSubtypes could be called
|
||||
// recursively on the same set of types. The removeSubtypesStack is used to track which
|
||||
// sets of types are currently undergoing subtype reduction.
|
||||
var removeSubtypesStack = [];
|
||||
function removeSubtypes(types) {
|
||||
var typeListId = getTypeListId(types);
|
||||
if (removeSubtypesStack.lastIndexOf(typeListId) >= 0) {
|
||||
return;
|
||||
}
|
||||
removeSubtypesStack.push(typeListId);
|
||||
var i = types.length;
|
||||
while (i > 0) {
|
||||
i--;
|
||||
@@ -14029,6 +14072,7 @@ var ts;
|
||||
types.splice(i, 1);
|
||||
}
|
||||
}
|
||||
removeSubtypesStack.pop();
|
||||
}
|
||||
function containsAnyType(types) {
|
||||
for (var _i = 0; _i < types.length; _i++) {
|
||||
@@ -15730,36 +15774,37 @@ var ts;
|
||||
if (!isTypeSubtypeOf(rightType, globalFunctionType)) {
|
||||
return type;
|
||||
}
|
||||
// Target type is type of prototype property
|
||||
var targetType;
|
||||
var prototypeProperty = getPropertyOfType(rightType, "prototype");
|
||||
if (prototypeProperty) {
|
||||
var targetType = getTypeOfSymbol(prototypeProperty);
|
||||
if (targetType !== anyType) {
|
||||
// Narrow to the target type if it's a subtype of the current type
|
||||
if (isTypeSubtypeOf(targetType, type)) {
|
||||
return targetType;
|
||||
}
|
||||
// If the current type is a union type, remove all constituents that aren't subtypes of the target.
|
||||
if (type.flags & 16384 /* Union */) {
|
||||
return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); }));
|
||||
}
|
||||
// Target type is type of the protoype property
|
||||
var prototypePropertyType = getTypeOfSymbol(prototypeProperty);
|
||||
if (prototypePropertyType !== anyType) {
|
||||
targetType = prototypePropertyType;
|
||||
}
|
||||
}
|
||||
// Target type is type of construct signature
|
||||
var constructSignatures;
|
||||
if (rightType.flags & 2048 /* Interface */) {
|
||||
constructSignatures = resolveDeclaredMembers(rightType).declaredConstructSignatures;
|
||||
if (!targetType) {
|
||||
// Target type is type of construct signature
|
||||
var constructSignatures;
|
||||
if (rightType.flags & 2048 /* Interface */) {
|
||||
constructSignatures = resolveDeclaredMembers(rightType).declaredConstructSignatures;
|
||||
}
|
||||
else if (rightType.flags & 32768 /* Anonymous */) {
|
||||
constructSignatures = getSignaturesOfType(rightType, 1 /* Construct */);
|
||||
}
|
||||
if (constructSignatures && constructSignatures.length) {
|
||||
targetType = getUnionType(ts.map(constructSignatures, function (signature) { return getReturnTypeOfSignature(getErasedSignature(signature)); }));
|
||||
}
|
||||
}
|
||||
else if (rightType.flags & 32768 /* Anonymous */) {
|
||||
constructSignatures = getSignaturesOfType(rightType, 1 /* Construct */);
|
||||
}
|
||||
if (constructSignatures && constructSignatures.length !== 0) {
|
||||
var instanceType = getUnionType(ts.map(constructSignatures, function (signature) { return getReturnTypeOfSignature(getErasedSignature(signature)); }));
|
||||
// Pickup type from union types
|
||||
if (targetType) {
|
||||
// Narrow to the target type if it's a subtype of the current type
|
||||
if (isTypeSubtypeOf(targetType, type)) {
|
||||
return targetType;
|
||||
}
|
||||
// If the current type is a union type, remove all constituents that aren't subtypes of the target.
|
||||
if (type.flags & 16384 /* Union */) {
|
||||
return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, instanceType); }));
|
||||
return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); }));
|
||||
}
|
||||
return instanceType;
|
||||
}
|
||||
return type;
|
||||
}
|
||||
@@ -19019,7 +19064,7 @@ var ts;
|
||||
// ambient context - no codegen impact
|
||||
return false;
|
||||
}
|
||||
var root = getRootDeclaration(node);
|
||||
var root = ts.getRootDeclaration(node);
|
||||
if (root.kind === 130 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) {
|
||||
// just an overload - no codegen impact
|
||||
return false;
|
||||
@@ -19107,7 +19152,7 @@ var ts;
|
||||
// let x = 0; // symbol for this declaration will be 'symbol'
|
||||
// }
|
||||
// skip block-scoped variables and parameters
|
||||
if ((ts.getCombinedNodeFlags(node) & 12288 /* BlockScoped */) !== 0 || isParameterDeclaration(node)) {
|
||||
if ((ts.getCombinedNodeFlags(node) & 12288 /* BlockScoped */) !== 0 || ts.isParameterDeclaration(node)) {
|
||||
return;
|
||||
}
|
||||
// skip variable declarations that don't have initializers
|
||||
@@ -19146,15 +19191,9 @@ var ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
function isParameterDeclaration(node) {
|
||||
while (node.kind === 153 /* BindingElement */) {
|
||||
node = node.parent.parent;
|
||||
}
|
||||
return node.kind === 130 /* Parameter */;
|
||||
}
|
||||
// Check that a parameter initializer contains no references to parameters declared to the right of itself
|
||||
function checkParameterInitializer(node) {
|
||||
if (getRootDeclaration(node).kind !== 130 /* Parameter */) {
|
||||
if (ts.getRootDeclaration(node).kind !== 130 /* Parameter */) {
|
||||
return;
|
||||
}
|
||||
var func = ts.getContainingFunction(node);
|
||||
@@ -19203,7 +19242,7 @@ var ts;
|
||||
ts.forEach(node.name.elements, checkSourceElement);
|
||||
}
|
||||
// For a parameter declaration with an initializer, error and exit if the containing function doesn't have a body
|
||||
if (node.initializer && getRootDeclaration(node).kind === 130 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) {
|
||||
if (node.initializer && ts.getRootDeclaration(node).kind === 130 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) {
|
||||
error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation);
|
||||
return;
|
||||
}
|
||||
@@ -24263,7 +24302,7 @@ var ts;
|
||||
var exportSpecifiers;
|
||||
var exportEquals;
|
||||
var hasExportStars;
|
||||
/** write emitted output to disk*/
|
||||
/** Write emitted output to disk */
|
||||
var writeEmittedFiles = writeJavaScriptFile;
|
||||
var detachedCommentsInfo;
|
||||
var writeComment = ts.writeCommentRange;
|
||||
@@ -25321,7 +25360,7 @@ var ts;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function emitListWithSpread(elements, multiLine, trailingComma) {
|
||||
function emitListWithSpread(elements, alwaysCopy, multiLine, trailingComma) {
|
||||
var pos = 0;
|
||||
var group = 0;
|
||||
var length = elements.length;
|
||||
@@ -25338,6 +25377,9 @@ var ts;
|
||||
e = e.expression;
|
||||
emitParenthesizedIf(e, group === 0 && needsParenthesisForPropertyAccessOrInvocation(e));
|
||||
pos++;
|
||||
if (pos === length && group === 0 && alwaysCopy && e.kind !== 154 /* ArrayLiteralExpression */) {
|
||||
write(".slice()");
|
||||
}
|
||||
}
|
||||
else {
|
||||
var i = pos;
|
||||
@@ -25375,7 +25417,7 @@ var ts;
|
||||
write("]");
|
||||
}
|
||||
else {
|
||||
emitListWithSpread(elements, (node.flags & 512 /* MultiLine */) !== 0,
|
||||
emitListWithSpread(elements, true, (node.flags & 512 /* MultiLine */) !== 0,
|
||||
/*trailingComma*/ elements.hasTrailingComma);
|
||||
}
|
||||
}
|
||||
@@ -25747,7 +25789,7 @@ var ts;
|
||||
write("void 0");
|
||||
}
|
||||
write(", ");
|
||||
emitListWithSpread(node.arguments, false, false);
|
||||
emitListWithSpread(node.arguments, false, false, false);
|
||||
write(")");
|
||||
}
|
||||
function emitCallExpression(node) {
|
||||
@@ -26451,7 +26493,8 @@ var ts;
|
||||
if (node.flags & 1 /* Export */) {
|
||||
writeLine();
|
||||
emitStart(node);
|
||||
if (compilerOptions.module === 4 /* System */) {
|
||||
// emit call to exporter only for top level nodes
|
||||
if (compilerOptions.module === 4 /* System */ && node.parent === currentSourceFile) {
|
||||
// emit export default <smth> as
|
||||
// export("default", <smth>)
|
||||
write(exportFunctionForFile + "(\"");
|
||||
@@ -26824,13 +26867,15 @@ var ts;
|
||||
node.parent.kind === 228 /* SourceFile */;
|
||||
}
|
||||
function emitVariableStatement(node) {
|
||||
var startIsEmitted = true;
|
||||
if (!(node.flags & 1 /* Export */)) {
|
||||
startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList);
|
||||
var startIsEmitted = false;
|
||||
if (node.flags & 1 /* Export */) {
|
||||
if (isES6ExportedDeclaration(node)) {
|
||||
// Exported ES6 module member
|
||||
write("export ");
|
||||
startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList);
|
||||
}
|
||||
}
|
||||
else if (isES6ExportedDeclaration(node)) {
|
||||
// Exported ES6 module member
|
||||
write("export ");
|
||||
else {
|
||||
startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList);
|
||||
}
|
||||
if (startIsEmitted) {
|
||||
@@ -28028,15 +28073,18 @@ var ts;
|
||||
if (!shouldEmitEnumDeclaration(node)) {
|
||||
return;
|
||||
}
|
||||
if (!(node.flags & 1 /* Export */) || isES6ExportedDeclaration(node)) {
|
||||
emitStart(node);
|
||||
if (isES6ExportedDeclaration(node)) {
|
||||
write("export ");
|
||||
if (!shouldHoistDeclarationInSystemJsModule(node)) {
|
||||
// do not emit var if variable was already hoisted
|
||||
if (!(node.flags & 1 /* Export */) || isES6ExportedDeclaration(node)) {
|
||||
emitStart(node);
|
||||
if (isES6ExportedDeclaration(node)) {
|
||||
write("export ");
|
||||
}
|
||||
write("var ");
|
||||
emit(node.name);
|
||||
emitEnd(node);
|
||||
write(";");
|
||||
}
|
||||
write("var ");
|
||||
emit(node.name);
|
||||
emitEnd(node);
|
||||
write(";");
|
||||
}
|
||||
writeLine();
|
||||
emitStart(node);
|
||||
@@ -28058,7 +28106,8 @@ var ts;
|
||||
emitModuleMemberName(node);
|
||||
write(" = {}));");
|
||||
emitEnd(node);
|
||||
if (!isES6ExportedDeclaration(node) && node.flags & 1 /* Export */) {
|
||||
if (!isES6ExportedDeclaration(node) && node.flags & 1 /* Export */ && !shouldHoistDeclarationInSystemJsModule(node)) {
|
||||
// do not emit var if variable was already hoisted
|
||||
writeLine();
|
||||
emitStart(node);
|
||||
write("var ");
|
||||
@@ -28069,6 +28118,15 @@ var ts;
|
||||
write(";");
|
||||
}
|
||||
if (languageVersion < 2 /* ES6 */ && node.parent === currentSourceFile) {
|
||||
if (compilerOptions.module === 4 /* System */ && (node.flags & 1 /* Export */)) {
|
||||
// write the call to exporter for enum
|
||||
writeLine();
|
||||
write(exportFunctionForFile + "(\"");
|
||||
emitDeclarationName(node);
|
||||
write("\", ");
|
||||
emitDeclarationName(node);
|
||||
write(")");
|
||||
}
|
||||
emitExportMemberAssignments(node.name);
|
||||
}
|
||||
}
|
||||
@@ -28708,12 +28766,26 @@ var ts;
|
||||
if (hoistedVars) {
|
||||
writeLine();
|
||||
write("var ");
|
||||
var seen = {};
|
||||
for (var i = 0; i < hoistedVars.length; ++i) {
|
||||
var local = hoistedVars[i];
|
||||
var name_21 = local.kind === 65 /* Identifier */
|
||||
? local
|
||||
: local.name;
|
||||
if (name_21) {
|
||||
// do not emit duplicate entries (in case of declaration merging) in the list of hoisted variables
|
||||
var text = ts.unescapeIdentifier(name_21.text);
|
||||
if (ts.hasProperty(seen, text)) {
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
seen[text] = text;
|
||||
}
|
||||
}
|
||||
if (i !== 0) {
|
||||
write(", ");
|
||||
}
|
||||
if (local.kind === 202 /* ClassDeclaration */ || local.kind === 206 /* ModuleDeclaration */) {
|
||||
if (local.kind === 202 /* ClassDeclaration */ || local.kind === 206 /* ModuleDeclaration */ || local.kind === 205 /* EnumDeclaration */) {
|
||||
emitDeclarationName(local);
|
||||
}
|
||||
else {
|
||||
@@ -28744,6 +28816,9 @@ var ts;
|
||||
}
|
||||
return exportedDeclarations;
|
||||
function visit(node) {
|
||||
if (node.flags & 2 /* Ambient */) {
|
||||
return;
|
||||
}
|
||||
if (node.kind === 201 /* FunctionDeclaration */) {
|
||||
if (!hoistedFunctionDeclarations) {
|
||||
hoistedFunctionDeclarations = [];
|
||||
@@ -28752,31 +28827,41 @@ var ts;
|
||||
return;
|
||||
}
|
||||
if (node.kind === 202 /* ClassDeclaration */) {
|
||||
// TODO: rename block scoped classes
|
||||
if (!hoistedVars) {
|
||||
hoistedVars = [];
|
||||
}
|
||||
hoistedVars.push(node);
|
||||
return;
|
||||
}
|
||||
if (node.kind === 206 /* ModuleDeclaration */ && shouldEmitModuleDeclaration(node)) {
|
||||
if (!hoistedVars) {
|
||||
hoistedVars = [];
|
||||
if (node.kind === 205 /* EnumDeclaration */) {
|
||||
if (shouldEmitEnumDeclaration(node)) {
|
||||
if (!hoistedVars) {
|
||||
hoistedVars = [];
|
||||
}
|
||||
hoistedVars.push(node);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (node.kind === 206 /* ModuleDeclaration */) {
|
||||
if (shouldEmitModuleDeclaration(node)) {
|
||||
if (!hoistedVars) {
|
||||
hoistedVars = [];
|
||||
}
|
||||
hoistedVars.push(node);
|
||||
}
|
||||
hoistedVars.push(node);
|
||||
return;
|
||||
}
|
||||
if (node.kind === 199 /* VariableDeclaration */ || node.kind === 153 /* BindingElement */) {
|
||||
if (shouldHoistVariable(node, false)) {
|
||||
var name_21 = node.name;
|
||||
if (name_21.kind === 65 /* Identifier */) {
|
||||
var name_22 = node.name;
|
||||
if (name_22.kind === 65 /* Identifier */) {
|
||||
if (!hoistedVars) {
|
||||
hoistedVars = [];
|
||||
}
|
||||
hoistedVars.push(name_21);
|
||||
hoistedVars.push(name_22);
|
||||
}
|
||||
else {
|
||||
ts.forEachChild(name_21, visit);
|
||||
ts.forEachChild(name_22, visit);
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -29571,7 +29656,7 @@ var ts;
|
||||
/* @internal */ ts.ioReadTime = 0;
|
||||
/* @internal */ ts.ioWriteTime = 0;
|
||||
/** The version of the TypeScript compiler release */
|
||||
ts.version = "1.5.0";
|
||||
ts.version = "1.5.2";
|
||||
var carriageReturnLineFeed = "\r\n";
|
||||
var lineFeed = "\n";
|
||||
function findConfigFile(searchPath) {
|
||||
@@ -29755,14 +29840,19 @@ var ts;
|
||||
// Create the emit resolver outside of the "emitTime" tracking code below. That way
|
||||
// any cost associated with it (like type checking) are appropriate associated with
|
||||
// the type-checking counter.
|
||||
var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile);
|
||||
//
|
||||
// If the -out option is specified, we should not pass the source file to getEmitResolver.
|
||||
// This is because in the -out scenario all files need to be emitted, and therefore all
|
||||
// files need to be type checked. And the way to specify that all files need to be type
|
||||
// checked is to not pass the file to getEmitResolver.
|
||||
var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(options.out ? undefined : sourceFile);
|
||||
var start = new Date().getTime();
|
||||
var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile);
|
||||
ts.emitTime += new Date().getTime() - start;
|
||||
return emitResult;
|
||||
}
|
||||
function getSourceFile(fileName) {
|
||||
fileName = host.getCanonicalFileName(fileName);
|
||||
fileName = host.getCanonicalFileName(ts.normalizeSlashes(fileName));
|
||||
return ts.hasProperty(filesByName, fileName) ? filesByName[fileName] : undefined;
|
||||
}
|
||||
function getDiagnosticsHelper(sourceFile, getDiagnostics) {
|
||||
@@ -29819,43 +29909,50 @@ var ts;
|
||||
function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) {
|
||||
var start;
|
||||
var length;
|
||||
var extensions;
|
||||
var diagnosticArgument;
|
||||
if (refEnd !== undefined && refPos !== undefined) {
|
||||
start = refPos;
|
||||
length = refEnd - refPos;
|
||||
}
|
||||
var diagnostic;
|
||||
if (hasExtension(fileName)) {
|
||||
if (!options.allowNonTsExtensions && !ts.fileExtensionIs(host.getCanonicalFileName(fileName), ".ts")) {
|
||||
diagnostic = ts.Diagnostics.File_0_must_have_extension_ts_or_d_ts;
|
||||
if (!options.allowNonTsExtensions && !ts.forEach(ts.supportedExtensions, function (extension) { return ts.fileExtensionIs(host.getCanonicalFileName(fileName), extension); })) {
|
||||
diagnostic = ts.Diagnostics.File_0_has_unsupported_extension_The_only_supported_extensions_are_1;
|
||||
diagnosticArgument = [fileName, "'" + ts.supportedExtensions.join("', '") + "'"];
|
||||
}
|
||||
else if (!findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd)) {
|
||||
diagnostic = ts.Diagnostics.File_0_not_found;
|
||||
diagnosticArgument = [fileName];
|
||||
}
|
||||
else if (refFile && host.getCanonicalFileName(fileName) === host.getCanonicalFileName(refFile.fileName)) {
|
||||
diagnostic = ts.Diagnostics.A_file_cannot_have_a_reference_to_itself;
|
||||
diagnosticArgument = [fileName];
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (options.allowNonTsExtensions && !findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd)) {
|
||||
diagnostic = ts.Diagnostics.File_0_not_found;
|
||||
diagnosticArgument = [fileName];
|
||||
}
|
||||
else if (!findSourceFile(fileName + ".ts", isDefaultLib, refFile, refPos, refEnd) && !findSourceFile(fileName + ".d.ts", isDefaultLib, refFile, refPos, refEnd)) {
|
||||
else if (!ts.forEach(ts.supportedExtensions, function (extension) { return findSourceFile(fileName + extension, isDefaultLib, refFile, refPos, refEnd); })) {
|
||||
diagnostic = ts.Diagnostics.File_0_not_found;
|
||||
fileName += ".ts";
|
||||
diagnosticArgument = [fileName];
|
||||
}
|
||||
}
|
||||
if (diagnostic) {
|
||||
if (refFile) {
|
||||
diagnostics.add(ts.createFileDiagnostic(refFile, start, length, diagnostic, fileName));
|
||||
diagnostics.add(ts.createFileDiagnostic.apply(void 0, [refFile, start, length, diagnostic].concat(diagnosticArgument)));
|
||||
}
|
||||
else {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(diagnostic, fileName));
|
||||
diagnostics.add(ts.createCompilerDiagnostic.apply(void 0, [diagnostic].concat(diagnosticArgument)));
|
||||
}
|
||||
}
|
||||
}
|
||||
// Get source file from normalized fileName
|
||||
function findSourceFile(fileName, isDefaultLib, refFile, refStart, refLength) {
|
||||
var canonicalName = host.getCanonicalFileName(fileName);
|
||||
var canonicalName = host.getCanonicalFileName(ts.normalizeSlashes(fileName));
|
||||
if (ts.hasProperty(filesByName, canonicalName)) {
|
||||
// We've already looked for this file, use cached result
|
||||
return getSourceFileFromCache(fileName, canonicalName, false);
|
||||
@@ -29918,9 +30015,10 @@ var ts;
|
||||
var moduleNameText = moduleNameExpr.text;
|
||||
if (moduleNameText) {
|
||||
var searchPath = basePath;
|
||||
var searchName;
|
||||
while (true) {
|
||||
var searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleNameText));
|
||||
if (findModuleSourceFile(searchName + ".ts", moduleNameExpr) || findModuleSourceFile(searchName + ".d.ts", moduleNameExpr)) {
|
||||
searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleNameText));
|
||||
if (ts.forEach(ts.supportedExtensions, function (extension) { return findModuleSourceFile(searchName + extension, moduleNameExpr); })) {
|
||||
break;
|
||||
}
|
||||
var parentPath = ts.getDirectoryPath(searchPath);
|
||||
@@ -29948,10 +30046,7 @@ var ts;
|
||||
// An ExternalImportDeclaration in anAmbientExternalModuleDeclaration may reference other external modules
|
||||
// only through top - level external module names. Relative external module names are not permitted.
|
||||
var searchName = ts.normalizePath(ts.combinePaths(basePath, moduleName));
|
||||
var tsFile = findModuleSourceFile(searchName + ".ts", nameLiteral);
|
||||
if (!tsFile) {
|
||||
findModuleSourceFile(searchName + ".d.ts", nameLiteral);
|
||||
}
|
||||
ts.forEach(ts.supportedExtensions, function (extension) { return findModuleSourceFile(searchName + extension, nameLiteral); });
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -30046,10 +30141,10 @@ var ts;
|
||||
if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) {
|
||||
// Error to specify --mapRoot or --sourceRoot without mapSourceFiles
|
||||
if (options.mapRoot) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option));
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option));
|
||||
}
|
||||
if (options.sourceRoot) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option));
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -30197,7 +30292,7 @@ var ts;
|
||||
{
|
||||
name: "noEmitOnError",
|
||||
type: "boolean",
|
||||
description: ts.Diagnostics.Do_not_emit_outputs_if_any_type_checking_errors_were_reported
|
||||
description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported
|
||||
},
|
||||
{
|
||||
name: "noImplicitAny",
|
||||
@@ -30684,12 +30779,12 @@ var ts;
|
||||
ts.forEach(program.getSourceFiles(), function (sourceFile) {
|
||||
cancellationToken.throwIfCancellationRequested();
|
||||
var nameToDeclarations = sourceFile.getNamedDeclarations();
|
||||
for (var name_22 in nameToDeclarations) {
|
||||
var declarations = ts.getProperty(nameToDeclarations, name_22);
|
||||
for (var name_23 in nameToDeclarations) {
|
||||
var declarations = ts.getProperty(nameToDeclarations, name_23);
|
||||
if (declarations) {
|
||||
// First do a quick check to see if the name of the declaration matches the
|
||||
// last portion of the (possibly) dotted name they're searching for.
|
||||
var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_22);
|
||||
var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_23);
|
||||
if (!matches) {
|
||||
continue;
|
||||
}
|
||||
@@ -30702,14 +30797,14 @@ var ts;
|
||||
if (!containers) {
|
||||
return undefined;
|
||||
}
|
||||
matches = patternMatcher.getMatches(containers, name_22);
|
||||
matches = patternMatcher.getMatches(containers, name_23);
|
||||
if (!matches) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
var fileName = sourceFile.fileName;
|
||||
var matchKind = bestMatchKind(matches);
|
||||
rawItems.push({ name: name_22, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration });
|
||||
rawItems.push({ name: name_23, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31092,9 +31187,9 @@ var ts;
|
||||
case 199 /* VariableDeclaration */:
|
||||
case 153 /* BindingElement */:
|
||||
var variableDeclarationNode;
|
||||
var name_23;
|
||||
var name_24;
|
||||
if (node.kind === 153 /* BindingElement */) {
|
||||
name_23 = node.name;
|
||||
name_24 = node.name;
|
||||
variableDeclarationNode = node;
|
||||
// binding elements are added only for variable declarations
|
||||
// bubble up to the containing variable declaration
|
||||
@@ -31106,16 +31201,16 @@ var ts;
|
||||
else {
|
||||
ts.Debug.assert(!ts.isBindingPattern(node.name));
|
||||
variableDeclarationNode = node;
|
||||
name_23 = node.name;
|
||||
name_24 = node.name;
|
||||
}
|
||||
if (ts.isConst(variableDeclarationNode)) {
|
||||
return createItem(node, getTextOfNode(name_23), ts.ScriptElementKind.constElement);
|
||||
return createItem(node, getTextOfNode(name_24), ts.ScriptElementKind.constElement);
|
||||
}
|
||||
else if (ts.isLet(variableDeclarationNode)) {
|
||||
return createItem(node, getTextOfNode(name_23), ts.ScriptElementKind.letElement);
|
||||
return createItem(node, getTextOfNode(name_24), ts.ScriptElementKind.letElement);
|
||||
}
|
||||
else {
|
||||
return createItem(node, getTextOfNode(name_23), ts.ScriptElementKind.variableElement);
|
||||
return createItem(node, getTextOfNode(name_24), ts.ScriptElementKind.variableElement);
|
||||
}
|
||||
case 136 /* Constructor */:
|
||||
return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement);
|
||||
@@ -33702,9 +33797,9 @@ var ts;
|
||||
}
|
||||
Rules.prototype.getRuleName = function (rule) {
|
||||
var o = this;
|
||||
for (var name_24 in o) {
|
||||
if (o[name_24] === rule) {
|
||||
return name_24;
|
||||
for (var name_25 in o) {
|
||||
if (o[name_25] === rule) {
|
||||
return name_25;
|
||||
}
|
||||
}
|
||||
throw new Error("Unknown rule");
|
||||
@@ -36487,8 +36582,9 @@ var ts;
|
||||
// at each language service public entry point, since we don't know when
|
||||
// set of scripts handled by the host changes.
|
||||
var HostCache = (function () {
|
||||
function HostCache(host) {
|
||||
function HostCache(host, getCanonicalFileName) {
|
||||
this.host = host;
|
||||
this.getCanonicalFileName = getCanonicalFileName;
|
||||
// script id => script index
|
||||
this.fileNameToEntry = {};
|
||||
// Initialize the list with the root file names
|
||||
@@ -36503,6 +36599,9 @@ var ts;
|
||||
HostCache.prototype.compilationSettings = function () {
|
||||
return this._compilationSettings;
|
||||
};
|
||||
HostCache.prototype.normalizeFileName = function (fileName) {
|
||||
return this.getCanonicalFileName(ts.normalizeSlashes(fileName));
|
||||
};
|
||||
HostCache.prototype.createEntry = function (fileName) {
|
||||
var entry;
|
||||
var scriptSnapshot = this.host.getScriptSnapshot(fileName);
|
||||
@@ -36513,13 +36612,13 @@ var ts;
|
||||
scriptSnapshot: scriptSnapshot
|
||||
};
|
||||
}
|
||||
return this.fileNameToEntry[ts.normalizeSlashes(fileName)] = entry;
|
||||
return this.fileNameToEntry[this.normalizeFileName(fileName)] = entry;
|
||||
};
|
||||
HostCache.prototype.getEntry = function (fileName) {
|
||||
return ts.lookUp(this.fileNameToEntry, ts.normalizeSlashes(fileName));
|
||||
return ts.lookUp(this.fileNameToEntry, this.normalizeFileName(fileName));
|
||||
};
|
||||
HostCache.prototype.contains = function (fileName) {
|
||||
return ts.hasProperty(this.fileNameToEntry, ts.normalizeSlashes(fileName));
|
||||
return ts.hasProperty(this.fileNameToEntry, this.normalizeFileName(fileName));
|
||||
};
|
||||
HostCache.prototype.getOrCreateEntry = function (fileName) {
|
||||
if (this.contains(fileName)) {
|
||||
@@ -36531,8 +36630,10 @@ var ts;
|
||||
var _this = this;
|
||||
var fileNames = [];
|
||||
ts.forEachKey(this.fileNameToEntry, function (key) {
|
||||
if (ts.hasProperty(_this.fileNameToEntry, key) && _this.fileNameToEntry[key])
|
||||
fileNames.push(key);
|
||||
var entry = _this.getEntry(key);
|
||||
if (entry) {
|
||||
fileNames.push(entry.hostFileName);
|
||||
}
|
||||
});
|
||||
return fileNames;
|
||||
};
|
||||
@@ -37119,6 +37220,7 @@ var ts;
|
||||
var syntaxTreeCache = new SyntaxTreeCache(host);
|
||||
var ruleProvider;
|
||||
var program;
|
||||
var lastProjectVersion;
|
||||
var useCaseSensitivefileNames = false;
|
||||
var cancellationToken = new CancellationTokenObject(host.getCancellationToken && host.getCancellationToken());
|
||||
// Check if the localized messages json is set, otherwise query the host for it
|
||||
@@ -37150,8 +37252,18 @@ var ts;
|
||||
return ruleProvider;
|
||||
}
|
||||
function synchronizeHostData() {
|
||||
// perform fast check if host supports it
|
||||
if (host.getProjectVersion) {
|
||||
var hostProjectVersion = host.getProjectVersion();
|
||||
if (hostProjectVersion) {
|
||||
if (lastProjectVersion === hostProjectVersion) {
|
||||
return;
|
||||
}
|
||||
lastProjectVersion = hostProjectVersion;
|
||||
}
|
||||
}
|
||||
// Get a fresh cache of the host information
|
||||
var hostCache = new HostCache(host);
|
||||
var hostCache = new HostCache(host, getCanonicalFileName);
|
||||
// If the program is already up-to-date, we can reuse it
|
||||
if (programUpToDate()) {
|
||||
return;
|
||||
@@ -37168,7 +37280,7 @@ var ts;
|
||||
var newProgram = ts.createProgram(hostCache.getRootFileNames(), newSettings, {
|
||||
getSourceFile: getOrCreateSourceFile,
|
||||
getCancellationToken: function () { return cancellationToken; },
|
||||
getCanonicalFileName: function (fileName) { return useCaseSensitivefileNames ? fileName : fileName.toLowerCase(); },
|
||||
getCanonicalFileName: getCanonicalFileName,
|
||||
useCaseSensitiveFileNames: function () { return useCaseSensitivefileNames; },
|
||||
getNewLine: function () { return host.getNewLine ? host.getNewLine() : "\r\n"; },
|
||||
getDefaultLibFileName: function (options) { return host.getDefaultLibFileName(options); },
|
||||
@@ -37706,12 +37818,14 @@ var ts;
|
||||
|| containingNodeKind === 136 /* Constructor */ // constructor( a, | public, protected, private keywords are allowed here, so show completion
|
||||
|| containingNodeKind === 159 /* NewExpression */ // new C(a, |
|
||||
|| containingNodeKind === 154 /* ArrayLiteralExpression */ // [a, |
|
||||
|| containingNodeKind === 170 /* BinaryExpression */; // let x = (a, |
|
||||
|| containingNodeKind === 170 /* BinaryExpression */ // let x = (a, |
|
||||
|| containingNodeKind === 143 /* FunctionType */; // var x: (s: string, list|
|
||||
case 16 /* OpenParenToken */:
|
||||
return containingNodeKind === 158 /* CallExpression */ // func( |
|
||||
|| containingNodeKind === 136 /* Constructor */ // constructor( |
|
||||
|| containingNodeKind === 159 /* NewExpression */ // new C(a|
|
||||
|| containingNodeKind === 162 /* ParenthesizedExpression */; // let x = (a|
|
||||
|| containingNodeKind === 162 /* ParenthesizedExpression */ // let x = (a|
|
||||
|| containingNodeKind === 150 /* ParenthesizedType */; // function F(pred: (a| this can become an arrow function, where 'a' is the argument
|
||||
case 18 /* OpenBracketToken */:
|
||||
return containingNodeKind === 154 /* ArrayLiteralExpression */; // [ |
|
||||
case 117 /* ModuleKeyword */: // module |
|
||||
@@ -37808,8 +37922,10 @@ var ts;
|
||||
containingNodeKind === 151 /* ObjectBindingPattern */; // function func({ x, y|
|
||||
case 20 /* DotToken */:
|
||||
return containingNodeKind === 152 /* ArrayBindingPattern */; // var [.|
|
||||
case 51 /* ColonToken */:
|
||||
return containingNodeKind === 153 /* BindingElement */; // var {x :html|
|
||||
case 18 /* OpenBracketToken */:
|
||||
return containingNodeKind === 152 /* ArrayBindingPattern */; // var [x|
|
||||
return containingNodeKind === 152 /* ArrayBindingPattern */; // var [x|
|
||||
case 16 /* OpenParenToken */:
|
||||
return containingNodeKind === 224 /* CatchClause */ ||
|
||||
isFunction(containingNodeKind);
|
||||
@@ -37822,7 +37938,7 @@ var ts;
|
||||
return containingNodeKind === 132 /* PropertySignature */ &&
|
||||
previousToken.parent && previousToken.parent.parent &&
|
||||
(previousToken.parent.parent.kind === 203 /* InterfaceDeclaration */ ||
|
||||
previousToken.parent.parent.kind === 146 /* TypeLiteral */); // let x : { a; |
|
||||
previousToken.parent.parent.kind === 146 /* TypeLiteral */); // let x : { a; |
|
||||
case 24 /* LessThanToken */:
|
||||
return containingNodeKind === 202 /* ClassDeclaration */ ||
|
||||
containingNodeKind === 201 /* FunctionDeclaration */ ||
|
||||
@@ -37834,7 +37950,7 @@ var ts;
|
||||
return containingNodeKind === 130 /* Parameter */ ||
|
||||
containingNodeKind === 136 /* Constructor */ ||
|
||||
(previousToken.parent && previousToken.parent.parent &&
|
||||
previousToken.parent.parent.kind === 152 /* ArrayBindingPattern */); // var [ ...z|
|
||||
previousToken.parent.parent.kind === 152 /* ArrayBindingPattern */); // var [...z|
|
||||
case 108 /* PublicKeyword */:
|
||||
case 106 /* PrivateKeyword */:
|
||||
case 107 /* ProtectedKeyword */:
|
||||
@@ -37850,6 +37966,7 @@ var ts;
|
||||
case 104 /* LetKeyword */:
|
||||
case 70 /* ConstKeyword */:
|
||||
case 110 /* YieldKeyword */:
|
||||
case 124 /* TypeKeyword */:
|
||||
return true;
|
||||
}
|
||||
// Previous token may have been a keyword that was converted to an identifier.
|
||||
@@ -37948,10 +38065,10 @@ var ts;
|
||||
for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) {
|
||||
var sourceFile = _a[_i];
|
||||
var nameTable = getNameTable(sourceFile);
|
||||
for (var name_25 in nameTable) {
|
||||
if (!allNames[name_25]) {
|
||||
allNames[name_25] = name_25;
|
||||
var displayName = getCompletionEntryDisplayName(name_25, target, true);
|
||||
for (var name_26 in nameTable) {
|
||||
if (!allNames[name_26]) {
|
||||
allNames[name_26] = name_26;
|
||||
var displayName = getCompletionEntryDisplayName(name_26, target, true);
|
||||
if (displayName) {
|
||||
var entry = {
|
||||
name: displayName,
|
||||
@@ -39833,19 +39950,19 @@ var ts;
|
||||
if (isNameOfPropertyAssignment(node)) {
|
||||
var objectLiteral = node.parent.parent;
|
||||
var contextualType = typeChecker.getContextualType(objectLiteral);
|
||||
var name_26 = node.text;
|
||||
var name_27 = node.text;
|
||||
if (contextualType) {
|
||||
if (contextualType.flags & 16384 /* Union */) {
|
||||
// This is a union type, first see if the property we are looking for is a union property (i.e. exists in all types)
|
||||
// if not, search the constituent types for the property
|
||||
var unionProperty = contextualType.getProperty(name_26);
|
||||
var unionProperty = contextualType.getProperty(name_27);
|
||||
if (unionProperty) {
|
||||
return [unionProperty];
|
||||
}
|
||||
else {
|
||||
var result_4 = [];
|
||||
ts.forEach(contextualType.types, function (t) {
|
||||
var symbol = t.getProperty(name_26);
|
||||
var symbol = t.getProperty(name_27);
|
||||
if (symbol) {
|
||||
result_4.push(symbol);
|
||||
}
|
||||
@@ -39854,7 +39971,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var symbol_1 = contextualType.getProperty(name_26);
|
||||
var symbol_1 = contextualType.getProperty(name_27);
|
||||
if (symbol_1) {
|
||||
return [symbol_1];
|
||||
}
|
||||
@@ -40274,10 +40391,12 @@ var ts;
|
||||
var kind = triviaScanner.scan();
|
||||
var end = triviaScanner.getTextPos();
|
||||
var width = end - start;
|
||||
// The moment we get something that isn't trivia, then stop processing.
|
||||
if (!ts.isTrivia(kind)) {
|
||||
return;
|
||||
}
|
||||
// Only bother with the trivia if it at least intersects the span of interest.
|
||||
if (ts.textSpanIntersectsWith(span, start, width)) {
|
||||
if (!ts.isTrivia(kind)) {
|
||||
return;
|
||||
}
|
||||
if (ts.isComment(kind)) {
|
||||
// Simple comment. Just add as is.
|
||||
pushClassification(start, width, 1 /* comment */);
|
||||
@@ -41720,6 +41839,13 @@ var ts;
|
||||
LanguageServiceShimHostAdapter.prototype.error = function (s) {
|
||||
this.shimHost.error(s);
|
||||
};
|
||||
LanguageServiceShimHostAdapter.prototype.getProjectVersion = function () {
|
||||
if (!this.shimHost.getProjectVersion) {
|
||||
// shimmed host does not support getProjectVersion
|
||||
return undefined;
|
||||
}
|
||||
return this.shimHost.getProjectVersion();
|
||||
};
|
||||
LanguageServiceShimHostAdapter.prototype.getCompilationSettings = function () {
|
||||
var settingsJson = this.shimHost.getCompilationSettings();
|
||||
if (settingsJson == null || settingsJson == "") {
|
||||
@@ -42232,7 +42358,7 @@ var ts;
|
||||
return {
|
||||
options: configFile.options,
|
||||
files: configFile.fileNames,
|
||||
errors: [realizeDiagnostics(configFile.errors, '\r\n')]
|
||||
errors: realizeDiagnostics(configFile.errors, '\r\n')
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
Vendored
+1
@@ -1379,6 +1379,7 @@ declare module ts {
|
||||
interface LanguageServiceHost {
|
||||
getCompilationSettings(): CompilerOptions;
|
||||
getNewLine?(): string;
|
||||
getProjectVersion?(): string;
|
||||
getScriptFileNames(): string[];
|
||||
getScriptVersion(fileName: string): string;
|
||||
getScriptSnapshot(fileName: string): IScriptSnapshot;
|
||||
|
||||
+276
-150
@@ -1129,9 +1129,18 @@ var ts;
|
||||
return 3;
|
||||
return 2;
|
||||
}
|
||||
// Per RFC 1738 'file' URI schema has the shape file://<host>/<path>
|
||||
// if <host> is omitted then it is assumed that host value is 'localhost',
|
||||
// however slash after the omitted <host> is not removed.
|
||||
// file:///folder1/file1 - this is a correct URI
|
||||
// file://folder2/file2 - this is an incorrect URI
|
||||
if (path.lastIndexOf("file:///", 0) === 0) {
|
||||
return "file:///".length;
|
||||
}
|
||||
var idx = path.indexOf('://');
|
||||
if (idx !== -1)
|
||||
return idx + 3;
|
||||
if (idx !== -1) {
|
||||
return idx + "://".length;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
ts.getRootLength = getRootLength;
|
||||
@@ -1302,10 +1311,14 @@ var ts;
|
||||
return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension;
|
||||
}
|
||||
ts.fileExtensionIs = fileExtensionIs;
|
||||
var supportedExtensions = [".d.ts", ".ts", ".js"];
|
||||
/**
|
||||
* List of supported extensions in order of file resolution precedence.
|
||||
*/
|
||||
ts.supportedExtensions = [".ts", ".d.ts"];
|
||||
var extensionsToRemove = [".d.ts", ".ts", ".js"];
|
||||
function removeFileExtension(path) {
|
||||
for (var _i = 0; _i < supportedExtensions.length; _i++) {
|
||||
var ext = supportedExtensions[_i];
|
||||
for (var _i = 0; _i < extensionsToRemove.length; _i++) {
|
||||
var ext = extensionsToRemove[_i];
|
||||
if (fileExtensionIs(path, ext)) {
|
||||
return path.substr(0, path.length - ext.length);
|
||||
}
|
||||
@@ -2101,8 +2114,8 @@ var ts;
|
||||
Unknown_compiler_option_0: { code: 5023, category: ts.DiagnosticCategory.Error, key: "Unknown compiler option '{0}'." },
|
||||
Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: ts.DiagnosticCategory.Error, key: "Compiler option '{0}' requires a value of type {1}." },
|
||||
Could_not_write_file_0_Colon_1: { code: 5033, category: ts.DiagnosticCategory.Error, key: "Could not write file '{0}': {1}" },
|
||||
Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5038, category: ts.DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option." },
|
||||
Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5039, category: ts.DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option." },
|
||||
Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5038, category: ts.DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified without specifying 'sourceMap' option." },
|
||||
Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5039, category: ts.DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option." },
|
||||
Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: ts.DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." },
|
||||
Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: ts.DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'declaration'." },
|
||||
Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: ts.DiagnosticCategory.Error, key: "Option 'project' cannot be mixed with source files on a command line." },
|
||||
@@ -2122,7 +2135,7 @@ var ts;
|
||||
Watch_input_files: { code: 6005, category: ts.DiagnosticCategory.Message, key: "Watch input files." },
|
||||
Redirect_output_structure_to_the_directory: { code: 6006, category: ts.DiagnosticCategory.Message, key: "Redirect output structure to the directory." },
|
||||
Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: ts.DiagnosticCategory.Message, key: "Do not erase const enum declarations in generated code." },
|
||||
Do_not_emit_outputs_if_any_type_checking_errors_were_reported: { code: 6008, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs if any type checking errors were reported." },
|
||||
Do_not_emit_outputs_if_any_errors_were_reported: { code: 6008, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs if any errors were reported." },
|
||||
Do_not_emit_comments_to_output: { code: 6009, category: ts.DiagnosticCategory.Message, key: "Do not emit comments to output." },
|
||||
Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs." },
|
||||
Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" },
|
||||
@@ -2155,7 +2168,7 @@ var ts;
|
||||
Corrupted_locale_file_0: { code: 6051, category: ts.DiagnosticCategory.Error, key: "Corrupted locale file {0}." },
|
||||
Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: ts.DiagnosticCategory.Message, key: "Raise error on expressions and declarations with an implied 'any' type." },
|
||||
File_0_not_found: { code: 6053, category: ts.DiagnosticCategory.Error, key: "File '{0}' not found." },
|
||||
File_0_must_have_extension_ts_or_d_ts: { code: 6054, category: ts.DiagnosticCategory.Error, key: "File '{0}' must have extension '.ts' or '.d.ts'." },
|
||||
File_0_has_unsupported_extension_The_only_supported_extensions_are_1: { code: 6054, category: ts.DiagnosticCategory.Error, key: "File '{0}' has unsupported extension. The only supported extensions are {1}." },
|
||||
Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: ts.DiagnosticCategory.Message, key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." },
|
||||
Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: ts.DiagnosticCategory.Message, key: "Do not emit declarations for code that has an '@internal' annotation." },
|
||||
Preserve_new_lines_when_emitting_code: { code: 6057, category: ts.DiagnosticCategory.Message, key: "Preserve new-lines when emitting code." },
|
||||
@@ -3978,6 +3991,18 @@ var ts;
|
||||
else if (ts.isBlockOrCatchScoped(node)) {
|
||||
bindBlockScopedVariableDeclaration(node);
|
||||
}
|
||||
else if (ts.isParameterDeclaration(node)) {
|
||||
// It is safe to walk up parent chain to find whether the node is a destructing parameter declaration
|
||||
// because its parent chain has already been set up, since parents are set before descending into children.
|
||||
//
|
||||
// If node is a binding element in parameter declaration, we need to use ParameterExcludes.
|
||||
// Using ParameterExcludes flag allows the compiler to report an error on duplicate identifiers in Parameter Declaration
|
||||
// For example:
|
||||
// function foo([a,a]) {} // Duplicate Identifier error
|
||||
// function bar(a,a) {} // Duplicate Identifier error, parameter declaration in this case is handled in bindParameter
|
||||
// // which correctly set excluded symbols
|
||||
bindDeclaration(node, 1 /* FunctionScopedVariable */, 107455 /* ParameterExcludes */, false);
|
||||
}
|
||||
else {
|
||||
bindDeclaration(node, 1 /* FunctionScopedVariable */, 107454 /* FunctionScopedVariableExcludes */, false);
|
||||
}
|
||||
@@ -4577,9 +4602,6 @@ var ts;
|
||||
case 141 /* IndexSignature */:
|
||||
case 143 /* FunctionType */:
|
||||
case 144 /* ConstructorType */:
|
||||
case 163 /* FunctionExpression */:
|
||||
case 164 /* ArrowFunction */:
|
||||
case 201 /* FunctionDeclaration */:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -5220,6 +5242,18 @@ var ts;
|
||||
return false;
|
||||
}
|
||||
ts.isModifier = isModifier;
|
||||
function isParameterDeclaration(node) {
|
||||
var root = getRootDeclaration(node);
|
||||
return root.kind === 130 /* Parameter */;
|
||||
}
|
||||
ts.isParameterDeclaration = isParameterDeclaration;
|
||||
function getRootDeclaration(node) {
|
||||
while (node.kind === 153 /* BindingElement */) {
|
||||
node = node.parent.parent;
|
||||
}
|
||||
return node;
|
||||
}
|
||||
ts.getRootDeclaration = getRootDeclaration;
|
||||
function nodeStartsNewLexicalEnvironment(n) {
|
||||
return isFunctionLike(n) || n.kind === 206 /* ModuleDeclaration */ || n.kind === 228 /* SourceFile */;
|
||||
}
|
||||
@@ -6840,13 +6874,6 @@ var ts;
|
||||
return token === t && tryParse(nextTokenCanFollowModifier);
|
||||
}
|
||||
function nextTokenCanFollowModifier() {
|
||||
nextToken();
|
||||
return canFollowModifier();
|
||||
}
|
||||
function parseAnyContextualModifier() {
|
||||
return ts.isModifier(token) && tryParse(nextTokenCanFollowContextualModifier);
|
||||
}
|
||||
function nextTokenCanFollowContextualModifier() {
|
||||
if (token === 70 /* ConstKeyword */) {
|
||||
// 'const' is only a modifier if followed by 'enum'.
|
||||
return nextToken() === 77 /* EnumKeyword */;
|
||||
@@ -6864,6 +6891,9 @@ var ts;
|
||||
nextToken();
|
||||
return canFollowModifier();
|
||||
}
|
||||
function parseAnyContextualModifier() {
|
||||
return ts.isModifier(token) && tryParse(nextTokenCanFollowModifier);
|
||||
}
|
||||
function canFollowModifier() {
|
||||
return token === 18 /* OpenBracketToken */
|
||||
|| token === 14 /* OpenBraceToken */
|
||||
@@ -11531,10 +11561,11 @@ var ts;
|
||||
return symbol;
|
||||
}
|
||||
}
|
||||
var fileName;
|
||||
var sourceFile;
|
||||
while (true) {
|
||||
var fileName = ts.normalizePath(ts.combinePaths(searchPath, moduleName));
|
||||
sourceFile = host.getSourceFile(fileName + ".ts") || host.getSourceFile(fileName + ".d.ts");
|
||||
fileName = ts.normalizePath(ts.combinePaths(searchPath, moduleName));
|
||||
sourceFile = ts.forEach(ts.supportedExtensions, function (extension) { return host.getSourceFile(fileName + extension); });
|
||||
if (sourceFile || isRelative) {
|
||||
break;
|
||||
}
|
||||
@@ -12605,14 +12636,8 @@ var ts;
|
||||
resolutionTargets.pop();
|
||||
return resolutionResults.pop();
|
||||
}
|
||||
function getRootDeclaration(node) {
|
||||
while (node.kind === 153 /* BindingElement */) {
|
||||
node = node.parent.parent;
|
||||
}
|
||||
return node;
|
||||
}
|
||||
function getDeclarationContainer(node) {
|
||||
node = getRootDeclaration(node);
|
||||
node = ts.getRootDeclaration(node);
|
||||
// Parent chain:
|
||||
// VaribleDeclaration -> VariableDeclarationList -> VariableStatement -> 'Declaration Container'
|
||||
return node.kind === 199 /* VariableDeclaration */ ? node.parent.parent.parent : node.parent;
|
||||
@@ -12823,7 +12848,7 @@ var ts;
|
||||
type = declaration.dotDotDotToken ? anyArrayType : anyType;
|
||||
// Report implicit any errors unless this is a private property within an ambient declaration
|
||||
if (reportErrors && compilerOptions.noImplicitAny) {
|
||||
var root = getRootDeclaration(declaration);
|
||||
var root = ts.getRootDeclaration(declaration);
|
||||
if (!isPrivateWithinAmbient(root) && !(root.kind === 130 /* Parameter */ && isPrivateWithinAmbient(root.parent))) {
|
||||
reportImplicitAnyError(declaration, type);
|
||||
}
|
||||
@@ -12945,7 +12970,15 @@ var ts;
|
||||
function getTypeOfAlias(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
if (!links.type) {
|
||||
links.type = getTypeOfSymbol(resolveAlias(symbol));
|
||||
var targetSymbol = resolveAlias(symbol);
|
||||
// It only makes sense to get the type of a value symbol. If the result of resolving
|
||||
// the alias is not a value, then it has no type. To get the type associated with a
|
||||
// type symbol, call getDeclaredTypeOfSymbol.
|
||||
// This check is important because without it, a call to getTypeOfSymbol could end
|
||||
// up recursively calling getTypeOfAlias, causing a stack overflow.
|
||||
links.type = targetSymbol.flags & 107455 /* Value */
|
||||
? getTypeOfSymbol(targetSymbol)
|
||||
: unknownType;
|
||||
}
|
||||
return links.type;
|
||||
}
|
||||
@@ -14021,7 +14054,17 @@ var ts;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// Since removeSubtypes checks the subtype relation, and the subtype relation on a union
|
||||
// may attempt to reduce a union, it is possible that removeSubtypes could be called
|
||||
// recursively on the same set of types. The removeSubtypesStack is used to track which
|
||||
// sets of types are currently undergoing subtype reduction.
|
||||
var removeSubtypesStack = [];
|
||||
function removeSubtypes(types) {
|
||||
var typeListId = getTypeListId(types);
|
||||
if (removeSubtypesStack.lastIndexOf(typeListId) >= 0) {
|
||||
return;
|
||||
}
|
||||
removeSubtypesStack.push(typeListId);
|
||||
var i = types.length;
|
||||
while (i > 0) {
|
||||
i--;
|
||||
@@ -14029,6 +14072,7 @@ var ts;
|
||||
types.splice(i, 1);
|
||||
}
|
||||
}
|
||||
removeSubtypesStack.pop();
|
||||
}
|
||||
function containsAnyType(types) {
|
||||
for (var _i = 0; _i < types.length; _i++) {
|
||||
@@ -15730,36 +15774,37 @@ var ts;
|
||||
if (!isTypeSubtypeOf(rightType, globalFunctionType)) {
|
||||
return type;
|
||||
}
|
||||
// Target type is type of prototype property
|
||||
var targetType;
|
||||
var prototypeProperty = getPropertyOfType(rightType, "prototype");
|
||||
if (prototypeProperty) {
|
||||
var targetType = getTypeOfSymbol(prototypeProperty);
|
||||
if (targetType !== anyType) {
|
||||
// Narrow to the target type if it's a subtype of the current type
|
||||
if (isTypeSubtypeOf(targetType, type)) {
|
||||
return targetType;
|
||||
}
|
||||
// If the current type is a union type, remove all constituents that aren't subtypes of the target.
|
||||
if (type.flags & 16384 /* Union */) {
|
||||
return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); }));
|
||||
}
|
||||
// Target type is type of the protoype property
|
||||
var prototypePropertyType = getTypeOfSymbol(prototypeProperty);
|
||||
if (prototypePropertyType !== anyType) {
|
||||
targetType = prototypePropertyType;
|
||||
}
|
||||
}
|
||||
// Target type is type of construct signature
|
||||
var constructSignatures;
|
||||
if (rightType.flags & 2048 /* Interface */) {
|
||||
constructSignatures = resolveDeclaredMembers(rightType).declaredConstructSignatures;
|
||||
if (!targetType) {
|
||||
// Target type is type of construct signature
|
||||
var constructSignatures;
|
||||
if (rightType.flags & 2048 /* Interface */) {
|
||||
constructSignatures = resolveDeclaredMembers(rightType).declaredConstructSignatures;
|
||||
}
|
||||
else if (rightType.flags & 32768 /* Anonymous */) {
|
||||
constructSignatures = getSignaturesOfType(rightType, 1 /* Construct */);
|
||||
}
|
||||
if (constructSignatures && constructSignatures.length) {
|
||||
targetType = getUnionType(ts.map(constructSignatures, function (signature) { return getReturnTypeOfSignature(getErasedSignature(signature)); }));
|
||||
}
|
||||
}
|
||||
else if (rightType.flags & 32768 /* Anonymous */) {
|
||||
constructSignatures = getSignaturesOfType(rightType, 1 /* Construct */);
|
||||
}
|
||||
if (constructSignatures && constructSignatures.length !== 0) {
|
||||
var instanceType = getUnionType(ts.map(constructSignatures, function (signature) { return getReturnTypeOfSignature(getErasedSignature(signature)); }));
|
||||
// Pickup type from union types
|
||||
if (targetType) {
|
||||
// Narrow to the target type if it's a subtype of the current type
|
||||
if (isTypeSubtypeOf(targetType, type)) {
|
||||
return targetType;
|
||||
}
|
||||
// If the current type is a union type, remove all constituents that aren't subtypes of the target.
|
||||
if (type.flags & 16384 /* Union */) {
|
||||
return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, instanceType); }));
|
||||
return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); }));
|
||||
}
|
||||
return instanceType;
|
||||
}
|
||||
return type;
|
||||
}
|
||||
@@ -19019,7 +19064,7 @@ var ts;
|
||||
// ambient context - no codegen impact
|
||||
return false;
|
||||
}
|
||||
var root = getRootDeclaration(node);
|
||||
var root = ts.getRootDeclaration(node);
|
||||
if (root.kind === 130 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) {
|
||||
// just an overload - no codegen impact
|
||||
return false;
|
||||
@@ -19107,7 +19152,7 @@ var ts;
|
||||
// let x = 0; // symbol for this declaration will be 'symbol'
|
||||
// }
|
||||
// skip block-scoped variables and parameters
|
||||
if ((ts.getCombinedNodeFlags(node) & 12288 /* BlockScoped */) !== 0 || isParameterDeclaration(node)) {
|
||||
if ((ts.getCombinedNodeFlags(node) & 12288 /* BlockScoped */) !== 0 || ts.isParameterDeclaration(node)) {
|
||||
return;
|
||||
}
|
||||
// skip variable declarations that don't have initializers
|
||||
@@ -19146,15 +19191,9 @@ var ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
function isParameterDeclaration(node) {
|
||||
while (node.kind === 153 /* BindingElement */) {
|
||||
node = node.parent.parent;
|
||||
}
|
||||
return node.kind === 130 /* Parameter */;
|
||||
}
|
||||
// Check that a parameter initializer contains no references to parameters declared to the right of itself
|
||||
function checkParameterInitializer(node) {
|
||||
if (getRootDeclaration(node).kind !== 130 /* Parameter */) {
|
||||
if (ts.getRootDeclaration(node).kind !== 130 /* Parameter */) {
|
||||
return;
|
||||
}
|
||||
var func = ts.getContainingFunction(node);
|
||||
@@ -19203,7 +19242,7 @@ var ts;
|
||||
ts.forEach(node.name.elements, checkSourceElement);
|
||||
}
|
||||
// For a parameter declaration with an initializer, error and exit if the containing function doesn't have a body
|
||||
if (node.initializer && getRootDeclaration(node).kind === 130 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) {
|
||||
if (node.initializer && ts.getRootDeclaration(node).kind === 130 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) {
|
||||
error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation);
|
||||
return;
|
||||
}
|
||||
@@ -24263,7 +24302,7 @@ var ts;
|
||||
var exportSpecifiers;
|
||||
var exportEquals;
|
||||
var hasExportStars;
|
||||
/** write emitted output to disk*/
|
||||
/** Write emitted output to disk */
|
||||
var writeEmittedFiles = writeJavaScriptFile;
|
||||
var detachedCommentsInfo;
|
||||
var writeComment = ts.writeCommentRange;
|
||||
@@ -25321,7 +25360,7 @@ var ts;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function emitListWithSpread(elements, multiLine, trailingComma) {
|
||||
function emitListWithSpread(elements, alwaysCopy, multiLine, trailingComma) {
|
||||
var pos = 0;
|
||||
var group = 0;
|
||||
var length = elements.length;
|
||||
@@ -25338,6 +25377,9 @@ var ts;
|
||||
e = e.expression;
|
||||
emitParenthesizedIf(e, group === 0 && needsParenthesisForPropertyAccessOrInvocation(e));
|
||||
pos++;
|
||||
if (pos === length && group === 0 && alwaysCopy && e.kind !== 154 /* ArrayLiteralExpression */) {
|
||||
write(".slice()");
|
||||
}
|
||||
}
|
||||
else {
|
||||
var i = pos;
|
||||
@@ -25375,7 +25417,7 @@ var ts;
|
||||
write("]");
|
||||
}
|
||||
else {
|
||||
emitListWithSpread(elements, (node.flags & 512 /* MultiLine */) !== 0,
|
||||
emitListWithSpread(elements, true, (node.flags & 512 /* MultiLine */) !== 0,
|
||||
/*trailingComma*/ elements.hasTrailingComma);
|
||||
}
|
||||
}
|
||||
@@ -25747,7 +25789,7 @@ var ts;
|
||||
write("void 0");
|
||||
}
|
||||
write(", ");
|
||||
emitListWithSpread(node.arguments, false, false);
|
||||
emitListWithSpread(node.arguments, false, false, false);
|
||||
write(")");
|
||||
}
|
||||
function emitCallExpression(node) {
|
||||
@@ -26451,7 +26493,8 @@ var ts;
|
||||
if (node.flags & 1 /* Export */) {
|
||||
writeLine();
|
||||
emitStart(node);
|
||||
if (compilerOptions.module === 4 /* System */) {
|
||||
// emit call to exporter only for top level nodes
|
||||
if (compilerOptions.module === 4 /* System */ && node.parent === currentSourceFile) {
|
||||
// emit export default <smth> as
|
||||
// export("default", <smth>)
|
||||
write(exportFunctionForFile + "(\"");
|
||||
@@ -26824,13 +26867,15 @@ var ts;
|
||||
node.parent.kind === 228 /* SourceFile */;
|
||||
}
|
||||
function emitVariableStatement(node) {
|
||||
var startIsEmitted = true;
|
||||
if (!(node.flags & 1 /* Export */)) {
|
||||
startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList);
|
||||
var startIsEmitted = false;
|
||||
if (node.flags & 1 /* Export */) {
|
||||
if (isES6ExportedDeclaration(node)) {
|
||||
// Exported ES6 module member
|
||||
write("export ");
|
||||
startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList);
|
||||
}
|
||||
}
|
||||
else if (isES6ExportedDeclaration(node)) {
|
||||
// Exported ES6 module member
|
||||
write("export ");
|
||||
else {
|
||||
startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList);
|
||||
}
|
||||
if (startIsEmitted) {
|
||||
@@ -28028,15 +28073,18 @@ var ts;
|
||||
if (!shouldEmitEnumDeclaration(node)) {
|
||||
return;
|
||||
}
|
||||
if (!(node.flags & 1 /* Export */) || isES6ExportedDeclaration(node)) {
|
||||
emitStart(node);
|
||||
if (isES6ExportedDeclaration(node)) {
|
||||
write("export ");
|
||||
if (!shouldHoistDeclarationInSystemJsModule(node)) {
|
||||
// do not emit var if variable was already hoisted
|
||||
if (!(node.flags & 1 /* Export */) || isES6ExportedDeclaration(node)) {
|
||||
emitStart(node);
|
||||
if (isES6ExportedDeclaration(node)) {
|
||||
write("export ");
|
||||
}
|
||||
write("var ");
|
||||
emit(node.name);
|
||||
emitEnd(node);
|
||||
write(";");
|
||||
}
|
||||
write("var ");
|
||||
emit(node.name);
|
||||
emitEnd(node);
|
||||
write(";");
|
||||
}
|
||||
writeLine();
|
||||
emitStart(node);
|
||||
@@ -28058,7 +28106,8 @@ var ts;
|
||||
emitModuleMemberName(node);
|
||||
write(" = {}));");
|
||||
emitEnd(node);
|
||||
if (!isES6ExportedDeclaration(node) && node.flags & 1 /* Export */) {
|
||||
if (!isES6ExportedDeclaration(node) && node.flags & 1 /* Export */ && !shouldHoistDeclarationInSystemJsModule(node)) {
|
||||
// do not emit var if variable was already hoisted
|
||||
writeLine();
|
||||
emitStart(node);
|
||||
write("var ");
|
||||
@@ -28069,6 +28118,15 @@ var ts;
|
||||
write(";");
|
||||
}
|
||||
if (languageVersion < 2 /* ES6 */ && node.parent === currentSourceFile) {
|
||||
if (compilerOptions.module === 4 /* System */ && (node.flags & 1 /* Export */)) {
|
||||
// write the call to exporter for enum
|
||||
writeLine();
|
||||
write(exportFunctionForFile + "(\"");
|
||||
emitDeclarationName(node);
|
||||
write("\", ");
|
||||
emitDeclarationName(node);
|
||||
write(")");
|
||||
}
|
||||
emitExportMemberAssignments(node.name);
|
||||
}
|
||||
}
|
||||
@@ -28708,12 +28766,26 @@ var ts;
|
||||
if (hoistedVars) {
|
||||
writeLine();
|
||||
write("var ");
|
||||
var seen = {};
|
||||
for (var i = 0; i < hoistedVars.length; ++i) {
|
||||
var local = hoistedVars[i];
|
||||
var name_21 = local.kind === 65 /* Identifier */
|
||||
? local
|
||||
: local.name;
|
||||
if (name_21) {
|
||||
// do not emit duplicate entries (in case of declaration merging) in the list of hoisted variables
|
||||
var text = ts.unescapeIdentifier(name_21.text);
|
||||
if (ts.hasProperty(seen, text)) {
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
seen[text] = text;
|
||||
}
|
||||
}
|
||||
if (i !== 0) {
|
||||
write(", ");
|
||||
}
|
||||
if (local.kind === 202 /* ClassDeclaration */ || local.kind === 206 /* ModuleDeclaration */) {
|
||||
if (local.kind === 202 /* ClassDeclaration */ || local.kind === 206 /* ModuleDeclaration */ || local.kind === 205 /* EnumDeclaration */) {
|
||||
emitDeclarationName(local);
|
||||
}
|
||||
else {
|
||||
@@ -28744,6 +28816,9 @@ var ts;
|
||||
}
|
||||
return exportedDeclarations;
|
||||
function visit(node) {
|
||||
if (node.flags & 2 /* Ambient */) {
|
||||
return;
|
||||
}
|
||||
if (node.kind === 201 /* FunctionDeclaration */) {
|
||||
if (!hoistedFunctionDeclarations) {
|
||||
hoistedFunctionDeclarations = [];
|
||||
@@ -28752,31 +28827,41 @@ var ts;
|
||||
return;
|
||||
}
|
||||
if (node.kind === 202 /* ClassDeclaration */) {
|
||||
// TODO: rename block scoped classes
|
||||
if (!hoistedVars) {
|
||||
hoistedVars = [];
|
||||
}
|
||||
hoistedVars.push(node);
|
||||
return;
|
||||
}
|
||||
if (node.kind === 206 /* ModuleDeclaration */ && shouldEmitModuleDeclaration(node)) {
|
||||
if (!hoistedVars) {
|
||||
hoistedVars = [];
|
||||
if (node.kind === 205 /* EnumDeclaration */) {
|
||||
if (shouldEmitEnumDeclaration(node)) {
|
||||
if (!hoistedVars) {
|
||||
hoistedVars = [];
|
||||
}
|
||||
hoistedVars.push(node);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (node.kind === 206 /* ModuleDeclaration */) {
|
||||
if (shouldEmitModuleDeclaration(node)) {
|
||||
if (!hoistedVars) {
|
||||
hoistedVars = [];
|
||||
}
|
||||
hoistedVars.push(node);
|
||||
}
|
||||
hoistedVars.push(node);
|
||||
return;
|
||||
}
|
||||
if (node.kind === 199 /* VariableDeclaration */ || node.kind === 153 /* BindingElement */) {
|
||||
if (shouldHoistVariable(node, false)) {
|
||||
var name_21 = node.name;
|
||||
if (name_21.kind === 65 /* Identifier */) {
|
||||
var name_22 = node.name;
|
||||
if (name_22.kind === 65 /* Identifier */) {
|
||||
if (!hoistedVars) {
|
||||
hoistedVars = [];
|
||||
}
|
||||
hoistedVars.push(name_21);
|
||||
hoistedVars.push(name_22);
|
||||
}
|
||||
else {
|
||||
ts.forEachChild(name_21, visit);
|
||||
ts.forEachChild(name_22, visit);
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -29571,7 +29656,7 @@ var ts;
|
||||
/* @internal */ ts.ioReadTime = 0;
|
||||
/* @internal */ ts.ioWriteTime = 0;
|
||||
/** The version of the TypeScript compiler release */
|
||||
ts.version = "1.5.0";
|
||||
ts.version = "1.5.2";
|
||||
var carriageReturnLineFeed = "\r\n";
|
||||
var lineFeed = "\n";
|
||||
function findConfigFile(searchPath) {
|
||||
@@ -29755,14 +29840,19 @@ var ts;
|
||||
// Create the emit resolver outside of the "emitTime" tracking code below. That way
|
||||
// any cost associated with it (like type checking) are appropriate associated with
|
||||
// the type-checking counter.
|
||||
var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile);
|
||||
//
|
||||
// If the -out option is specified, we should not pass the source file to getEmitResolver.
|
||||
// This is because in the -out scenario all files need to be emitted, and therefore all
|
||||
// files need to be type checked. And the way to specify that all files need to be type
|
||||
// checked is to not pass the file to getEmitResolver.
|
||||
var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(options.out ? undefined : sourceFile);
|
||||
var start = new Date().getTime();
|
||||
var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile);
|
||||
ts.emitTime += new Date().getTime() - start;
|
||||
return emitResult;
|
||||
}
|
||||
function getSourceFile(fileName) {
|
||||
fileName = host.getCanonicalFileName(fileName);
|
||||
fileName = host.getCanonicalFileName(ts.normalizeSlashes(fileName));
|
||||
return ts.hasProperty(filesByName, fileName) ? filesByName[fileName] : undefined;
|
||||
}
|
||||
function getDiagnosticsHelper(sourceFile, getDiagnostics) {
|
||||
@@ -29819,43 +29909,50 @@ var ts;
|
||||
function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) {
|
||||
var start;
|
||||
var length;
|
||||
var extensions;
|
||||
var diagnosticArgument;
|
||||
if (refEnd !== undefined && refPos !== undefined) {
|
||||
start = refPos;
|
||||
length = refEnd - refPos;
|
||||
}
|
||||
var diagnostic;
|
||||
if (hasExtension(fileName)) {
|
||||
if (!options.allowNonTsExtensions && !ts.fileExtensionIs(host.getCanonicalFileName(fileName), ".ts")) {
|
||||
diagnostic = ts.Diagnostics.File_0_must_have_extension_ts_or_d_ts;
|
||||
if (!options.allowNonTsExtensions && !ts.forEach(ts.supportedExtensions, function (extension) { return ts.fileExtensionIs(host.getCanonicalFileName(fileName), extension); })) {
|
||||
diagnostic = ts.Diagnostics.File_0_has_unsupported_extension_The_only_supported_extensions_are_1;
|
||||
diagnosticArgument = [fileName, "'" + ts.supportedExtensions.join("', '") + "'"];
|
||||
}
|
||||
else if (!findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd)) {
|
||||
diagnostic = ts.Diagnostics.File_0_not_found;
|
||||
diagnosticArgument = [fileName];
|
||||
}
|
||||
else if (refFile && host.getCanonicalFileName(fileName) === host.getCanonicalFileName(refFile.fileName)) {
|
||||
diagnostic = ts.Diagnostics.A_file_cannot_have_a_reference_to_itself;
|
||||
diagnosticArgument = [fileName];
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (options.allowNonTsExtensions && !findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd)) {
|
||||
diagnostic = ts.Diagnostics.File_0_not_found;
|
||||
diagnosticArgument = [fileName];
|
||||
}
|
||||
else if (!findSourceFile(fileName + ".ts", isDefaultLib, refFile, refPos, refEnd) && !findSourceFile(fileName + ".d.ts", isDefaultLib, refFile, refPos, refEnd)) {
|
||||
else if (!ts.forEach(ts.supportedExtensions, function (extension) { return findSourceFile(fileName + extension, isDefaultLib, refFile, refPos, refEnd); })) {
|
||||
diagnostic = ts.Diagnostics.File_0_not_found;
|
||||
fileName += ".ts";
|
||||
diagnosticArgument = [fileName];
|
||||
}
|
||||
}
|
||||
if (diagnostic) {
|
||||
if (refFile) {
|
||||
diagnostics.add(ts.createFileDiagnostic(refFile, start, length, diagnostic, fileName));
|
||||
diagnostics.add(ts.createFileDiagnostic.apply(void 0, [refFile, start, length, diagnostic].concat(diagnosticArgument)));
|
||||
}
|
||||
else {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(diagnostic, fileName));
|
||||
diagnostics.add(ts.createCompilerDiagnostic.apply(void 0, [diagnostic].concat(diagnosticArgument)));
|
||||
}
|
||||
}
|
||||
}
|
||||
// Get source file from normalized fileName
|
||||
function findSourceFile(fileName, isDefaultLib, refFile, refStart, refLength) {
|
||||
var canonicalName = host.getCanonicalFileName(fileName);
|
||||
var canonicalName = host.getCanonicalFileName(ts.normalizeSlashes(fileName));
|
||||
if (ts.hasProperty(filesByName, canonicalName)) {
|
||||
// We've already looked for this file, use cached result
|
||||
return getSourceFileFromCache(fileName, canonicalName, false);
|
||||
@@ -29918,9 +30015,10 @@ var ts;
|
||||
var moduleNameText = moduleNameExpr.text;
|
||||
if (moduleNameText) {
|
||||
var searchPath = basePath;
|
||||
var searchName;
|
||||
while (true) {
|
||||
var searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleNameText));
|
||||
if (findModuleSourceFile(searchName + ".ts", moduleNameExpr) || findModuleSourceFile(searchName + ".d.ts", moduleNameExpr)) {
|
||||
searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleNameText));
|
||||
if (ts.forEach(ts.supportedExtensions, function (extension) { return findModuleSourceFile(searchName + extension, moduleNameExpr); })) {
|
||||
break;
|
||||
}
|
||||
var parentPath = ts.getDirectoryPath(searchPath);
|
||||
@@ -29948,10 +30046,7 @@ var ts;
|
||||
// An ExternalImportDeclaration in anAmbientExternalModuleDeclaration may reference other external modules
|
||||
// only through top - level external module names. Relative external module names are not permitted.
|
||||
var searchName = ts.normalizePath(ts.combinePaths(basePath, moduleName));
|
||||
var tsFile = findModuleSourceFile(searchName + ".ts", nameLiteral);
|
||||
if (!tsFile) {
|
||||
findModuleSourceFile(searchName + ".d.ts", nameLiteral);
|
||||
}
|
||||
ts.forEach(ts.supportedExtensions, function (extension) { return findModuleSourceFile(searchName + extension, nameLiteral); });
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -30046,10 +30141,10 @@ var ts;
|
||||
if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) {
|
||||
// Error to specify --mapRoot or --sourceRoot without mapSourceFiles
|
||||
if (options.mapRoot) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option));
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option));
|
||||
}
|
||||
if (options.sourceRoot) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option));
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -30197,7 +30292,7 @@ var ts;
|
||||
{
|
||||
name: "noEmitOnError",
|
||||
type: "boolean",
|
||||
description: ts.Diagnostics.Do_not_emit_outputs_if_any_type_checking_errors_were_reported
|
||||
description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported
|
||||
},
|
||||
{
|
||||
name: "noImplicitAny",
|
||||
@@ -30684,12 +30779,12 @@ var ts;
|
||||
ts.forEach(program.getSourceFiles(), function (sourceFile) {
|
||||
cancellationToken.throwIfCancellationRequested();
|
||||
var nameToDeclarations = sourceFile.getNamedDeclarations();
|
||||
for (var name_22 in nameToDeclarations) {
|
||||
var declarations = ts.getProperty(nameToDeclarations, name_22);
|
||||
for (var name_23 in nameToDeclarations) {
|
||||
var declarations = ts.getProperty(nameToDeclarations, name_23);
|
||||
if (declarations) {
|
||||
// First do a quick check to see if the name of the declaration matches the
|
||||
// last portion of the (possibly) dotted name they're searching for.
|
||||
var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_22);
|
||||
var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_23);
|
||||
if (!matches) {
|
||||
continue;
|
||||
}
|
||||
@@ -30702,14 +30797,14 @@ var ts;
|
||||
if (!containers) {
|
||||
return undefined;
|
||||
}
|
||||
matches = patternMatcher.getMatches(containers, name_22);
|
||||
matches = patternMatcher.getMatches(containers, name_23);
|
||||
if (!matches) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
var fileName = sourceFile.fileName;
|
||||
var matchKind = bestMatchKind(matches);
|
||||
rawItems.push({ name: name_22, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration });
|
||||
rawItems.push({ name: name_23, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31092,9 +31187,9 @@ var ts;
|
||||
case 199 /* VariableDeclaration */:
|
||||
case 153 /* BindingElement */:
|
||||
var variableDeclarationNode;
|
||||
var name_23;
|
||||
var name_24;
|
||||
if (node.kind === 153 /* BindingElement */) {
|
||||
name_23 = node.name;
|
||||
name_24 = node.name;
|
||||
variableDeclarationNode = node;
|
||||
// binding elements are added only for variable declarations
|
||||
// bubble up to the containing variable declaration
|
||||
@@ -31106,16 +31201,16 @@ var ts;
|
||||
else {
|
||||
ts.Debug.assert(!ts.isBindingPattern(node.name));
|
||||
variableDeclarationNode = node;
|
||||
name_23 = node.name;
|
||||
name_24 = node.name;
|
||||
}
|
||||
if (ts.isConst(variableDeclarationNode)) {
|
||||
return createItem(node, getTextOfNode(name_23), ts.ScriptElementKind.constElement);
|
||||
return createItem(node, getTextOfNode(name_24), ts.ScriptElementKind.constElement);
|
||||
}
|
||||
else if (ts.isLet(variableDeclarationNode)) {
|
||||
return createItem(node, getTextOfNode(name_23), ts.ScriptElementKind.letElement);
|
||||
return createItem(node, getTextOfNode(name_24), ts.ScriptElementKind.letElement);
|
||||
}
|
||||
else {
|
||||
return createItem(node, getTextOfNode(name_23), ts.ScriptElementKind.variableElement);
|
||||
return createItem(node, getTextOfNode(name_24), ts.ScriptElementKind.variableElement);
|
||||
}
|
||||
case 136 /* Constructor */:
|
||||
return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement);
|
||||
@@ -33702,9 +33797,9 @@ var ts;
|
||||
}
|
||||
Rules.prototype.getRuleName = function (rule) {
|
||||
var o = this;
|
||||
for (var name_24 in o) {
|
||||
if (o[name_24] === rule) {
|
||||
return name_24;
|
||||
for (var name_25 in o) {
|
||||
if (o[name_25] === rule) {
|
||||
return name_25;
|
||||
}
|
||||
}
|
||||
throw new Error("Unknown rule");
|
||||
@@ -36487,8 +36582,9 @@ var ts;
|
||||
// at each language service public entry point, since we don't know when
|
||||
// set of scripts handled by the host changes.
|
||||
var HostCache = (function () {
|
||||
function HostCache(host) {
|
||||
function HostCache(host, getCanonicalFileName) {
|
||||
this.host = host;
|
||||
this.getCanonicalFileName = getCanonicalFileName;
|
||||
// script id => script index
|
||||
this.fileNameToEntry = {};
|
||||
// Initialize the list with the root file names
|
||||
@@ -36503,6 +36599,9 @@ var ts;
|
||||
HostCache.prototype.compilationSettings = function () {
|
||||
return this._compilationSettings;
|
||||
};
|
||||
HostCache.prototype.normalizeFileName = function (fileName) {
|
||||
return this.getCanonicalFileName(ts.normalizeSlashes(fileName));
|
||||
};
|
||||
HostCache.prototype.createEntry = function (fileName) {
|
||||
var entry;
|
||||
var scriptSnapshot = this.host.getScriptSnapshot(fileName);
|
||||
@@ -36513,13 +36612,13 @@ var ts;
|
||||
scriptSnapshot: scriptSnapshot
|
||||
};
|
||||
}
|
||||
return this.fileNameToEntry[ts.normalizeSlashes(fileName)] = entry;
|
||||
return this.fileNameToEntry[this.normalizeFileName(fileName)] = entry;
|
||||
};
|
||||
HostCache.prototype.getEntry = function (fileName) {
|
||||
return ts.lookUp(this.fileNameToEntry, ts.normalizeSlashes(fileName));
|
||||
return ts.lookUp(this.fileNameToEntry, this.normalizeFileName(fileName));
|
||||
};
|
||||
HostCache.prototype.contains = function (fileName) {
|
||||
return ts.hasProperty(this.fileNameToEntry, ts.normalizeSlashes(fileName));
|
||||
return ts.hasProperty(this.fileNameToEntry, this.normalizeFileName(fileName));
|
||||
};
|
||||
HostCache.prototype.getOrCreateEntry = function (fileName) {
|
||||
if (this.contains(fileName)) {
|
||||
@@ -36531,8 +36630,10 @@ var ts;
|
||||
var _this = this;
|
||||
var fileNames = [];
|
||||
ts.forEachKey(this.fileNameToEntry, function (key) {
|
||||
if (ts.hasProperty(_this.fileNameToEntry, key) && _this.fileNameToEntry[key])
|
||||
fileNames.push(key);
|
||||
var entry = _this.getEntry(key);
|
||||
if (entry) {
|
||||
fileNames.push(entry.hostFileName);
|
||||
}
|
||||
});
|
||||
return fileNames;
|
||||
};
|
||||
@@ -37119,6 +37220,7 @@ var ts;
|
||||
var syntaxTreeCache = new SyntaxTreeCache(host);
|
||||
var ruleProvider;
|
||||
var program;
|
||||
var lastProjectVersion;
|
||||
var useCaseSensitivefileNames = false;
|
||||
var cancellationToken = new CancellationTokenObject(host.getCancellationToken && host.getCancellationToken());
|
||||
// Check if the localized messages json is set, otherwise query the host for it
|
||||
@@ -37150,8 +37252,18 @@ var ts;
|
||||
return ruleProvider;
|
||||
}
|
||||
function synchronizeHostData() {
|
||||
// perform fast check if host supports it
|
||||
if (host.getProjectVersion) {
|
||||
var hostProjectVersion = host.getProjectVersion();
|
||||
if (hostProjectVersion) {
|
||||
if (lastProjectVersion === hostProjectVersion) {
|
||||
return;
|
||||
}
|
||||
lastProjectVersion = hostProjectVersion;
|
||||
}
|
||||
}
|
||||
// Get a fresh cache of the host information
|
||||
var hostCache = new HostCache(host);
|
||||
var hostCache = new HostCache(host, getCanonicalFileName);
|
||||
// If the program is already up-to-date, we can reuse it
|
||||
if (programUpToDate()) {
|
||||
return;
|
||||
@@ -37168,7 +37280,7 @@ var ts;
|
||||
var newProgram = ts.createProgram(hostCache.getRootFileNames(), newSettings, {
|
||||
getSourceFile: getOrCreateSourceFile,
|
||||
getCancellationToken: function () { return cancellationToken; },
|
||||
getCanonicalFileName: function (fileName) { return useCaseSensitivefileNames ? fileName : fileName.toLowerCase(); },
|
||||
getCanonicalFileName: getCanonicalFileName,
|
||||
useCaseSensitiveFileNames: function () { return useCaseSensitivefileNames; },
|
||||
getNewLine: function () { return host.getNewLine ? host.getNewLine() : "\r\n"; },
|
||||
getDefaultLibFileName: function (options) { return host.getDefaultLibFileName(options); },
|
||||
@@ -37706,12 +37818,14 @@ var ts;
|
||||
|| containingNodeKind === 136 /* Constructor */ // constructor( a, | public, protected, private keywords are allowed here, so show completion
|
||||
|| containingNodeKind === 159 /* NewExpression */ // new C(a, |
|
||||
|| containingNodeKind === 154 /* ArrayLiteralExpression */ // [a, |
|
||||
|| containingNodeKind === 170 /* BinaryExpression */; // let x = (a, |
|
||||
|| containingNodeKind === 170 /* BinaryExpression */ // let x = (a, |
|
||||
|| containingNodeKind === 143 /* FunctionType */; // var x: (s: string, list|
|
||||
case 16 /* OpenParenToken */:
|
||||
return containingNodeKind === 158 /* CallExpression */ // func( |
|
||||
|| containingNodeKind === 136 /* Constructor */ // constructor( |
|
||||
|| containingNodeKind === 159 /* NewExpression */ // new C(a|
|
||||
|| containingNodeKind === 162 /* ParenthesizedExpression */; // let x = (a|
|
||||
|| containingNodeKind === 162 /* ParenthesizedExpression */ // let x = (a|
|
||||
|| containingNodeKind === 150 /* ParenthesizedType */; // function F(pred: (a| this can become an arrow function, where 'a' is the argument
|
||||
case 18 /* OpenBracketToken */:
|
||||
return containingNodeKind === 154 /* ArrayLiteralExpression */; // [ |
|
||||
case 117 /* ModuleKeyword */: // module |
|
||||
@@ -37808,8 +37922,10 @@ var ts;
|
||||
containingNodeKind === 151 /* ObjectBindingPattern */; // function func({ x, y|
|
||||
case 20 /* DotToken */:
|
||||
return containingNodeKind === 152 /* ArrayBindingPattern */; // var [.|
|
||||
case 51 /* ColonToken */:
|
||||
return containingNodeKind === 153 /* BindingElement */; // var {x :html|
|
||||
case 18 /* OpenBracketToken */:
|
||||
return containingNodeKind === 152 /* ArrayBindingPattern */; // var [x|
|
||||
return containingNodeKind === 152 /* ArrayBindingPattern */; // var [x|
|
||||
case 16 /* OpenParenToken */:
|
||||
return containingNodeKind === 224 /* CatchClause */ ||
|
||||
isFunction(containingNodeKind);
|
||||
@@ -37822,7 +37938,7 @@ var ts;
|
||||
return containingNodeKind === 132 /* PropertySignature */ &&
|
||||
previousToken.parent && previousToken.parent.parent &&
|
||||
(previousToken.parent.parent.kind === 203 /* InterfaceDeclaration */ ||
|
||||
previousToken.parent.parent.kind === 146 /* TypeLiteral */); // let x : { a; |
|
||||
previousToken.parent.parent.kind === 146 /* TypeLiteral */); // let x : { a; |
|
||||
case 24 /* LessThanToken */:
|
||||
return containingNodeKind === 202 /* ClassDeclaration */ ||
|
||||
containingNodeKind === 201 /* FunctionDeclaration */ ||
|
||||
@@ -37834,7 +37950,7 @@ var ts;
|
||||
return containingNodeKind === 130 /* Parameter */ ||
|
||||
containingNodeKind === 136 /* Constructor */ ||
|
||||
(previousToken.parent && previousToken.parent.parent &&
|
||||
previousToken.parent.parent.kind === 152 /* ArrayBindingPattern */); // var [ ...z|
|
||||
previousToken.parent.parent.kind === 152 /* ArrayBindingPattern */); // var [...z|
|
||||
case 108 /* PublicKeyword */:
|
||||
case 106 /* PrivateKeyword */:
|
||||
case 107 /* ProtectedKeyword */:
|
||||
@@ -37850,6 +37966,7 @@ var ts;
|
||||
case 104 /* LetKeyword */:
|
||||
case 70 /* ConstKeyword */:
|
||||
case 110 /* YieldKeyword */:
|
||||
case 124 /* TypeKeyword */:
|
||||
return true;
|
||||
}
|
||||
// Previous token may have been a keyword that was converted to an identifier.
|
||||
@@ -37948,10 +38065,10 @@ var ts;
|
||||
for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) {
|
||||
var sourceFile = _a[_i];
|
||||
var nameTable = getNameTable(sourceFile);
|
||||
for (var name_25 in nameTable) {
|
||||
if (!allNames[name_25]) {
|
||||
allNames[name_25] = name_25;
|
||||
var displayName = getCompletionEntryDisplayName(name_25, target, true);
|
||||
for (var name_26 in nameTable) {
|
||||
if (!allNames[name_26]) {
|
||||
allNames[name_26] = name_26;
|
||||
var displayName = getCompletionEntryDisplayName(name_26, target, true);
|
||||
if (displayName) {
|
||||
var entry = {
|
||||
name: displayName,
|
||||
@@ -39833,19 +39950,19 @@ var ts;
|
||||
if (isNameOfPropertyAssignment(node)) {
|
||||
var objectLiteral = node.parent.parent;
|
||||
var contextualType = typeChecker.getContextualType(objectLiteral);
|
||||
var name_26 = node.text;
|
||||
var name_27 = node.text;
|
||||
if (contextualType) {
|
||||
if (contextualType.flags & 16384 /* Union */) {
|
||||
// This is a union type, first see if the property we are looking for is a union property (i.e. exists in all types)
|
||||
// if not, search the constituent types for the property
|
||||
var unionProperty = contextualType.getProperty(name_26);
|
||||
var unionProperty = contextualType.getProperty(name_27);
|
||||
if (unionProperty) {
|
||||
return [unionProperty];
|
||||
}
|
||||
else {
|
||||
var result_4 = [];
|
||||
ts.forEach(contextualType.types, function (t) {
|
||||
var symbol = t.getProperty(name_26);
|
||||
var symbol = t.getProperty(name_27);
|
||||
if (symbol) {
|
||||
result_4.push(symbol);
|
||||
}
|
||||
@@ -39854,7 +39971,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var symbol_1 = contextualType.getProperty(name_26);
|
||||
var symbol_1 = contextualType.getProperty(name_27);
|
||||
if (symbol_1) {
|
||||
return [symbol_1];
|
||||
}
|
||||
@@ -40274,10 +40391,12 @@ var ts;
|
||||
var kind = triviaScanner.scan();
|
||||
var end = triviaScanner.getTextPos();
|
||||
var width = end - start;
|
||||
// The moment we get something that isn't trivia, then stop processing.
|
||||
if (!ts.isTrivia(kind)) {
|
||||
return;
|
||||
}
|
||||
// Only bother with the trivia if it at least intersects the span of interest.
|
||||
if (ts.textSpanIntersectsWith(span, start, width)) {
|
||||
if (!ts.isTrivia(kind)) {
|
||||
return;
|
||||
}
|
||||
if (ts.isComment(kind)) {
|
||||
// Simple comment. Just add as is.
|
||||
pushClassification(start, width, 1 /* comment */);
|
||||
@@ -41720,6 +41839,13 @@ var ts;
|
||||
LanguageServiceShimHostAdapter.prototype.error = function (s) {
|
||||
this.shimHost.error(s);
|
||||
};
|
||||
LanguageServiceShimHostAdapter.prototype.getProjectVersion = function () {
|
||||
if (!this.shimHost.getProjectVersion) {
|
||||
// shimmed host does not support getProjectVersion
|
||||
return undefined;
|
||||
}
|
||||
return this.shimHost.getProjectVersion();
|
||||
};
|
||||
LanguageServiceShimHostAdapter.prototype.getCompilationSettings = function () {
|
||||
var settingsJson = this.shimHost.getCompilationSettings();
|
||||
if (settingsJson == null || settingsJson == "") {
|
||||
@@ -42232,7 +42358,7 @@ var ts;
|
||||
return {
|
||||
options: configFile.options,
|
||||
files: configFile.fileNames,
|
||||
errors: [realizeDiagnostics(configFile.errors, '\r\n')]
|
||||
errors: realizeDiagnostics(configFile.errors, '\r\n')
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
+2
-7
@@ -2,13 +2,8 @@
|
||||
"name": "typescript",
|
||||
"author": "Microsoft Corp.",
|
||||
"homepage": "http://typescriptlang.org/",
|
||||
"version": "1.5.0",
|
||||
"licenses": [
|
||||
{
|
||||
"type": "Apache License 2.0",
|
||||
"url": "https://github.com/Microsoft/TypeScript/blob/master/LICENSE.txt"
|
||||
}
|
||||
],
|
||||
"version": "1.5.2",
|
||||
"license": "Apache-2.0",
|
||||
"description": "TypeScript is a language for application scale JavaScript development",
|
||||
"keywords": [
|
||||
"TypeScript",
|
||||
|
||||
+28
-9
@@ -88,6 +88,7 @@ module ts {
|
||||
let undefinedType = createIntrinsicType(TypeFlags.Undefined | TypeFlags.ContainsUndefinedOrNull, "undefined");
|
||||
let nullType = createIntrinsicType(TypeFlags.Null | TypeFlags.ContainsUndefinedOrNull, "null");
|
||||
let unknownType = createIntrinsicType(TypeFlags.Any, "unknown");
|
||||
let circularType = createIntrinsicType(TypeFlags.Any, "__circular__");
|
||||
|
||||
let emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
|
||||
let anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
|
||||
@@ -2418,7 +2419,16 @@ module ts {
|
||||
function getTypeOfAlias(symbol: Symbol): Type {
|
||||
let links = getSymbolLinks(symbol);
|
||||
if (!links.type) {
|
||||
links.type = getTypeOfSymbol(resolveAlias(symbol));
|
||||
let targetSymbol = resolveAlias(symbol);
|
||||
|
||||
// It only makes sense to get the type of a value symbol. If the result of resolving
|
||||
// the alias is not a value, then it has no type. To get the type associated with a
|
||||
// type symbol, call getDeclaredTypeOfSymbol.
|
||||
// This check is important because without it, a call to getTypeOfSymbol could end
|
||||
// up recursively calling getTypeOfAlias, causing a stack overflow.
|
||||
links.type = targetSymbol.flags & SymbolFlags.Value
|
||||
? getTypeOfSymbol(targetSymbol)
|
||||
: unknownType;
|
||||
}
|
||||
return links.type;
|
||||
}
|
||||
@@ -3642,10 +3652,20 @@ module ts {
|
||||
return type;
|
||||
}
|
||||
|
||||
// Subtype reduction is basically an optimization we do to avoid excessively large union types, which take longer
|
||||
// to process and look strange in quick info and error messages. Semantically there is no difference between the
|
||||
// reduced type and the type itself. So, when we detect a circularity we simply say that the reduced type is the
|
||||
// type itself.
|
||||
function getReducedTypeOfUnionType(type: UnionType): Type {
|
||||
// If union type was created without subtype reduction, perform the deferred reduction now
|
||||
if (!type.reducedType) {
|
||||
type.reducedType = getUnionType(type.types, /*noSubtypeReduction*/ false);
|
||||
type.reducedType = circularType;
|
||||
let reducedType = getUnionType(type.types, /*noSubtypeReduction*/ false);
|
||||
if (type.reducedType === circularType) {
|
||||
type.reducedType = reducedType;
|
||||
}
|
||||
}
|
||||
else if (type.reducedType === circularType) {
|
||||
type.reducedType = type;
|
||||
}
|
||||
return type.reducedType;
|
||||
}
|
||||
@@ -7135,10 +7155,10 @@ module ts {
|
||||
}
|
||||
|
||||
function resolveNewExpression(node: NewExpression, candidatesOutArray: Signature[]): Signature {
|
||||
if (node.arguments && languageVersion < ScriptTarget.ES6) {
|
||||
if (node.arguments && languageVersion < ScriptTarget.ES5) {
|
||||
let spreadIndex = getSpreadArgumentIndex(node.arguments);
|
||||
if (spreadIndex >= 0) {
|
||||
error(node.arguments[spreadIndex], Diagnostics.Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher);
|
||||
error(node.arguments[spreadIndex], Diagnostics.Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7156,7 +7176,7 @@ module ts {
|
||||
// If ConstructExpr's apparent type(section 3.8.1) is an object type with one or
|
||||
// more construct signatures, the expression is processed in the same manner as a
|
||||
// function call, but using the construct signatures as the initial set of candidate
|
||||
// signatures for overload resolution.The result type of the function call becomes
|
||||
// signatures for overload resolution. The result type of the function call becomes
|
||||
// the result type of the operation.
|
||||
expressionType = getApparentType(expressionType);
|
||||
if (expressionType === unknownType) {
|
||||
@@ -11301,6 +11321,7 @@ module ts {
|
||||
break;
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
forEach(node.decorators, checkFunctionExpressionBodies);
|
||||
forEach((<MethodDeclaration>node).parameters, checkFunctionExpressionBodies);
|
||||
if (isObjectLiteralMethod(node)) {
|
||||
checkFunctionExpressionOrObjectLiteralMethodBody(<MethodDeclaration>node);
|
||||
@@ -11315,6 +11336,7 @@ module ts {
|
||||
case SyntaxKind.WithStatement:
|
||||
checkFunctionExpressionBodies((<WithStatement>node).expression);
|
||||
break;
|
||||
case SyntaxKind.Decorator:
|
||||
case SyntaxKind.Parameter:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
@@ -12818,9 +12840,6 @@ module ts {
|
||||
else if ((node.kind === SyntaxKind.ImportDeclaration || node.kind === SyntaxKind.ImportEqualsDeclaration) && flags & NodeFlags.Ambient) {
|
||||
return grammarErrorOnNode(lastDeclare, Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare");
|
||||
}
|
||||
else if (node.kind === SyntaxKind.InterfaceDeclaration && flags & NodeFlags.Ambient) {
|
||||
return grammarErrorOnNode(lastDeclare, Diagnostics.A_0_modifier_cannot_be_used_with_an_interface_declaration, "declare");
|
||||
}
|
||||
else if (node.kind === SyntaxKind.Parameter && (flags & NodeFlags.AccessibilityModifier) && isBindingPattern((<ParameterDeclaration>node).name)) {
|
||||
return grammarErrorOnNode(node, Diagnostics.A_parameter_property_may_not_be_a_binding_pattern);
|
||||
}
|
||||
|
||||
+11
-1
@@ -459,8 +459,18 @@ module ts {
|
||||
if (path.charCodeAt(2) === CharacterCodes.slash) return 3;
|
||||
return 2;
|
||||
}
|
||||
// Per RFC 1738 'file' URI schema has the shape file://<host>/<path>
|
||||
// if <host> is omitted then it is assumed that host value is 'localhost',
|
||||
// however slash after the omitted <host> is not removed.
|
||||
// file:///folder1/file1 - this is a correct URI
|
||||
// file://folder2/file2 - this is an incorrect URI
|
||||
if (path.lastIndexOf("file:///", 0) === 0) {
|
||||
return "file:///".length;
|
||||
}
|
||||
let idx = path.indexOf('://');
|
||||
if (idx !== -1) return idx + 3
|
||||
if (idx !== -1) {
|
||||
return idx + "://".length;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -345,7 +345,7 @@ module ts {
|
||||
The_0_operator_cannot_be_applied_to_type_symbol: { code: 2469, category: DiagnosticCategory.Error, key: "The '{0}' operator cannot be applied to type 'symbol'." },
|
||||
Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: { code: 2470, category: DiagnosticCategory.Error, key: "'Symbol' reference does not refer to the global Symbol constructor object." },
|
||||
A_computed_property_name_of_the_form_0_must_be_of_type_symbol: { code: 2471, category: DiagnosticCategory.Error, key: "A computed property name of the form '{0}' must be of type 'symbol'." },
|
||||
Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher: { code: 2472, category: DiagnosticCategory.Error, key: "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher." },
|
||||
Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher: { code: 2472, category: DiagnosticCategory.Error, key: "Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher." },
|
||||
Enum_declarations_must_all_be_const_or_non_const: { code: 2473, category: DiagnosticCategory.Error, key: "Enum declarations must all be const or non-const." },
|
||||
In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 2474, category: DiagnosticCategory.Error, key: "In 'const' enum declarations member initializer must be constant expression." },
|
||||
const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 2475, category: DiagnosticCategory.Error, key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." },
|
||||
|
||||
@@ -1369,7 +1369,7 @@
|
||||
"category": "Error",
|
||||
"code": 2471
|
||||
},
|
||||
"Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher.": {
|
||||
"Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher.": {
|
||||
"category": "Error",
|
||||
"code": 2472
|
||||
},
|
||||
|
||||
+87
-22
@@ -155,7 +155,7 @@ var __awaiter = (this && this.__awaiter) || function (generator, ctor) {
|
||||
let exportEquals: ExportAssignment;
|
||||
let hasExportStars: boolean;
|
||||
|
||||
/** write emitted output to disk*/
|
||||
/** Write emitted output to disk */
|
||||
let writeEmittedFiles = writeJavaScriptFile;
|
||||
|
||||
let detachedCommentsInfo: { nodePos: number; detachedCommentEndPos: number }[];
|
||||
@@ -1406,16 +1406,16 @@ var __awaiter = (this && this.__awaiter) || function (generator, ctor) {
|
||||
return true;
|
||||
}
|
||||
|
||||
function emitListWithSpread(elements: Expression[], alwaysCopy: boolean, multiLine: boolean, trailingComma: boolean) {
|
||||
function emitListWithSpread(elements: Expression[], needsUniqueCopy: boolean, multiLine: boolean, trailingComma: boolean, useConcat: boolean) {
|
||||
let pos = 0;
|
||||
let group = 0;
|
||||
let length = elements.length;
|
||||
while (pos < length) {
|
||||
// Emit using the pattern <group0>.concat(<group1>, <group2>, ...)
|
||||
if (group === 1) {
|
||||
if (group === 1 && useConcat) {
|
||||
write(".concat(");
|
||||
}
|
||||
else if (group > 1) {
|
||||
else if (group > 0) {
|
||||
write(", ");
|
||||
}
|
||||
let e = elements[pos];
|
||||
@@ -1423,7 +1423,7 @@ var __awaiter = (this && this.__awaiter) || function (generator, ctor) {
|
||||
e = (<SpreadElementExpression>e).expression;
|
||||
emitParenthesizedIf(e, /*parenthesized*/ group === 0 && needsParenthesisForPropertyAccessOrInvocation(e));
|
||||
pos++;
|
||||
if (pos === length && group === 0 && alwaysCopy && e.kind !== SyntaxKind.ArrayLiteralExpression) {
|
||||
if (pos === length && group === 0 && needsUniqueCopy && e.kind !== SyntaxKind.ArrayLiteralExpression) {
|
||||
write(".slice()");
|
||||
}
|
||||
}
|
||||
@@ -1446,7 +1446,9 @@ var __awaiter = (this && this.__awaiter) || function (generator, ctor) {
|
||||
group++;
|
||||
}
|
||||
if (group > 1) {
|
||||
write(")");
|
||||
if(useConcat) {
|
||||
write(")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1465,8 +1467,8 @@ var __awaiter = (this && this.__awaiter) || function (generator, ctor) {
|
||||
write("]");
|
||||
}
|
||||
else {
|
||||
emitListWithSpread(elements, /*alwaysCopy*/ true, /*multiLine*/(node.flags & NodeFlags.MultiLine) !== 0,
|
||||
/*trailingComma*/ elements.hasTrailingComma);
|
||||
emitListWithSpread(elements, /*needsUniqueCopy*/ true, /*multiLine*/(node.flags & NodeFlags.MultiLine) !== 0,
|
||||
/*trailingComma*/ elements.hasTrailingComma, /*useConcat*/ true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1890,7 +1892,7 @@ var __awaiter = (this && this.__awaiter) || function (generator, ctor) {
|
||||
write("void 0");
|
||||
}
|
||||
write(", ");
|
||||
emitListWithSpread(node.arguments, /*alwaysCopy*/ false, /*multiLine*/ false, /*trailingComma*/ false);
|
||||
emitListWithSpread(node.arguments, /*needsUniqueCopy*/ false, /*multiLine*/ false, /*trailingComma*/ false, /*useConcat*/ true);
|
||||
write(")");
|
||||
}
|
||||
|
||||
@@ -1926,11 +1928,44 @@ var __awaiter = (this && this.__awaiter) || function (generator, ctor) {
|
||||
|
||||
function emitNewExpression(node: NewExpression) {
|
||||
write("new ");
|
||||
emit(node.expression);
|
||||
if (node.arguments) {
|
||||
|
||||
// Spread operator logic can be supported in new expressions in ES5 using a combination
|
||||
// of Function.prototype.bind() and Function.prototype.apply().
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// var arguments = [1, 2, 3, 4, 5];
|
||||
// new Array(...arguments);
|
||||
//
|
||||
// Could be transpiled into ES5:
|
||||
//
|
||||
// var arguments = [1, 2, 3, 4, 5];
|
||||
// new (Array.bind.apply(Array, [void 0].concat(arguments)));
|
||||
//
|
||||
// `[void 0]` is the first argument which represents `thisArg` to the bind method above.
|
||||
// And `thisArg` will be set to the return value of the constructor when instantiated
|
||||
// with the new operator — regardless of any value we set `thisArg` to. Thus, we set it
|
||||
// to an undefined, `void 0`.
|
||||
if (languageVersion === ScriptTarget.ES5 &&
|
||||
node.arguments &&
|
||||
hasSpreadElement(node.arguments)) {
|
||||
|
||||
write("(");
|
||||
emitCommaList(node.arguments);
|
||||
write(")");
|
||||
let target = emitCallTarget(node.expression);
|
||||
write(".bind.apply(");
|
||||
emit(target);
|
||||
write(", [void 0].concat(");
|
||||
emitListWithSpread(node.arguments, /*needsUniqueCopy*/ false, /*multiline*/ false, /*trailingComma*/ false, /*useConcat*/ false);
|
||||
write(")))");
|
||||
write("()");
|
||||
}
|
||||
else {
|
||||
emit(node.expression);
|
||||
if (node.arguments) {
|
||||
write("(");
|
||||
emitCommaList(node.arguments);
|
||||
write(")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2269,9 +2304,10 @@ var __awaiter = (this && this.__awaiter) || function (generator, ctor) {
|
||||
emitEmbeddedStatement(node.statement);
|
||||
}
|
||||
|
||||
/* Returns true if start of variable declaration list was emitted.
|
||||
* Return false if nothing was written - this can happen for source file level variable declarations
|
||||
* in system modules - such variable declarations are hoisted.
|
||||
/**
|
||||
* Returns true if start of variable declaration list was emitted.
|
||||
* Returns false if nothing was written - this can happen for source file level variable declarations
|
||||
* in system modules where such variable declarations are hoisted.
|
||||
*/
|
||||
function tryEmitStartOfVariableDeclarationList(decl: VariableDeclarationList, startPos?: number): boolean {
|
||||
if (shouldHoistVariable(decl, /*checkIfSourceFileLevelDecl*/ true)) {
|
||||
@@ -3099,15 +3135,19 @@ var __awaiter = (this && this.__awaiter) || function (generator, ctor) {
|
||||
}
|
||||
|
||||
function emitVariableStatement(node: VariableStatement) {
|
||||
let startIsEmitted = true;
|
||||
if (!(node.flags & NodeFlags.Export)) {
|
||||
startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList);
|
||||
let startIsEmitted = false;
|
||||
|
||||
if (node.flags & NodeFlags.Export) {
|
||||
if (isES6ExportedDeclaration(node)) {
|
||||
// Exported ES6 module member
|
||||
write("export ");
|
||||
startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList);
|
||||
}
|
||||
}
|
||||
else if (isES6ExportedDeclaration(node)) {
|
||||
// Exported ES6 module member
|
||||
write("export ");
|
||||
else {
|
||||
startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList);
|
||||
}
|
||||
|
||||
if (startIsEmitted) {
|
||||
emitCommaList(node.declarationList.declarations);
|
||||
write(";");
|
||||
@@ -3123,6 +3163,28 @@ var __awaiter = (this && this.__awaiter) || function (generator, ctor) {
|
||||
}
|
||||
}
|
||||
|
||||
function shouldEmitLeadingAndTrailingCommentsForVariableStatement(node: VariableStatement) {
|
||||
// If we're not exporting the variables, there's nothing special here.
|
||||
// Always emit comments for these nodes.
|
||||
if (!(node.flags & NodeFlags.Export)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// If we are exporting, but it's a top-level ES6 module exports,
|
||||
// we'll emit the declaration list verbatim, so emit comments too.
|
||||
if (isES6ExportedDeclaration(node)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Otherwise, only emit if we have at least one initializer present.
|
||||
for (let declaration of node.declarationList.declarations) {
|
||||
if (declaration.initializer) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function emitParameter(node: ParameterDeclaration) {
|
||||
if (languageVersion < ScriptTarget.ES6) {
|
||||
if (isBindingPattern(node.name)) {
|
||||
@@ -5905,6 +5967,9 @@ var __awaiter = (this && this.__awaiter) || function (generator, ctor) {
|
||||
case SyntaxKind.ExportAssignment:
|
||||
return false;
|
||||
|
||||
case SyntaxKind.VariableStatement:
|
||||
return shouldEmitLeadingAndTrailingCommentsForVariableStatement(<VariableStatement>node);
|
||||
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
// Only emit the leading/trailing comments for a module if we're actually
|
||||
// emitting the module as well.
|
||||
|
||||
@@ -8,7 +8,7 @@ module ts {
|
||||
/* @internal */ export let ioWriteTime = 0;
|
||||
|
||||
/** The version of the TypeScript compiler release */
|
||||
export const version = "1.5.0";
|
||||
export const version = "1.5.2";
|
||||
|
||||
const carriageReturnLineFeed = "\r\n";
|
||||
const lineFeed = "\n";
|
||||
|
||||
@@ -35,9 +35,9 @@ class FourSlashRunner extends RunnerBase {
|
||||
this.tests = this.enumerateFiles(this.basePath, /\.ts/i, { recursive: false });
|
||||
}
|
||||
|
||||
describe(this.testSuiteName, () => {
|
||||
this.tests.forEach((fn: string) => {
|
||||
fn = ts.normalizeSlashes(fn);
|
||||
describe(fn, () => {
|
||||
fn = ts.normalizeSlashes(fn);
|
||||
var justName = fn.replace(/^.*[\\\/]/, '');
|
||||
|
||||
// Convert to relative path
|
||||
|
||||
@@ -45,10 +45,12 @@ module Utils {
|
||||
export function getExecutionEnvironment() {
|
||||
if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") {
|
||||
return ExecutionEnvironment.CScript;
|
||||
} else if (typeof window !== "undefined") {
|
||||
}
|
||||
else if (typeof window !== "undefined") {
|
||||
return ExecutionEnvironment.Browser;
|
||||
} else {
|
||||
return ExecutionEnvironment.Node;
|
||||
}
|
||||
else {
|
||||
return ExecutionEnvironment.Node;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -945,6 +947,7 @@ module Harness {
|
||||
options = options || { noResolve: false };
|
||||
options.target = options.target || ts.ScriptTarget.ES3;
|
||||
options.module = options.module || ts.ModuleKind.None;
|
||||
options.newLine = options.newLine || ts.NewLineKind.CarriageReturnLineFeed;
|
||||
options.noErrorTruncation = true;
|
||||
|
||||
if (settingsCallback) {
|
||||
|
||||
+70
-38
@@ -1829,7 +1829,34 @@ module ts {
|
||||
if (version !== sourceFile.version) {
|
||||
// Once incremental parsing is ready, then just call into this function.
|
||||
if (!disableIncrementalParsing) {
|
||||
let newSourceFile = updateSourceFile(sourceFile, scriptSnapshot.getText(0, scriptSnapshot.getLength()), textChangeRange, aggressiveChecks);
|
||||
let newText: string;
|
||||
|
||||
// grab the fragment from the beginning of the original text to the beginning of the span
|
||||
let prefix = textChangeRange.span.start !== 0
|
||||
? sourceFile.text.substr(0, textChangeRange.span.start)
|
||||
: "";
|
||||
|
||||
// grab the fragment from the end of the span till the end of the original text
|
||||
let suffix = textSpanEnd(textChangeRange.span) !== sourceFile.text.length
|
||||
? sourceFile.text.substr(textSpanEnd(textChangeRange.span))
|
||||
: "";
|
||||
|
||||
if (textChangeRange.newLength === 0) {
|
||||
// edit was a deletion - just combine prefix and suffix
|
||||
newText = prefix && suffix ? prefix + suffix : prefix || suffix;
|
||||
}
|
||||
else {
|
||||
// it was actual edit, fetch the fragment of new text that correspond to new span
|
||||
let changedText = scriptSnapshot.getText(textChangeRange.span.start, textChangeRange.span.start + textChangeRange.newLength);
|
||||
// combine prefix, changed text and suffix
|
||||
newText = prefix && suffix
|
||||
? prefix + changedText + suffix
|
||||
: prefix
|
||||
? (prefix + changedText)
|
||||
: (changedText + suffix);
|
||||
}
|
||||
|
||||
let newSourceFile = updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks);
|
||||
setSourceFileFields(newSourceFile, scriptSnapshot, version);
|
||||
// after incremental parsing nameTable might not be up-to-date
|
||||
// drop it so it can be lazily recreated later
|
||||
@@ -3039,46 +3066,47 @@ module ts {
|
||||
let containingNodeKind = previousToken.parent.kind;
|
||||
switch (previousToken.kind) {
|
||||
case SyntaxKind.CommaToken:
|
||||
return containingNodeKind === SyntaxKind.CallExpression // func( a, |
|
||||
|| containingNodeKind === SyntaxKind.Constructor // constructor( a, | public, protected, private keywords are allowed here, so show completion
|
||||
|| containingNodeKind === SyntaxKind.NewExpression // new C(a, |
|
||||
|| containingNodeKind === SyntaxKind.ArrayLiteralExpression // [a, |
|
||||
|| containingNodeKind === SyntaxKind.BinaryExpression; // let x = (a, |
|
||||
return containingNodeKind === SyntaxKind.CallExpression // func( a, |
|
||||
|| containingNodeKind === SyntaxKind.Constructor // constructor( a, | public, protected, private keywords are allowed here, so show completion
|
||||
|| containingNodeKind === SyntaxKind.NewExpression // new C(a, |
|
||||
|| containingNodeKind === SyntaxKind.ArrayLiteralExpression // [a, |
|
||||
|| containingNodeKind === SyntaxKind.BinaryExpression // let x = (a, |
|
||||
|| containingNodeKind === SyntaxKind.FunctionType; // var x: (s: string, list|
|
||||
|
||||
|
||||
case SyntaxKind.OpenParenToken:
|
||||
return containingNodeKind === SyntaxKind.CallExpression // func( |
|
||||
|| containingNodeKind === SyntaxKind.Constructor // constructor( |
|
||||
|| containingNodeKind === SyntaxKind.NewExpression // new C(a|
|
||||
|| containingNodeKind === SyntaxKind.ParenthesizedExpression; // let x = (a|
|
||||
|| containingNodeKind === SyntaxKind.ParenthesizedExpression // let x = (a|
|
||||
|| containingNodeKind === SyntaxKind.ParenthesizedType; // function F(pred: (a| this can become an arrow function, where 'a' is the argument
|
||||
|
||||
case SyntaxKind.OpenBracketToken:
|
||||
return containingNodeKind === SyntaxKind.ArrayLiteralExpression; // [ |
|
||||
return containingNodeKind === SyntaxKind.ArrayLiteralExpression; // [ |
|
||||
|
||||
case SyntaxKind.ModuleKeyword: // module |
|
||||
case SyntaxKind.NamespaceKeyword: // namespace |
|
||||
case SyntaxKind.ModuleKeyword: // module |
|
||||
case SyntaxKind.NamespaceKeyword: // namespace |
|
||||
return true;
|
||||
|
||||
case SyntaxKind.DotToken:
|
||||
return containingNodeKind === SyntaxKind.ModuleDeclaration; // module A.|
|
||||
return containingNodeKind === SyntaxKind.ModuleDeclaration; // module A.|
|
||||
|
||||
case SyntaxKind.OpenBraceToken:
|
||||
return containingNodeKind === SyntaxKind.ClassDeclaration; // class A{ |
|
||||
return containingNodeKind === SyntaxKind.ClassDeclaration; // class A{ |
|
||||
|
||||
case SyntaxKind.EqualsToken:
|
||||
return containingNodeKind === SyntaxKind.VariableDeclaration // let x = a|
|
||||
|| containingNodeKind === SyntaxKind.BinaryExpression; // x = a|
|
||||
return containingNodeKind === SyntaxKind.VariableDeclaration // let x = a|
|
||||
|| containingNodeKind === SyntaxKind.BinaryExpression; // x = a|
|
||||
|
||||
case SyntaxKind.TemplateHead:
|
||||
return containingNodeKind === SyntaxKind.TemplateExpression; // `aa ${|
|
||||
return containingNodeKind === SyntaxKind.TemplateExpression; // `aa ${|
|
||||
|
||||
case SyntaxKind.TemplateMiddle:
|
||||
return containingNodeKind === SyntaxKind.TemplateSpan; // `aa ${10} dd ${|
|
||||
return containingNodeKind === SyntaxKind.TemplateSpan; // `aa ${10} dd ${|
|
||||
|
||||
case SyntaxKind.PublicKeyword:
|
||||
case SyntaxKind.PrivateKeyword:
|
||||
case SyntaxKind.ProtectedKeyword:
|
||||
return containingNodeKind === SyntaxKind.PropertyDeclaration; // class A{ public |
|
||||
return containingNodeKind === SyntaxKind.PropertyDeclaration; // class A{ public |
|
||||
}
|
||||
|
||||
// Previous token may have been a keyword that was converted to an identifier.
|
||||
@@ -3157,40 +3185,43 @@ module ts {
|
||||
return containingNodeKind === SyntaxKind.VariableDeclaration ||
|
||||
containingNodeKind === SyntaxKind.VariableDeclarationList ||
|
||||
containingNodeKind === SyntaxKind.VariableStatement ||
|
||||
containingNodeKind === SyntaxKind.EnumDeclaration || // enum a { foo, |
|
||||
containingNodeKind === SyntaxKind.EnumDeclaration || // enum a { foo, |
|
||||
isFunction(containingNodeKind) ||
|
||||
containingNodeKind === SyntaxKind.ClassDeclaration || // class A<T, |
|
||||
containingNodeKind === SyntaxKind.FunctionDeclaration || // function A<T, |
|
||||
containingNodeKind === SyntaxKind.InterfaceDeclaration || // interface A<T, |
|
||||
containingNodeKind === SyntaxKind.ArrayBindingPattern || // var [x, y|
|
||||
containingNodeKind === SyntaxKind.ObjectBindingPattern; // function func({ x, y|
|
||||
|
||||
containingNodeKind === SyntaxKind.ClassDeclaration || // class A<T, |
|
||||
containingNodeKind === SyntaxKind.FunctionDeclaration || // function A<T, |
|
||||
containingNodeKind === SyntaxKind.InterfaceDeclaration || // interface A<T, |
|
||||
containingNodeKind === SyntaxKind.ArrayBindingPattern || // var [x, y|
|
||||
containingNodeKind === SyntaxKind.ObjectBindingPattern; // function func({ x, y|
|
||||
|
||||
case SyntaxKind.DotToken:
|
||||
return containingNodeKind === SyntaxKind.ArrayBindingPattern; // var [.|
|
||||
|
||||
return containingNodeKind === SyntaxKind.ArrayBindingPattern; // var [.|
|
||||
|
||||
case SyntaxKind.ColonToken:
|
||||
return containingNodeKind === SyntaxKind.BindingElement; // var {x :html|
|
||||
|
||||
case SyntaxKind.OpenBracketToken:
|
||||
return containingNodeKind === SyntaxKind.ArrayBindingPattern; // var [x|
|
||||
|
||||
return containingNodeKind === SyntaxKind.ArrayBindingPattern; // var [x|
|
||||
|
||||
case SyntaxKind.OpenParenToken:
|
||||
return containingNodeKind === SyntaxKind.CatchClause ||
|
||||
isFunction(containingNodeKind);
|
||||
|
||||
case SyntaxKind.OpenBraceToken:
|
||||
return containingNodeKind === SyntaxKind.EnumDeclaration || // enum a { |
|
||||
containingNodeKind === SyntaxKind.InterfaceDeclaration || // interface a { |
|
||||
containingNodeKind === SyntaxKind.TypeLiteral || // let x : { |
|
||||
containingNodeKind === SyntaxKind.ObjectBindingPattern; // function func({ x|
|
||||
return containingNodeKind === SyntaxKind.EnumDeclaration || // enum a { |
|
||||
containingNodeKind === SyntaxKind.InterfaceDeclaration || // interface a { |
|
||||
containingNodeKind === SyntaxKind.TypeLiteral || // let x : { |
|
||||
containingNodeKind === SyntaxKind.ObjectBindingPattern; // function func({ x|
|
||||
|
||||
case SyntaxKind.SemicolonToken:
|
||||
return containingNodeKind === SyntaxKind.PropertySignature &&
|
||||
previousToken.parent && previousToken.parent.parent &&
|
||||
(previousToken.parent.parent.kind === SyntaxKind.InterfaceDeclaration || // interface a { f; |
|
||||
previousToken.parent.parent.kind === SyntaxKind.TypeLiteral); // let x : { a; |
|
||||
previousToken.parent.parent.kind === SyntaxKind.TypeLiteral); // let x : { a; |
|
||||
|
||||
case SyntaxKind.LessThanToken:
|
||||
return containingNodeKind === SyntaxKind.ClassDeclaration || // class A< |
|
||||
containingNodeKind === SyntaxKind.FunctionDeclaration || // function A< |
|
||||
containingNodeKind === SyntaxKind.InterfaceDeclaration || // interface A< |
|
||||
return containingNodeKind === SyntaxKind.ClassDeclaration || // class A< |
|
||||
containingNodeKind === SyntaxKind.FunctionDeclaration || // function A< |
|
||||
containingNodeKind === SyntaxKind.InterfaceDeclaration || // interface A< |
|
||||
isFunction(containingNodeKind);
|
||||
|
||||
case SyntaxKind.StaticKeyword:
|
||||
@@ -3200,7 +3231,7 @@ module ts {
|
||||
return containingNodeKind === SyntaxKind.Parameter ||
|
||||
containingNodeKind === SyntaxKind.Constructor ||
|
||||
(previousToken.parent && previousToken.parent.parent &&
|
||||
previousToken.parent.parent.kind === SyntaxKind.ArrayBindingPattern); // var [ ...z|
|
||||
previousToken.parent.parent.kind === SyntaxKind.ArrayBindingPattern); // var [...z|
|
||||
|
||||
case SyntaxKind.PublicKeyword:
|
||||
case SyntaxKind.PrivateKeyword:
|
||||
@@ -3218,6 +3249,7 @@ module ts {
|
||||
case SyntaxKind.LetKeyword:
|
||||
case SyntaxKind.ConstKeyword:
|
||||
case SyntaxKind.YieldKeyword:
|
||||
case SyntaxKind.TypeKeyword: // type htm|
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
-1
@@ -16,6 +16,5 @@ var A;
|
||||
}
|
||||
return B;
|
||||
})();
|
||||
A.beez;
|
||||
A.beez2 = new Array();
|
||||
})(A || (A = {}));
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
tests/cases/conformance/internalModules/exportDeclarations/NonInitializedExportInInternalModule.ts(3,8): error TS1123: Variable declaration list cannot be empty.
|
||||
tests/cases/conformance/internalModules/exportDeclarations/NonInitializedExportInInternalModule.ts(4,5): error TS2304: Cannot find name 'let'.
|
||||
tests/cases/conformance/internalModules/exportDeclarations/NonInitializedExportInInternalModule.ts(5,10): error TS1123: Variable declaration list cannot be empty.
|
||||
|
||||
|
||||
==== tests/cases/conformance/internalModules/exportDeclarations/NonInitializedExportInInternalModule.ts (3 errors) ====
|
||||
|
||||
module Inner {
|
||||
var;
|
||||
|
||||
!!! error TS1123: Variable declaration list cannot be empty.
|
||||
let;
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'let'.
|
||||
const;
|
||||
|
||||
!!! error TS1123: Variable declaration list cannot be empty.
|
||||
|
||||
export var a;
|
||||
export let b;
|
||||
export var c: string;
|
||||
export let d: number;
|
||||
class A {}
|
||||
export var e: A;
|
||||
export let f: A;
|
||||
|
||||
namespace B {
|
||||
export let a = 1, b, c = 2;
|
||||
export let x, y, z;
|
||||
}
|
||||
|
||||
module C {
|
||||
export var a = 1, b, c = 2;
|
||||
export var x, y, z;
|
||||
}
|
||||
|
||||
// Shouldn't be filtered
|
||||
export var a1 = 1;
|
||||
export let b1 = 1;
|
||||
export var c1: string = 'a';
|
||||
export let d1: number = 1;
|
||||
class D {}
|
||||
export var e1 = new D;
|
||||
export let f1 = new D;
|
||||
export var g1: D = new D;
|
||||
export let h1: D = new D;
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
//// [NonInitializedExportInInternalModule.ts]
|
||||
|
||||
module Inner {
|
||||
var;
|
||||
let;
|
||||
const;
|
||||
|
||||
export var a;
|
||||
export let b;
|
||||
export var c: string;
|
||||
export let d: number;
|
||||
class A {}
|
||||
export var e: A;
|
||||
export let f: A;
|
||||
|
||||
namespace B {
|
||||
export let a = 1, b, c = 2;
|
||||
export let x, y, z;
|
||||
}
|
||||
|
||||
module C {
|
||||
export var a = 1, b, c = 2;
|
||||
export var x, y, z;
|
||||
}
|
||||
|
||||
// Shouldn't be filtered
|
||||
export var a1 = 1;
|
||||
export let b1 = 1;
|
||||
export var c1: string = 'a';
|
||||
export let d1: number = 1;
|
||||
class D {}
|
||||
export var e1 = new D;
|
||||
export let f1 = new D;
|
||||
export var g1: D = new D;
|
||||
export let h1: D = new D;
|
||||
}
|
||||
|
||||
//// [NonInitializedExportInInternalModule.js]
|
||||
var Inner;
|
||||
(function (Inner) {
|
||||
var ;
|
||||
let;
|
||||
var ;
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
return A;
|
||||
})();
|
||||
var B;
|
||||
(function (B) {
|
||||
B.a = 1, B.c = 2;
|
||||
})(B || (B = {}));
|
||||
var C;
|
||||
(function (C) {
|
||||
C.a = 1, C.c = 2;
|
||||
})(C || (C = {}));
|
||||
// Shouldn't be filtered
|
||||
Inner.a1 = 1;
|
||||
Inner.b1 = 1;
|
||||
Inner.c1 = 'a';
|
||||
Inner.d1 = 1;
|
||||
var D = (function () {
|
||||
function D() {
|
||||
}
|
||||
return D;
|
||||
})();
|
||||
Inner.e1 = new D;
|
||||
Inner.f1 = new D;
|
||||
Inner.g1 = new D;
|
||||
Inner.h1 = new D;
|
||||
})(Inner || (Inner = {}));
|
||||
-2
@@ -39,14 +39,12 @@ var A;
|
||||
(function (A) {
|
||||
var B;
|
||||
(function (B) {
|
||||
B.x;
|
||||
})(B = A.B || (A.B = {}));
|
||||
})(A || (A = {}));
|
||||
var A;
|
||||
(function (A) {
|
||||
var B;
|
||||
(function (B) {
|
||||
B.x;
|
||||
})(B || (B = {}));
|
||||
})(A || (A = {}));
|
||||
// ensure the right var decl is exported
|
||||
|
||||
@@ -55,7 +55,6 @@ var E;
|
||||
})(E || (E = {}));
|
||||
var M;
|
||||
(function (M) {
|
||||
M.a;
|
||||
})(M || (M = {}));
|
||||
var a;
|
||||
var b;
|
||||
|
||||
@@ -56,7 +56,6 @@ var E;
|
||||
})(E || (E = {}));
|
||||
var M;
|
||||
(function (M) {
|
||||
M.a;
|
||||
})(M || (M = {}));
|
||||
var a;
|
||||
var b;
|
||||
|
||||
@@ -19,7 +19,6 @@ export var a = function () {
|
||||
|
||||
|
||||
//// [aliasUsedAsNameValue_0.js]
|
||||
exports.id;
|
||||
//// [aliasUsedAsNameValue_1.js]
|
||||
function b(a) { return null; }
|
||||
exports.b = b;
|
||||
|
||||
@@ -19,7 +19,6 @@ var __test1__;
|
||||
})(__test1__ || (__test1__ = {}));
|
||||
var __test2__;
|
||||
(function (__test2__) {
|
||||
__test2__.aa;
|
||||
;
|
||||
__test2__.__val__aa = __test2__.aa;
|
||||
})(__test2__ || (__test2__ = {}));
|
||||
|
||||
@@ -19,7 +19,6 @@ var __test1__;
|
||||
})(__test1__ || (__test1__ = {}));
|
||||
var __test2__;
|
||||
(function (__test2__) {
|
||||
__test2__.aa;
|
||||
;
|
||||
__test2__.__val__aa = __test2__.aa;
|
||||
})(__test2__ || (__test2__ = {}));
|
||||
|
||||
@@ -19,7 +19,6 @@ var __test1__;
|
||||
})(__test1__ || (__test1__ = {}));
|
||||
var __test2__;
|
||||
(function (__test2__) {
|
||||
__test2__.aa;
|
||||
;
|
||||
__test2__.__val__aa = __test2__.aa;
|
||||
})(__test2__ || (__test2__ = {}));
|
||||
|
||||
@@ -19,7 +19,6 @@ var __test1__;
|
||||
})(__test1__ || (__test1__ = {}));
|
||||
var __test2__;
|
||||
(function (__test2__) {
|
||||
__test2__.aa;
|
||||
;
|
||||
__test2__.__val__aa = __test2__.aa;
|
||||
})(__test2__ || (__test2__ = {}));
|
||||
|
||||
@@ -19,7 +19,6 @@ var __test1__;
|
||||
})(__test1__ || (__test1__ = {}));
|
||||
var __test2__;
|
||||
(function (__test2__) {
|
||||
__test2__.aa;
|
||||
;
|
||||
__test2__.__val__aa = __test2__.aa;
|
||||
})(__test2__ || (__test2__ = {}));
|
||||
|
||||
@@ -19,7 +19,6 @@ var __test1__;
|
||||
})(__test1__ || (__test1__ = {}));
|
||||
var __test2__;
|
||||
(function (__test2__) {
|
||||
__test2__.aa;
|
||||
;
|
||||
__test2__.__val__aa = __test2__.aa;
|
||||
})(__test2__ || (__test2__ = {}));
|
||||
|
||||
@@ -19,7 +19,6 @@ var __test1__;
|
||||
})(__test1__ || (__test1__ = {}));
|
||||
var __test2__;
|
||||
(function (__test2__) {
|
||||
__test2__.aa;
|
||||
;
|
||||
__test2__.__val__aa = __test2__.aa;
|
||||
})(__test2__ || (__test2__ = {}));
|
||||
|
||||
@@ -19,7 +19,6 @@ var __test1__;
|
||||
})(__test1__ || (__test1__ = {}));
|
||||
var __test2__;
|
||||
(function (__test2__) {
|
||||
__test2__.aa;
|
||||
;
|
||||
__test2__.__val__aa = __test2__.aa;
|
||||
})(__test2__ || (__test2__ = {}));
|
||||
|
||||
@@ -19,7 +19,6 @@ var __test1__;
|
||||
})(__test1__ || (__test1__ = {}));
|
||||
var __test2__;
|
||||
(function (__test2__) {
|
||||
__test2__.aa;
|
||||
;
|
||||
__test2__.__val__aa = __test2__.aa;
|
||||
})(__test2__ || (__test2__ = {}));
|
||||
|
||||
@@ -19,7 +19,6 @@ var __test1__;
|
||||
})(__test1__ || (__test1__ = {}));
|
||||
var __test2__;
|
||||
(function (__test2__) {
|
||||
__test2__.obj;
|
||||
__test2__.__val__obj = __test2__.obj;
|
||||
})(__test2__ || (__test2__ = {}));
|
||||
__test2__.__val__obj = __test1__.__val__obj4;
|
||||
|
||||
@@ -19,7 +19,6 @@ var __test1__;
|
||||
})(__test1__ || (__test1__ = {}));
|
||||
var __test2__;
|
||||
(function (__test2__) {
|
||||
__test2__.obj;
|
||||
__test2__.__val__obj = __test2__.obj;
|
||||
})(__test2__ || (__test2__ = {}));
|
||||
__test2__.__val__obj = __test1__.__val__obj4;
|
||||
|
||||
@@ -19,7 +19,6 @@ var __test1__;
|
||||
})(__test1__ || (__test1__ = {}));
|
||||
var __test2__;
|
||||
(function (__test2__) {
|
||||
__test2__.aa;
|
||||
;
|
||||
__test2__.__val__aa = __test2__.aa;
|
||||
})(__test2__ || (__test2__ = {}));
|
||||
|
||||
@@ -19,7 +19,6 @@ var __test1__;
|
||||
})(__test1__ || (__test1__ = {}));
|
||||
var __test2__;
|
||||
(function (__test2__) {
|
||||
__test2__.aa;
|
||||
;
|
||||
__test2__.__val__aa = __test2__.aa;
|
||||
})(__test2__ || (__test2__ = {}));
|
||||
|
||||
@@ -19,7 +19,6 @@ var __test1__;
|
||||
})(__test1__ || (__test1__ = {}));
|
||||
var __test2__;
|
||||
(function (__test2__) {
|
||||
__test2__.aa;
|
||||
;
|
||||
__test2__.__val__aa = __test2__.aa;
|
||||
})(__test2__ || (__test2__ = {}));
|
||||
|
||||
@@ -19,7 +19,6 @@ var __test1__;
|
||||
})(__test1__ || (__test1__ = {}));
|
||||
var __test2__;
|
||||
(function (__test2__) {
|
||||
__test2__.aa;
|
||||
;
|
||||
__test2__.__val__aa = __test2__.aa;
|
||||
})(__test2__ || (__test2__ = {}));
|
||||
|
||||
@@ -19,7 +19,6 @@ var __test1__;
|
||||
})(__test1__ || (__test1__ = {}));
|
||||
var __test2__;
|
||||
(function (__test2__) {
|
||||
__test2__.aa;
|
||||
;
|
||||
__test2__.__val__aa = __test2__.aa;
|
||||
})(__test2__ || (__test2__ = {}));
|
||||
|
||||
@@ -93,7 +93,6 @@ this = value;
|
||||
// identifiers: module, class, enum, function
|
||||
var M;
|
||||
(function (M) {
|
||||
M.a;
|
||||
})(M || (M = {}));
|
||||
M = value;
|
||||
C = value;
|
||||
|
||||
@@ -79,7 +79,6 @@ x = ''; // Error
|
||||
(x) = ''; // Error
|
||||
var M;
|
||||
(function (M) {
|
||||
M.y;
|
||||
})(M || (M = {}));
|
||||
M.y = 3; // OK
|
||||
(M).y = 3; // OK
|
||||
@@ -93,7 +92,6 @@ var M2;
|
||||
(function (M2) {
|
||||
var M3;
|
||||
(function (M3) {
|
||||
M3.x;
|
||||
})(M3 = M2.M3 || (M2.M3 = {}));
|
||||
M3 = { x: 3 }; // Error
|
||||
})(M2 || (M2 = {}));
|
||||
|
||||
@@ -84,7 +84,6 @@ var A = (function () {
|
||||
})();
|
||||
var M;
|
||||
(function (M) {
|
||||
M.n;
|
||||
})(M || (M = {}));
|
||||
var objA = new A();
|
||||
// any other type var
|
||||
|
||||
@@ -50,7 +50,6 @@ var A = (function () {
|
||||
})();
|
||||
var M;
|
||||
(function (M) {
|
||||
M.n;
|
||||
})(M || (M = {}));
|
||||
var objA = new A();
|
||||
// boolean type var
|
||||
|
||||
@@ -57,7 +57,6 @@ var A = (function () {
|
||||
})();
|
||||
var M;
|
||||
(function (M) {
|
||||
M.n;
|
||||
})(M || (M = {}));
|
||||
var objA = new A();
|
||||
// number type var
|
||||
|
||||
@@ -56,7 +56,6 @@ var A = (function () {
|
||||
})();
|
||||
var M;
|
||||
(function (M) {
|
||||
M.n;
|
||||
})(M || (M = {}));
|
||||
var objA = new A();
|
||||
// string type var
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
tests/cases/conformance/expressions/functionCalls/callWithSpread.ts(52,21): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/expressions/functionCalls/callWithSpread.ts (1 errors) ====
|
||||
interface X {
|
||||
foo(x: number, y: number, ...z: string[]);
|
||||
}
|
||||
|
||||
function foo(x: number, y: number, ...z: string[]) {
|
||||
}
|
||||
|
||||
var a: string[];
|
||||
var z: number[];
|
||||
var obj: X;
|
||||
var xa: X[];
|
||||
|
||||
foo(1, 2, "abc");
|
||||
foo(1, 2, ...a);
|
||||
foo(1, 2, ...a, "abc");
|
||||
|
||||
obj.foo(1, 2, "abc");
|
||||
obj.foo(1, 2, ...a);
|
||||
obj.foo(1, 2, ...a, "abc");
|
||||
|
||||
(obj.foo)(1, 2, "abc");
|
||||
(obj.foo)(1, 2, ...a);
|
||||
(obj.foo)(1, 2, ...a, "abc");
|
||||
|
||||
xa[1].foo(1, 2, "abc");
|
||||
xa[1].foo(1, 2, ...a);
|
||||
xa[1].foo(1, 2, ...a, "abc");
|
||||
|
||||
(<Function>xa[1].foo)(...[1, 2, "abc"]);
|
||||
|
||||
class C {
|
||||
constructor(x: number, y: number, ...z: string[]) {
|
||||
this.foo(x, y);
|
||||
this.foo(x, y, ...z);
|
||||
}
|
||||
foo(x: number, y: number, ...z: string[]) {
|
||||
}
|
||||
}
|
||||
|
||||
class D extends C {
|
||||
constructor() {
|
||||
super(1, 2);
|
||||
super(1, 2, ...a);
|
||||
}
|
||||
foo() {
|
||||
super.foo(1, 2);
|
||||
super.foo(1, 2, ...a);
|
||||
}
|
||||
}
|
||||
|
||||
// Only supported in when target is ES6
|
||||
var c = new C(1, 2, ...a);
|
||||
~~~~
|
||||
!!! error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
@@ -48,9 +48,6 @@ class D extends C {
|
||||
super.foo(1, 2, ...a);
|
||||
}
|
||||
}
|
||||
|
||||
// Only supported in when target is ES6
|
||||
var c = new C(1, 2, ...a);
|
||||
|
||||
|
||||
//// [callWithSpread.js]
|
||||
@@ -112,6 +109,4 @@ var D = (function (_super) {
|
||||
};
|
||||
return D;
|
||||
})(C);
|
||||
// Only supported in when target is ES6
|
||||
var c = new C(1, 2, ...a);
|
||||
var _a, _b, _c;
|
||||
|
||||
@@ -0,0 +1,159 @@
|
||||
=== tests/cases/conformance/expressions/functionCalls/callWithSpread.ts ===
|
||||
interface X {
|
||||
>X : Symbol(X, Decl(callWithSpread.ts, 0, 0))
|
||||
|
||||
foo(x: number, y: number, ...z: string[]);
|
||||
>foo : Symbol(foo, Decl(callWithSpread.ts, 0, 13))
|
||||
>x : Symbol(x, Decl(callWithSpread.ts, 1, 8))
|
||||
>y : Symbol(y, Decl(callWithSpread.ts, 1, 18))
|
||||
>z : Symbol(z, Decl(callWithSpread.ts, 1, 29))
|
||||
}
|
||||
|
||||
function foo(x: number, y: number, ...z: string[]) {
|
||||
>foo : Symbol(foo, Decl(callWithSpread.ts, 2, 1))
|
||||
>x : Symbol(x, Decl(callWithSpread.ts, 4, 13))
|
||||
>y : Symbol(y, Decl(callWithSpread.ts, 4, 23))
|
||||
>z : Symbol(z, Decl(callWithSpread.ts, 4, 34))
|
||||
}
|
||||
|
||||
var a: string[];
|
||||
>a : Symbol(a, Decl(callWithSpread.ts, 7, 3))
|
||||
|
||||
var z: number[];
|
||||
>z : Symbol(z, Decl(callWithSpread.ts, 8, 3))
|
||||
|
||||
var obj: X;
|
||||
>obj : Symbol(obj, Decl(callWithSpread.ts, 9, 3))
|
||||
>X : Symbol(X, Decl(callWithSpread.ts, 0, 0))
|
||||
|
||||
var xa: X[];
|
||||
>xa : Symbol(xa, Decl(callWithSpread.ts, 10, 3))
|
||||
>X : Symbol(X, Decl(callWithSpread.ts, 0, 0))
|
||||
|
||||
foo(1, 2, "abc");
|
||||
>foo : Symbol(foo, Decl(callWithSpread.ts, 2, 1))
|
||||
|
||||
foo(1, 2, ...a);
|
||||
>foo : Symbol(foo, Decl(callWithSpread.ts, 2, 1))
|
||||
>a : Symbol(a, Decl(callWithSpread.ts, 7, 3))
|
||||
|
||||
foo(1, 2, ...a, "abc");
|
||||
>foo : Symbol(foo, Decl(callWithSpread.ts, 2, 1))
|
||||
>a : Symbol(a, Decl(callWithSpread.ts, 7, 3))
|
||||
|
||||
obj.foo(1, 2, "abc");
|
||||
>obj.foo : Symbol(X.foo, Decl(callWithSpread.ts, 0, 13))
|
||||
>obj : Symbol(obj, Decl(callWithSpread.ts, 9, 3))
|
||||
>foo : Symbol(X.foo, Decl(callWithSpread.ts, 0, 13))
|
||||
|
||||
obj.foo(1, 2, ...a);
|
||||
>obj.foo : Symbol(X.foo, Decl(callWithSpread.ts, 0, 13))
|
||||
>obj : Symbol(obj, Decl(callWithSpread.ts, 9, 3))
|
||||
>foo : Symbol(X.foo, Decl(callWithSpread.ts, 0, 13))
|
||||
>a : Symbol(a, Decl(callWithSpread.ts, 7, 3))
|
||||
|
||||
obj.foo(1, 2, ...a, "abc");
|
||||
>obj.foo : Symbol(X.foo, Decl(callWithSpread.ts, 0, 13))
|
||||
>obj : Symbol(obj, Decl(callWithSpread.ts, 9, 3))
|
||||
>foo : Symbol(X.foo, Decl(callWithSpread.ts, 0, 13))
|
||||
>a : Symbol(a, Decl(callWithSpread.ts, 7, 3))
|
||||
|
||||
(obj.foo)(1, 2, "abc");
|
||||
>obj.foo : Symbol(X.foo, Decl(callWithSpread.ts, 0, 13))
|
||||
>obj : Symbol(obj, Decl(callWithSpread.ts, 9, 3))
|
||||
>foo : Symbol(X.foo, Decl(callWithSpread.ts, 0, 13))
|
||||
|
||||
(obj.foo)(1, 2, ...a);
|
||||
>obj.foo : Symbol(X.foo, Decl(callWithSpread.ts, 0, 13))
|
||||
>obj : Symbol(obj, Decl(callWithSpread.ts, 9, 3))
|
||||
>foo : Symbol(X.foo, Decl(callWithSpread.ts, 0, 13))
|
||||
>a : Symbol(a, Decl(callWithSpread.ts, 7, 3))
|
||||
|
||||
(obj.foo)(1, 2, ...a, "abc");
|
||||
>obj.foo : Symbol(X.foo, Decl(callWithSpread.ts, 0, 13))
|
||||
>obj : Symbol(obj, Decl(callWithSpread.ts, 9, 3))
|
||||
>foo : Symbol(X.foo, Decl(callWithSpread.ts, 0, 13))
|
||||
>a : Symbol(a, Decl(callWithSpread.ts, 7, 3))
|
||||
|
||||
xa[1].foo(1, 2, "abc");
|
||||
>xa[1].foo : Symbol(X.foo, Decl(callWithSpread.ts, 0, 13))
|
||||
>xa : Symbol(xa, Decl(callWithSpread.ts, 10, 3))
|
||||
>foo : Symbol(X.foo, Decl(callWithSpread.ts, 0, 13))
|
||||
|
||||
xa[1].foo(1, 2, ...a);
|
||||
>xa[1].foo : Symbol(X.foo, Decl(callWithSpread.ts, 0, 13))
|
||||
>xa : Symbol(xa, Decl(callWithSpread.ts, 10, 3))
|
||||
>foo : Symbol(X.foo, Decl(callWithSpread.ts, 0, 13))
|
||||
>a : Symbol(a, Decl(callWithSpread.ts, 7, 3))
|
||||
|
||||
xa[1].foo(1, 2, ...a, "abc");
|
||||
>xa[1].foo : Symbol(X.foo, Decl(callWithSpread.ts, 0, 13))
|
||||
>xa : Symbol(xa, Decl(callWithSpread.ts, 10, 3))
|
||||
>foo : Symbol(X.foo, Decl(callWithSpread.ts, 0, 13))
|
||||
>a : Symbol(a, Decl(callWithSpread.ts, 7, 3))
|
||||
|
||||
(<Function>xa[1].foo)(...[1, 2, "abc"]);
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, 223, 38), Decl(lib.d.ts, 269, 11))
|
||||
>xa[1].foo : Symbol(X.foo, Decl(callWithSpread.ts, 0, 13))
|
||||
>xa : Symbol(xa, Decl(callWithSpread.ts, 10, 3))
|
||||
>foo : Symbol(X.foo, Decl(callWithSpread.ts, 0, 13))
|
||||
|
||||
class C {
|
||||
>C : Symbol(C, Decl(callWithSpread.ts, 28, 40))
|
||||
|
||||
constructor(x: number, y: number, ...z: string[]) {
|
||||
>x : Symbol(x, Decl(callWithSpread.ts, 31, 16))
|
||||
>y : Symbol(y, Decl(callWithSpread.ts, 31, 26))
|
||||
>z : Symbol(z, Decl(callWithSpread.ts, 31, 37))
|
||||
|
||||
this.foo(x, y);
|
||||
>this.foo : Symbol(foo, Decl(callWithSpread.ts, 34, 5))
|
||||
>this : Symbol(C, Decl(callWithSpread.ts, 28, 40))
|
||||
>foo : Symbol(foo, Decl(callWithSpread.ts, 34, 5))
|
||||
>x : Symbol(x, Decl(callWithSpread.ts, 31, 16))
|
||||
>y : Symbol(y, Decl(callWithSpread.ts, 31, 26))
|
||||
|
||||
this.foo(x, y, ...z);
|
||||
>this.foo : Symbol(foo, Decl(callWithSpread.ts, 34, 5))
|
||||
>this : Symbol(C, Decl(callWithSpread.ts, 28, 40))
|
||||
>foo : Symbol(foo, Decl(callWithSpread.ts, 34, 5))
|
||||
>x : Symbol(x, Decl(callWithSpread.ts, 31, 16))
|
||||
>y : Symbol(y, Decl(callWithSpread.ts, 31, 26))
|
||||
>z : Symbol(z, Decl(callWithSpread.ts, 31, 37))
|
||||
}
|
||||
foo(x: number, y: number, ...z: string[]) {
|
||||
>foo : Symbol(foo, Decl(callWithSpread.ts, 34, 5))
|
||||
>x : Symbol(x, Decl(callWithSpread.ts, 35, 8))
|
||||
>y : Symbol(y, Decl(callWithSpread.ts, 35, 18))
|
||||
>z : Symbol(z, Decl(callWithSpread.ts, 35, 29))
|
||||
}
|
||||
}
|
||||
|
||||
class D extends C {
|
||||
>D : Symbol(D, Decl(callWithSpread.ts, 37, 1))
|
||||
>C : Symbol(C, Decl(callWithSpread.ts, 28, 40))
|
||||
|
||||
constructor() {
|
||||
super(1, 2);
|
||||
>super : Symbol(C, Decl(callWithSpread.ts, 28, 40))
|
||||
|
||||
super(1, 2, ...a);
|
||||
>super : Symbol(C, Decl(callWithSpread.ts, 28, 40))
|
||||
>a : Symbol(a, Decl(callWithSpread.ts, 7, 3))
|
||||
}
|
||||
foo() {
|
||||
>foo : Symbol(foo, Decl(callWithSpread.ts, 43, 5))
|
||||
|
||||
super.foo(1, 2);
|
||||
>super.foo : Symbol(C.foo, Decl(callWithSpread.ts, 34, 5))
|
||||
>super : Symbol(C, Decl(callWithSpread.ts, 28, 40))
|
||||
>foo : Symbol(C.foo, Decl(callWithSpread.ts, 34, 5))
|
||||
|
||||
super.foo(1, 2, ...a);
|
||||
>super.foo : Symbol(C.foo, Decl(callWithSpread.ts, 34, 5))
|
||||
>super : Symbol(C, Decl(callWithSpread.ts, 28, 40))
|
||||
>foo : Symbol(C.foo, Decl(callWithSpread.ts, 34, 5))
|
||||
>a : Symbol(a, Decl(callWithSpread.ts, 7, 3))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,247 @@
|
||||
=== tests/cases/conformance/expressions/functionCalls/callWithSpread.ts ===
|
||||
interface X {
|
||||
>X : X
|
||||
|
||||
foo(x: number, y: number, ...z: string[]);
|
||||
>foo : (x: number, y: number, ...z: string[]) => any
|
||||
>x : number
|
||||
>y : number
|
||||
>z : string[]
|
||||
}
|
||||
|
||||
function foo(x: number, y: number, ...z: string[]) {
|
||||
>foo : (x: number, y: number, ...z: string[]) => void
|
||||
>x : number
|
||||
>y : number
|
||||
>z : string[]
|
||||
}
|
||||
|
||||
var a: string[];
|
||||
>a : string[]
|
||||
|
||||
var z: number[];
|
||||
>z : number[]
|
||||
|
||||
var obj: X;
|
||||
>obj : X
|
||||
>X : X
|
||||
|
||||
var xa: X[];
|
||||
>xa : X[]
|
||||
>X : X
|
||||
|
||||
foo(1, 2, "abc");
|
||||
>foo(1, 2, "abc") : void
|
||||
>foo : (x: number, y: number, ...z: string[]) => void
|
||||
>1 : number
|
||||
>2 : number
|
||||
>"abc" : string
|
||||
|
||||
foo(1, 2, ...a);
|
||||
>foo(1, 2, ...a) : void
|
||||
>foo : (x: number, y: number, ...z: string[]) => void
|
||||
>1 : number
|
||||
>2 : number
|
||||
>...a : string
|
||||
>a : string[]
|
||||
|
||||
foo(1, 2, ...a, "abc");
|
||||
>foo(1, 2, ...a, "abc") : void
|
||||
>foo : (x: number, y: number, ...z: string[]) => void
|
||||
>1 : number
|
||||
>2 : number
|
||||
>...a : string
|
||||
>a : string[]
|
||||
>"abc" : string
|
||||
|
||||
obj.foo(1, 2, "abc");
|
||||
>obj.foo(1, 2, "abc") : any
|
||||
>obj.foo : (x: number, y: number, ...z: string[]) => any
|
||||
>obj : X
|
||||
>foo : (x: number, y: number, ...z: string[]) => any
|
||||
>1 : number
|
||||
>2 : number
|
||||
>"abc" : string
|
||||
|
||||
obj.foo(1, 2, ...a);
|
||||
>obj.foo(1, 2, ...a) : any
|
||||
>obj.foo : (x: number, y: number, ...z: string[]) => any
|
||||
>obj : X
|
||||
>foo : (x: number, y: number, ...z: string[]) => any
|
||||
>1 : number
|
||||
>2 : number
|
||||
>...a : string
|
||||
>a : string[]
|
||||
|
||||
obj.foo(1, 2, ...a, "abc");
|
||||
>obj.foo(1, 2, ...a, "abc") : any
|
||||
>obj.foo : (x: number, y: number, ...z: string[]) => any
|
||||
>obj : X
|
||||
>foo : (x: number, y: number, ...z: string[]) => any
|
||||
>1 : number
|
||||
>2 : number
|
||||
>...a : string
|
||||
>a : string[]
|
||||
>"abc" : string
|
||||
|
||||
(obj.foo)(1, 2, "abc");
|
||||
>(obj.foo)(1, 2, "abc") : any
|
||||
>(obj.foo) : (x: number, y: number, ...z: string[]) => any
|
||||
>obj.foo : (x: number, y: number, ...z: string[]) => any
|
||||
>obj : X
|
||||
>foo : (x: number, y: number, ...z: string[]) => any
|
||||
>1 : number
|
||||
>2 : number
|
||||
>"abc" : string
|
||||
|
||||
(obj.foo)(1, 2, ...a);
|
||||
>(obj.foo)(1, 2, ...a) : any
|
||||
>(obj.foo) : (x: number, y: number, ...z: string[]) => any
|
||||
>obj.foo : (x: number, y: number, ...z: string[]) => any
|
||||
>obj : X
|
||||
>foo : (x: number, y: number, ...z: string[]) => any
|
||||
>1 : number
|
||||
>2 : number
|
||||
>...a : string
|
||||
>a : string[]
|
||||
|
||||
(obj.foo)(1, 2, ...a, "abc");
|
||||
>(obj.foo)(1, 2, ...a, "abc") : any
|
||||
>(obj.foo) : (x: number, y: number, ...z: string[]) => any
|
||||
>obj.foo : (x: number, y: number, ...z: string[]) => any
|
||||
>obj : X
|
||||
>foo : (x: number, y: number, ...z: string[]) => any
|
||||
>1 : number
|
||||
>2 : number
|
||||
>...a : string
|
||||
>a : string[]
|
||||
>"abc" : string
|
||||
|
||||
xa[1].foo(1, 2, "abc");
|
||||
>xa[1].foo(1, 2, "abc") : any
|
||||
>xa[1].foo : (x: number, y: number, ...z: string[]) => any
|
||||
>xa[1] : X
|
||||
>xa : X[]
|
||||
>1 : number
|
||||
>foo : (x: number, y: number, ...z: string[]) => any
|
||||
>1 : number
|
||||
>2 : number
|
||||
>"abc" : string
|
||||
|
||||
xa[1].foo(1, 2, ...a);
|
||||
>xa[1].foo(1, 2, ...a) : any
|
||||
>xa[1].foo : (x: number, y: number, ...z: string[]) => any
|
||||
>xa[1] : X
|
||||
>xa : X[]
|
||||
>1 : number
|
||||
>foo : (x: number, y: number, ...z: string[]) => any
|
||||
>1 : number
|
||||
>2 : number
|
||||
>...a : string
|
||||
>a : string[]
|
||||
|
||||
xa[1].foo(1, 2, ...a, "abc");
|
||||
>xa[1].foo(1, 2, ...a, "abc") : any
|
||||
>xa[1].foo : (x: number, y: number, ...z: string[]) => any
|
||||
>xa[1] : X
|
||||
>xa : X[]
|
||||
>1 : number
|
||||
>foo : (x: number, y: number, ...z: string[]) => any
|
||||
>1 : number
|
||||
>2 : number
|
||||
>...a : string
|
||||
>a : string[]
|
||||
>"abc" : string
|
||||
|
||||
(<Function>xa[1].foo)(...[1, 2, "abc"]);
|
||||
>(<Function>xa[1].foo)(...[1, 2, "abc"]) : any
|
||||
>(<Function>xa[1].foo) : Function
|
||||
><Function>xa[1].foo : Function
|
||||
>Function : Function
|
||||
>xa[1].foo : (x: number, y: number, ...z: string[]) => any
|
||||
>xa[1] : X
|
||||
>xa : X[]
|
||||
>1 : number
|
||||
>foo : (x: number, y: number, ...z: string[]) => any
|
||||
>...[1, 2, "abc"] : string | number
|
||||
>[1, 2, "abc"] : (string | number)[]
|
||||
>1 : number
|
||||
>2 : number
|
||||
>"abc" : string
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
constructor(x: number, y: number, ...z: string[]) {
|
||||
>x : number
|
||||
>y : number
|
||||
>z : string[]
|
||||
|
||||
this.foo(x, y);
|
||||
>this.foo(x, y) : void
|
||||
>this.foo : (x: number, y: number, ...z: string[]) => void
|
||||
>this : C
|
||||
>foo : (x: number, y: number, ...z: string[]) => void
|
||||
>x : number
|
||||
>y : number
|
||||
|
||||
this.foo(x, y, ...z);
|
||||
>this.foo(x, y, ...z) : void
|
||||
>this.foo : (x: number, y: number, ...z: string[]) => void
|
||||
>this : C
|
||||
>foo : (x: number, y: number, ...z: string[]) => void
|
||||
>x : number
|
||||
>y : number
|
||||
>...z : string
|
||||
>z : string[]
|
||||
}
|
||||
foo(x: number, y: number, ...z: string[]) {
|
||||
>foo : (x: number, y: number, ...z: string[]) => void
|
||||
>x : number
|
||||
>y : number
|
||||
>z : string[]
|
||||
}
|
||||
}
|
||||
|
||||
class D extends C {
|
||||
>D : D
|
||||
>C : C
|
||||
|
||||
constructor() {
|
||||
super(1, 2);
|
||||
>super(1, 2) : void
|
||||
>super : typeof C
|
||||
>1 : number
|
||||
>2 : number
|
||||
|
||||
super(1, 2, ...a);
|
||||
>super(1, 2, ...a) : void
|
||||
>super : typeof C
|
||||
>1 : number
|
||||
>2 : number
|
||||
>...a : string
|
||||
>a : string[]
|
||||
}
|
||||
foo() {
|
||||
>foo : () => void
|
||||
|
||||
super.foo(1, 2);
|
||||
>super.foo(1, 2) : void
|
||||
>super.foo : (x: number, y: number, ...z: string[]) => void
|
||||
>super : C
|
||||
>foo : (x: number, y: number, ...z: string[]) => void
|
||||
>1 : number
|
||||
>2 : number
|
||||
|
||||
super.foo(1, 2, ...a);
|
||||
>super.foo(1, 2, ...a) : void
|
||||
>super.foo : (x: number, y: number, ...z: string[]) => void
|
||||
>super : C
|
||||
>foo : (x: number, y: number, ...z: string[]) => void
|
||||
>1 : number
|
||||
>2 : number
|
||||
>...a : string
|
||||
>a : string[]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,9 +49,6 @@ class D extends C {
|
||||
super.foo(1, 2, ...a);
|
||||
}
|
||||
}
|
||||
|
||||
// Only supported in when target is ES6
|
||||
var c = new C(1, 2, ...a);
|
||||
|
||||
|
||||
//// [callWithSpreadES6.js]
|
||||
@@ -92,5 +89,3 @@ class D extends C {
|
||||
super.foo(1, 2, ...a);
|
||||
}
|
||||
}
|
||||
// Only supported in when target is ES6
|
||||
var c = new C(1, 2, ...a);
|
||||
|
||||
@@ -158,9 +158,3 @@ class D extends C {
|
||||
}
|
||||
}
|
||||
|
||||
// Only supported in when target is ES6
|
||||
var c = new C(1, 2, ...a);
|
||||
>c : Symbol(c, Decl(callWithSpreadES6.ts, 52, 3))
|
||||
>C : Symbol(C, Decl(callWithSpreadES6.ts, 29, 40))
|
||||
>a : Symbol(a, Decl(callWithSpreadES6.ts, 8, 3))
|
||||
|
||||
|
||||
@@ -246,13 +246,3 @@ class D extends C {
|
||||
}
|
||||
}
|
||||
|
||||
// Only supported in when target is ES6
|
||||
var c = new C(1, 2, ...a);
|
||||
>c : C
|
||||
>new C(1, 2, ...a) : C
|
||||
>C : typeof C
|
||||
>1 : number
|
||||
>2 : number
|
||||
>...a : string
|
||||
>a : string[]
|
||||
|
||||
|
||||
-1
@@ -27,7 +27,6 @@ var A = (function () {
|
||||
})();
|
||||
var A;
|
||||
(function (A) {
|
||||
A.v;
|
||||
})(A || (A = {}));
|
||||
var Foo;
|
||||
(function (Foo) {
|
||||
|
||||
@@ -16,7 +16,6 @@ export class Test1 {
|
||||
}
|
||||
|
||||
//// [classMemberInitializerWithLamdaScoping3_0.js]
|
||||
exports.field1;
|
||||
//// [classMemberInitializerWithLamdaScoping3_1.js]
|
||||
var Test1 = (function () {
|
||||
function Test1(field1) {
|
||||
|
||||
@@ -5,6 +5,4 @@ export var b: number;
|
||||
|
||||
//// [commentsBeforeVariableStatement1.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
/** b's comment*/
|
||||
exports.b;
|
||||
});
|
||||
|
||||
@@ -66,8 +66,6 @@ define(["require", "exports"], function (require, exports) {
|
||||
/** Module comment*/
|
||||
var m1;
|
||||
(function (m1) {
|
||||
/** b's comment*/
|
||||
m1.b;
|
||||
/** foo's comment*/
|
||||
function foo() {
|
||||
return m1.b;
|
||||
@@ -97,8 +95,6 @@ define(["require", "exports"], function (require, exports) {
|
||||
/** Module comment */
|
||||
var m4;
|
||||
(function (m4) {
|
||||
/** b's comment */
|
||||
m4.b;
|
||||
/** foo's comment
|
||||
*/
|
||||
function foo() {
|
||||
|
||||
@@ -66,8 +66,6 @@ define(["require", "exports"], function (require, exports) {
|
||||
/** Module comment*/
|
||||
var m1;
|
||||
(function (m1) {
|
||||
/** b's comment*/
|
||||
m1.b;
|
||||
/** foo's comment*/
|
||||
function foo() {
|
||||
return m1.b;
|
||||
@@ -97,8 +95,6 @@ define(["require", "exports"], function (require, exports) {
|
||||
/** Module comment */
|
||||
var m4;
|
||||
(function (m4) {
|
||||
/** b's comment */
|
||||
m4.b;
|
||||
/** foo's comment
|
||||
*/
|
||||
function foo() {
|
||||
|
||||
@@ -65,8 +65,6 @@ export var newVar2 = new extMod.m4.m2.c();
|
||||
/** Module comment*/
|
||||
var m1;
|
||||
(function (m1) {
|
||||
/** b's comment*/
|
||||
m1.b;
|
||||
/** foo's comment*/
|
||||
function foo() {
|
||||
return m1.b;
|
||||
@@ -96,8 +94,6 @@ var myvar = new m1.m2.c();
|
||||
/** Module comment */
|
||||
var m4;
|
||||
(function (m4) {
|
||||
/** b's comment */
|
||||
m4.b;
|
||||
/** foo's comment
|
||||
*/
|
||||
function foo() {
|
||||
|
||||
@@ -101,8 +101,6 @@ new m7.m8.m9.c();
|
||||
/** Module comment*/
|
||||
var m1;
|
||||
(function (m1) {
|
||||
/** b's comment*/
|
||||
m1.b;
|
||||
/** foo's comment*/
|
||||
function foo() {
|
||||
return m1.b;
|
||||
|
||||
@@ -163,7 +163,6 @@ var m1;
|
||||
return C5;
|
||||
})();
|
||||
m1.C5 = C5;
|
||||
m1.v2;
|
||||
})(m1 || (m1 = {}));
|
||||
var C2 = (function () {
|
||||
function C2() {
|
||||
|
||||
@@ -156,7 +156,6 @@ this += value;
|
||||
// identifiers: module, class, enum, function
|
||||
var M;
|
||||
(function (M) {
|
||||
M.a;
|
||||
})(M || (M = {}));
|
||||
M *= value;
|
||||
M += value;
|
||||
|
||||
@@ -283,7 +283,6 @@ var C4T5 = (function () {
|
||||
// CONTEXT: Module property assignment
|
||||
var C5T5;
|
||||
(function (C5T5) {
|
||||
C5T5.foo;
|
||||
C5T5.foo = function (i, s) {
|
||||
return s;
|
||||
};
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -2,4 +2,4 @@
|
||||
var foo: {id:number;} = {id:4};
|
||||
|
||||
//// [contextualTyping1.js]
|
||||
var foo = { id: 4 };\n
|
||||
var foo = { id: 4 };
|
||||
|
||||
@@ -20,7 +20,6 @@ export var x: SubModule.m.m3.c;
|
||||
|
||||
//// [declFileAmbientExternalModuleWithSingleExportedModule_0.js]
|
||||
//// [declFileAmbientExternalModuleWithSingleExportedModule_1.js]
|
||||
exports.x;
|
||||
|
||||
|
||||
//// [declFileAmbientExternalModuleWithSingleExportedModule_0.d.ts]
|
||||
|
||||
@@ -24,7 +24,6 @@ export = m;
|
||||
//// [declFileExportAssignmentImportInternalModule.js]
|
||||
var m3;
|
||||
(function (m3) {
|
||||
m3.server;
|
||||
})(m3 || (m3 = {}));
|
||||
var m = m3;
|
||||
module.exports = m;
|
||||
|
||||
@@ -17,7 +17,6 @@ define(["require", "exports"], function (require, exports) {
|
||||
});
|
||||
//// [declFileExportAssignmentOfGenericInterface_1.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
exports.x;
|
||||
exports.x.a;
|
||||
});
|
||||
|
||||
|
||||
@@ -54,7 +54,6 @@ define(["require", "exports", "declFileExportImportChain_b1"], function (require
|
||||
});
|
||||
//// [declFileExportImportChain_d.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
exports.x;
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -47,7 +47,6 @@ define(["require", "exports", "declFileExportImportChain2_b"], function (require
|
||||
});
|
||||
//// [declFileExportImportChain2_d.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
exports.x;
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ export import b = a;
|
||||
var z = b.x;
|
||||
|
||||
//// [declFileForExportedImport_0.js]
|
||||
exports.x;
|
||||
//// [declFileForExportedImport_1.js]
|
||||
///<reference path='declFileForExportedImport_0.ts'/>
|
||||
exports.a = require('declFileForExportedImport_0');
|
||||
|
||||
@@ -80,7 +80,6 @@ var C;
|
||||
})();
|
||||
C.D = D;
|
||||
})(C = exports.C || (exports.C = {}));
|
||||
exports.a;
|
||||
exports.b = C.F;
|
||||
exports.c = C.F2;
|
||||
exports.d = C.F3;
|
||||
|
||||
@@ -34,7 +34,6 @@ module M {
|
||||
//// [declFileTypeAnnotationTypeAlias.js]
|
||||
var M;
|
||||
(function (M) {
|
||||
M.x;
|
||||
var c = (function () {
|
||||
function c() {
|
||||
}
|
||||
@@ -61,7 +60,6 @@ var M;
|
||||
return Window;
|
||||
})();
|
||||
N.Window = Window;
|
||||
N.p;
|
||||
})(N = M.N || (M.N = {}));
|
||||
})(M || (M = {}));
|
||||
|
||||
|
||||
@@ -52,7 +52,6 @@ var M;
|
||||
return Window;
|
||||
})();
|
||||
N.Window = Window;
|
||||
N.p; // Should report error that W is private
|
||||
})(N = M.N || (M.N = {}));
|
||||
})(M || (M = {}));
|
||||
var M1;
|
||||
@@ -65,7 +64,6 @@ var M1;
|
||||
return Window;
|
||||
})();
|
||||
N.Window = Window;
|
||||
N.p; // No error
|
||||
})(N = M1.N || (M1.N = {}));
|
||||
})(M1 || (M1 = {}));
|
||||
var M2;
|
||||
|
||||
@@ -51,7 +51,6 @@ var m;
|
||||
})();
|
||||
m2.public1 = public1;
|
||||
})(m2 || (m2 = {}));
|
||||
m.x;
|
||||
m.x2 = {
|
||||
x: new private1(),
|
||||
y: new m2.public1(),
|
||||
@@ -60,10 +59,6 @@ var m;
|
||||
}
|
||||
};
|
||||
m.x3 = m.x;
|
||||
// Function type
|
||||
m.y;
|
||||
m.y2 = m.y;
|
||||
// constructor type
|
||||
m.z;
|
||||
m.z2 = m.z;
|
||||
})(m || (m = {}));
|
||||
|
||||
@@ -50,11 +50,9 @@ var m;
|
||||
// Directly using names from this module
|
||||
var x;
|
||||
var y = new private1();
|
||||
m.k;
|
||||
m.l = new private1();
|
||||
var x2;
|
||||
var y2 = new public1();
|
||||
m.k2;
|
||||
m.l2 = new public1();
|
||||
var m2;
|
||||
(function (m2) {
|
||||
@@ -67,6 +65,5 @@ var m;
|
||||
})(m2 || (m2 = {}));
|
||||
var x3;
|
||||
var y3 = new m2.public2();
|
||||
m.k3;
|
||||
m.l3 = new m2.public2();
|
||||
})(m || (m = {}));
|
||||
|
||||
@@ -16,13 +16,11 @@ var m2_2: typeof m2;
|
||||
//// [declFileTypeofModule.js]
|
||||
var m1;
|
||||
(function (m1) {
|
||||
m1.c;
|
||||
})(m1 || (m1 = {}));
|
||||
var m1_1 = m1;
|
||||
var m1_2;
|
||||
var m2;
|
||||
(function (m2) {
|
||||
m2.d;
|
||||
})(m2 || (m2 = {}));
|
||||
var m2_1 = m2;
|
||||
var m2_2;
|
||||
|
||||
@@ -22,7 +22,6 @@ var m;
|
||||
})();
|
||||
c_1.c = c;
|
||||
})(c = m.c || (m.c = {}));
|
||||
m.a;
|
||||
})(m || (m = {}));
|
||||
module.exports = m;
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@ var X;
|
||||
base.C = C;
|
||||
var M;
|
||||
(function (M) {
|
||||
M.v;
|
||||
})(M = base.M || (base.M = {}));
|
||||
(function (E) {
|
||||
})(base.E || (base.E = {}));
|
||||
|
||||
@@ -74,7 +74,6 @@ var M;
|
||||
D[D["f"] = 0] = "f";
|
||||
})(P.D || (P.D = {}));
|
||||
var D = P.D;
|
||||
P.v; // ok
|
||||
P.w = M.D.f; // error, should be typeof M.D.f
|
||||
P.x = M.C.f; // error, should be typeof M.C.f
|
||||
P.x = M.E.f; // error, should be typeof M.E.f
|
||||
|
||||
@@ -9,7 +9,6 @@ export module M {
|
||||
//// [declarationEmit_nameConflictsWithAlias.js]
|
||||
var M;
|
||||
(function (M) {
|
||||
M.w; // Gets emitted as C.I, which is the wrong interface
|
||||
})(M = exports.M || (exports.M = {}));
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
//// [declareModifierOnTypeAlias.ts]
|
||||
declare type Foo = string;
|
||||
type Bar = number;
|
||||
declare type Baz = Bar;
|
||||
|
||||
//// [declareModifierOnTypeAlias.js]
|
||||
@@ -0,0 +1,11 @@
|
||||
=== tests/cases/compiler/declareModifierOnTypeAlias.ts ===
|
||||
declare type Foo = string;
|
||||
>Foo : Symbol(Foo, Decl(declareModifierOnTypeAlias.ts, 0, 0))
|
||||
|
||||
type Bar = number;
|
||||
>Bar : Symbol(Bar, Decl(declareModifierOnTypeAlias.ts, 0, 26))
|
||||
|
||||
declare type Baz = Bar;
|
||||
>Baz : Symbol(Baz, Decl(declareModifierOnTypeAlias.ts, 1, 18))
|
||||
>Bar : Symbol(Bar, Decl(declareModifierOnTypeAlias.ts, 0, 26))
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
=== tests/cases/compiler/declareModifierOnTypeAlias.ts ===
|
||||
declare type Foo = string;
|
||||
>Foo : string
|
||||
|
||||
type Bar = number;
|
||||
>Bar : number
|
||||
|
||||
declare type Baz = Bar;
|
||||
>Baz : number
|
||||
>Bar : number
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
tests/cases/conformance/decorators/class/decoratorChecksFunctionBodies.ts(9,14): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/class/decoratorChecksFunctionBodies.ts (1 errors) ====
|
||||
|
||||
// from #2971
|
||||
function func(s: string): void {
|
||||
}
|
||||
|
||||
class A {
|
||||
@(x => {
|
||||
var a = 3;
|
||||
func(a);
|
||||
~
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
return x;
|
||||
})
|
||||
m() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
//// [decoratorChecksFunctionBodies.ts]
|
||||
|
||||
// from #2971
|
||||
function func(s: string): void {
|
||||
}
|
||||
|
||||
class A {
|
||||
@(x => {
|
||||
var a = 3;
|
||||
func(a);
|
||||
return x;
|
||||
})
|
||||
m() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//// [decoratorChecksFunctionBodies.js]
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
|
||||
switch (arguments.length) {
|
||||
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
|
||||
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
|
||||
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
|
||||
}
|
||||
};
|
||||
// from #2971
|
||||
function func(s) {
|
||||
}
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
A.prototype.m = function () {
|
||||
};
|
||||
Object.defineProperty(A.prototype, "m",
|
||||
__decorate([
|
||||
(function (x) {
|
||||
var a = 3;
|
||||
func(a);
|
||||
return x;
|
||||
})
|
||||
], A.prototype, "m", Object.getOwnPropertyDescriptor(A.prototype, "m")));
|
||||
return A;
|
||||
})();
|
||||
@@ -0,0 +1,53 @@
|
||||
//// [tests/cases/conformance/decorators/class/decoratorInstantiateModulesInFunctionBodies.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
|
||||
// from #3108
|
||||
export var test = 'abc';
|
||||
|
||||
//// [b.ts]
|
||||
import { test } from './a';
|
||||
|
||||
function filter(handler: any) {
|
||||
return function (target: any) {
|
||||
// ...
|
||||
};
|
||||
}
|
||||
|
||||
class Wat {
|
||||
@filter(() => test == 'abc')
|
||||
static whatever() {
|
||||
// ...
|
||||
}
|
||||
}
|
||||
|
||||
//// [a.js]
|
||||
// from #3108
|
||||
exports.test = 'abc';
|
||||
//// [b.js]
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
|
||||
switch (arguments.length) {
|
||||
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
|
||||
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
|
||||
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
|
||||
}
|
||||
};
|
||||
var a_1 = require('./a');
|
||||
function filter(handler) {
|
||||
return function (target) {
|
||||
// ...
|
||||
};
|
||||
}
|
||||
var Wat = (function () {
|
||||
function Wat() {
|
||||
}
|
||||
Wat.whatever = function () {
|
||||
// ...
|
||||
};
|
||||
Object.defineProperty(Wat, "whatever",
|
||||
__decorate([
|
||||
filter(function () { return a_1.test == 'abc'; })
|
||||
], Wat, "whatever", Object.getOwnPropertyDescriptor(Wat, "whatever")));
|
||||
return Wat;
|
||||
})();
|
||||
@@ -0,0 +1,34 @@
|
||||
=== tests/cases/conformance/decorators/class/a.ts ===
|
||||
|
||||
// from #3108
|
||||
export var test = 'abc';
|
||||
>test : Symbol(test, Decl(a.ts, 2, 10))
|
||||
|
||||
=== tests/cases/conformance/decorators/class/b.ts ===
|
||||
import { test } from './a';
|
||||
>test : Symbol(test, Decl(b.ts, 0, 8))
|
||||
|
||||
function filter(handler: any) {
|
||||
>filter : Symbol(filter, Decl(b.ts, 0, 27))
|
||||
>handler : Symbol(handler, Decl(b.ts, 2, 16))
|
||||
|
||||
return function (target: any) {
|
||||
>target : Symbol(target, Decl(b.ts, 3, 21))
|
||||
|
||||
// ...
|
||||
};
|
||||
}
|
||||
|
||||
class Wat {
|
||||
>Wat : Symbol(Wat, Decl(b.ts, 6, 1))
|
||||
|
||||
@filter(() => test == 'abc')
|
||||
>filter : Symbol(filter, Decl(b.ts, 0, 27))
|
||||
>test : Symbol(test, Decl(b.ts, 0, 8))
|
||||
|
||||
static whatever() {
|
||||
>whatever : Symbol(Wat.whatever, Decl(b.ts, 8, 11))
|
||||
|
||||
// ...
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
=== tests/cases/conformance/decorators/class/a.ts ===
|
||||
|
||||
// from #3108
|
||||
export var test = 'abc';
|
||||
>test : string
|
||||
>'abc' : string
|
||||
|
||||
=== tests/cases/conformance/decorators/class/b.ts ===
|
||||
import { test } from './a';
|
||||
>test : string
|
||||
|
||||
function filter(handler: any) {
|
||||
>filter : (handler: any) => (target: any) => void
|
||||
>handler : any
|
||||
|
||||
return function (target: any) {
|
||||
>function (target: any) { // ... } : (target: any) => void
|
||||
>target : any
|
||||
|
||||
// ...
|
||||
};
|
||||
}
|
||||
|
||||
class Wat {
|
||||
>Wat : Wat
|
||||
|
||||
@filter(() => test == 'abc')
|
||||
>filter(() => test == 'abc') : (target: any) => void
|
||||
>filter : (handler: any) => (target: any) => void
|
||||
>() => test == 'abc' : () => boolean
|
||||
>test == 'abc' : boolean
|
||||
>test : string
|
||||
>'abc' : string
|
||||
|
||||
static whatever() {
|
||||
>whatever : () => void
|
||||
|
||||
// ...
|
||||
}
|
||||
}
|
||||
@@ -13,5 +13,4 @@ module M2 {
|
||||
//// [decoratorOnImportEquals1.js]
|
||||
var M1;
|
||||
(function (M1) {
|
||||
M1.X;
|
||||
})(M1 || (M1 = {}));
|
||||
|
||||
@@ -10,5 +10,4 @@ import lib = require('./decoratorOnImportEquals2_0');
|
||||
declare function dec<T>(target: T): T;
|
||||
|
||||
//// [decoratorOnImportEquals2_0.js]
|
||||
exports.X;
|
||||
//// [decoratorOnImportEquals2_1.js]
|
||||
|
||||
@@ -61,7 +61,6 @@ var A = (function () {
|
||||
})();
|
||||
var M;
|
||||
(function (M) {
|
||||
M.n;
|
||||
})(M || (M = {}));
|
||||
var objA = new A();
|
||||
// any type var
|
||||
|
||||
@@ -93,7 +93,6 @@ var A = (function () {
|
||||
})();
|
||||
var M;
|
||||
(function (M) {
|
||||
M.n;
|
||||
})(M || (M = {}));
|
||||
var objA = new A();
|
||||
// any type var
|
||||
|
||||
@@ -50,7 +50,6 @@ var A = (function () {
|
||||
})();
|
||||
var M;
|
||||
(function (M) {
|
||||
M.n;
|
||||
})(M || (M = {}));
|
||||
var objA = new A();
|
||||
// number type var
|
||||
|
||||
@@ -59,7 +59,6 @@ var A = (function () {
|
||||
})();
|
||||
var M;
|
||||
(function (M) {
|
||||
M.n;
|
||||
})(M || (M = {}));
|
||||
var objA = new A();
|
||||
//number type var
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user