Merge branch 'master' into errorForUseSuperInNullExtension

This commit is contained in:
Yui T
2015-07-26 20:46:51 -07:00
211 changed files with 3551 additions and 822 deletions
+83 -43
View File
@@ -933,7 +933,14 @@ var ts;
newLine: _os.EOL,
useCaseSensitiveFileNames: useCaseSensitiveFileNames,
write: function (s) {
_fs.writeSync(1, s);
var buffer = new Buffer(s, 'utf8');
var offset = 0;
var toWrite = buffer.length;
var written = 0;
while ((written = _fs.writeSync(1, buffer, offset, toWrite)) < toWrite) {
offset += written;
toWrite -= written;
}
},
readFile: readFile,
writeFile: writeFile,
@@ -1401,7 +1408,7 @@ var ts;
Classes_containing_abstract_methods_must_be_marked_abstract: { code: 2514, category: ts.DiagnosticCategory.Error, key: "Classes containing abstract methods must be marked abstract." },
Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2: { code: 2515, category: ts.DiagnosticCategory.Error, key: "Non-abstract class '{0}' does not implement inherited abstract member '{1}' from class '{2}'." },
All_declarations_of_an_abstract_method_must_be_consecutive: { code: 2516, category: ts.DiagnosticCategory.Error, key: "All declarations of an abstract method must be consecutive." },
Constructor_objects_of_abstract_type_cannot_be_assigned_to_constructor_objects_of_non_abstract_type: { code: 2517, category: ts.DiagnosticCategory.Error, key: "Constructor objects of abstract type cannot be assigned to constructor objects of non-abstract type" },
Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type: { code: 2517, category: ts.DiagnosticCategory.Error, key: "Cannot assign an abstract constructor type to a non-abstract constructor type." },
Only_an_ambient_class_can_be_merged_with_an_interface: { code: 2518, category: ts.DiagnosticCategory.Error, key: "Only an ambient class can be merged with an interface." },
Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions: { code: 2520, category: ts.DiagnosticCategory.Error, key: "Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions." },
Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions: { code: 2521, category: ts.DiagnosticCategory.Error, key: "Expression resolves to variable declaration '{0}' that compiler uses to support async functions." },
@@ -9187,7 +9194,8 @@ var ts;
}
else {
node.exportClause = parseNamedImportsOrExports(226);
if (parseOptional(130)) {
if (token === 130 || (token === 8 && !scanner.hasPrecedingLineBreak())) {
parseExpected(130);
node.moduleSpecifier = parseModuleSpecifier();
}
}
@@ -13263,7 +13271,7 @@ var ts;
var id = getTypeListId(elementTypes);
var type = tupleTypes[id];
if (!type) {
type = tupleTypes[id] = createObjectType(8192);
type = tupleTypes[id] = createObjectType(8192 | getWideningFlagsOfTypes(elementTypes));
type.elementTypes = elementTypes;
}
return type;
@@ -14084,10 +14092,29 @@ var ts;
var targetSignatures = getSignaturesOfType(target, kind);
var result = -1;
var saveErrorInfo = errorInfo;
var sourceSig = sourceSignatures[0];
var targetSig = targetSignatures[0];
if (sourceSig && targetSig) {
var sourceErasedSignature = getErasedSignature(sourceSig);
var targetErasedSignature = getErasedSignature(targetSig);
var sourceReturnType = sourceErasedSignature && getReturnTypeOfSignature(sourceErasedSignature);
var targetReturnType = targetErasedSignature && getReturnTypeOfSignature(targetErasedSignature);
var sourceReturnDecl = sourceReturnType && sourceReturnType.symbol && ts.getDeclarationOfKind(sourceReturnType.symbol, 211);
var targetReturnDecl = targetReturnType && targetReturnType.symbol && ts.getDeclarationOfKind(targetReturnType.symbol, 211);
var sourceIsAbstract = sourceReturnDecl && sourceReturnDecl.flags & 256;
var targetIsAbstract = targetReturnDecl && targetReturnDecl.flags & 256;
if (sourceIsAbstract && !targetIsAbstract) {
if (reportErrors) {
reportError(ts.Diagnostics.Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type);
}
return 0;
}
}
outer: for (var _i = 0; _i < targetSignatures.length; _i++) {
var t = targetSignatures[_i];
if (!t.hasStringLiterals || target.flags & 262144) {
var localErrors = reportErrors;
var checkedAbstractAssignability = false;
for (var _a = 0; _a < sourceSignatures.length; _a++) {
var s = sourceSignatures[_a];
if (!s.hasStringLiterals || source.flags & 262144) {
@@ -14135,12 +14162,12 @@ var ts;
target = getErasedSignature(target);
var result = -1;
for (var i = 0; i < checkCount; i++) {
var s_1 = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source);
var t_1 = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target);
var s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source);
var t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target);
var saveErrorInfo = errorInfo;
var related = isRelatedTo(s_1, t_1, reportErrors);
var related = isRelatedTo(s, t, reportErrors);
if (!related) {
related = isRelatedTo(t_1, s_1, false);
related = isRelatedTo(t, s, false);
if (!related) {
if (reportErrors) {
reportError(ts.Diagnostics.Types_of_parameters_0_and_1_are_incompatible, source.parameters[i < sourceMax ? i : sourceMax].name, target.parameters[i < targetMax ? i : targetMax].name);
@@ -14178,11 +14205,11 @@ var ts;
}
return 0;
}
var t = getReturnTypeOfSignature(target);
if (t === voidType)
var targetReturnType = getReturnTypeOfSignature(target);
if (targetReturnType === voidType)
return result;
var s = getReturnTypeOfSignature(source);
return result & isRelatedTo(s, t, reportErrors);
var sourceReturnType = getReturnTypeOfSignature(source);
return result & isRelatedTo(sourceReturnType, targetReturnType, reportErrors);
}
function signaturesIdenticalTo(source, target, kind) {
var sourceSignatures = getSignaturesOfType(source, kind);
@@ -14395,7 +14422,7 @@ var ts;
return !!getPropertyOfType(type, "0");
}
function isTupleType(type) {
return (type.flags & 8192) && !!type.elementTypes;
return !!(type.flags & 8192);
}
function getWidenedTypeOfObjectLiteral(type) {
var properties = getPropertiesOfObjectType(type);
@@ -14437,25 +14464,36 @@ var ts;
if (isArrayType(type)) {
return createArrayType(getWidenedType(type.typeArguments[0]));
}
if (isTupleType(type)) {
return createTupleType(ts.map(type.elementTypes, getWidenedType));
}
}
return type;
}
function reportWideningErrorsInType(type) {
var errorReported = false;
if (type.flags & 16384) {
var errorReported = false;
ts.forEach(type.types, function (t) {
for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
var t = _a[_i];
if (reportWideningErrorsInType(t)) {
errorReported = true;
}
});
return errorReported;
}
}
if (isArrayType(type)) {
return reportWideningErrorsInType(type.typeArguments[0]);
}
if (isTupleType(type)) {
for (var _b = 0, _c = type.elementTypes; _b < _c.length; _b++) {
var t = _c[_b];
if (reportWideningErrorsInType(t)) {
errorReported = true;
}
}
}
if (type.flags & 524288) {
var errorReported = false;
ts.forEach(getPropertiesOfObjectType(type), function (p) {
for (var _d = 0, _e = getPropertiesOfObjectType(type); _d < _e.length; _d++) {
var p = _e[_d];
var t = getTypeOfSymbol(p);
if (t.flags & 1048576) {
if (!reportWideningErrorsInType(t)) {
@@ -14463,10 +14501,9 @@ var ts;
}
errorReported = true;
}
});
return errorReported;
}
}
return false;
return errorReported;
}
function reportImplicitAnyError(declaration, type) {
var typeAsString = typeToString(getWidenedType(type));
@@ -14614,28 +14651,31 @@ var ts;
inferFromTypes(sourceType, target);
}
}
else if (source.flags & 80896 && (target.flags & (4096 | 8192) ||
(target.flags & 65536) && target.symbol && target.symbol.flags & (8192 | 2048 | 32))) {
if (isInProcess(source, target)) {
return;
else {
source = getApparentType(source);
if (source.flags & 80896 && (target.flags & (4096 | 8192) ||
(target.flags & 65536) && target.symbol && target.symbol.flags & (8192 | 2048 | 32))) {
if (isInProcess(source, target)) {
return;
}
if (isDeeplyNestedGeneric(source, sourceStack, depth) && isDeeplyNestedGeneric(target, targetStack, depth)) {
return;
}
if (depth === 0) {
sourceStack = [];
targetStack = [];
}
sourceStack[depth] = source;
targetStack[depth] = target;
depth++;
inferFromProperties(source, target);
inferFromSignatures(source, target, 0);
inferFromSignatures(source, target, 1);
inferFromIndexTypes(source, target, 0, 0);
inferFromIndexTypes(source, target, 1, 1);
inferFromIndexTypes(source, target, 0, 1);
depth--;
}
if (isDeeplyNestedGeneric(source, sourceStack, depth) && isDeeplyNestedGeneric(target, targetStack, depth)) {
return;
}
if (depth === 0) {
sourceStack = [];
targetStack = [];
}
sourceStack[depth] = source;
targetStack[depth] = target;
depth++;
inferFromProperties(source, target);
inferFromSignatures(source, target, 0);
inferFromSignatures(source, target, 1);
inferFromIndexTypes(source, target, 0, 0);
inferFromIndexTypes(source, target, 1, 1);
inferFromIndexTypes(source, target, 0, 1);
depth--;
}
}
function inferFromProperties(source, target) {
+304 -254
View File
@@ -933,7 +933,14 @@ var ts;
newLine: _os.EOL,
useCaseSensitiveFileNames: useCaseSensitiveFileNames,
write: function (s) {
_fs.writeSync(1, s);
var buffer = new Buffer(s, 'utf8');
var offset = 0;
var toWrite = buffer.length;
var written = 0;
while ((written = _fs.writeSync(1, buffer, offset, toWrite)) < toWrite) {
offset += written;
toWrite -= written;
}
},
readFile: readFile,
writeFile: writeFile,
@@ -1401,7 +1408,7 @@ var ts;
Classes_containing_abstract_methods_must_be_marked_abstract: { code: 2514, category: ts.DiagnosticCategory.Error, key: "Classes containing abstract methods must be marked abstract." },
Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2: { code: 2515, category: ts.DiagnosticCategory.Error, key: "Non-abstract class '{0}' does not implement inherited abstract member '{1}' from class '{2}'." },
All_declarations_of_an_abstract_method_must_be_consecutive: { code: 2516, category: ts.DiagnosticCategory.Error, key: "All declarations of an abstract method must be consecutive." },
Constructor_objects_of_abstract_type_cannot_be_assigned_to_constructor_objects_of_non_abstract_type: { code: 2517, category: ts.DiagnosticCategory.Error, key: "Constructor objects of abstract type cannot be assigned to constructor objects of non-abstract type" },
Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type: { code: 2517, category: ts.DiagnosticCategory.Error, key: "Cannot assign an abstract constructor type to a non-abstract constructor type." },
Only_an_ambient_class_can_be_merged_with_an_interface: { code: 2518, category: ts.DiagnosticCategory.Error, key: "Only an ambient class can be merged with an interface." },
Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions: { code: 2520, category: ts.DiagnosticCategory.Error, key: "Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions." },
Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions: { code: 2521, category: ts.DiagnosticCategory.Error, key: "Expression resolves to variable declaration '{0}' that compiler uses to support async functions." },
@@ -8904,7 +8911,8 @@ var ts;
}
else {
node.exportClause = parseNamedImportsOrExports(226);
if (parseOptional(130)) {
if (token === 130 || (token === 8 && !scanner.hasPrecedingLineBreak())) {
parseExpected(130);
node.moduleSpecifier = parseModuleSpecifier();
}
}
@@ -13686,7 +13694,7 @@ var ts;
var id = getTypeListId(elementTypes);
var type = tupleTypes[id];
if (!type) {
type = tupleTypes[id] = createObjectType(8192);
type = tupleTypes[id] = createObjectType(8192 | getWideningFlagsOfTypes(elementTypes));
type.elementTypes = elementTypes;
}
return type;
@@ -14507,10 +14515,29 @@ var ts;
var targetSignatures = getSignaturesOfType(target, kind);
var result = -1;
var saveErrorInfo = errorInfo;
var sourceSig = sourceSignatures[0];
var targetSig = targetSignatures[0];
if (sourceSig && targetSig) {
var sourceErasedSignature = getErasedSignature(sourceSig);
var targetErasedSignature = getErasedSignature(targetSig);
var sourceReturnType = sourceErasedSignature && getReturnTypeOfSignature(sourceErasedSignature);
var targetReturnType = targetErasedSignature && getReturnTypeOfSignature(targetErasedSignature);
var sourceReturnDecl = sourceReturnType && sourceReturnType.symbol && ts.getDeclarationOfKind(sourceReturnType.symbol, 211);
var targetReturnDecl = targetReturnType && targetReturnType.symbol && ts.getDeclarationOfKind(targetReturnType.symbol, 211);
var sourceIsAbstract = sourceReturnDecl && sourceReturnDecl.flags & 256;
var targetIsAbstract = targetReturnDecl && targetReturnDecl.flags & 256;
if (sourceIsAbstract && !targetIsAbstract) {
if (reportErrors) {
reportError(ts.Diagnostics.Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type);
}
return 0;
}
}
outer: for (var _i = 0; _i < targetSignatures.length; _i++) {
var t = targetSignatures[_i];
if (!t.hasStringLiterals || target.flags & 262144) {
var localErrors = reportErrors;
var checkedAbstractAssignability = false;
for (var _a = 0; _a < sourceSignatures.length; _a++) {
var s = sourceSignatures[_a];
if (!s.hasStringLiterals || source.flags & 262144) {
@@ -14558,12 +14585,12 @@ var ts;
target = getErasedSignature(target);
var result = -1;
for (var i = 0; i < checkCount; i++) {
var s_1 = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source);
var t_1 = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target);
var s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source);
var t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target);
var saveErrorInfo = errorInfo;
var related = isRelatedTo(s_1, t_1, reportErrors);
var related = isRelatedTo(s, t, reportErrors);
if (!related) {
related = isRelatedTo(t_1, s_1, false);
related = isRelatedTo(t, s, false);
if (!related) {
if (reportErrors) {
reportError(ts.Diagnostics.Types_of_parameters_0_and_1_are_incompatible, source.parameters[i < sourceMax ? i : sourceMax].name, target.parameters[i < targetMax ? i : targetMax].name);
@@ -14601,11 +14628,11 @@ var ts;
}
return 0;
}
var t = getReturnTypeOfSignature(target);
if (t === voidType)
var targetReturnType = getReturnTypeOfSignature(target);
if (targetReturnType === voidType)
return result;
var s = getReturnTypeOfSignature(source);
return result & isRelatedTo(s, t, reportErrors);
var sourceReturnType = getReturnTypeOfSignature(source);
return result & isRelatedTo(sourceReturnType, targetReturnType, reportErrors);
}
function signaturesIdenticalTo(source, target, kind) {
var sourceSignatures = getSignaturesOfType(source, kind);
@@ -14818,7 +14845,7 @@ var ts;
return !!getPropertyOfType(type, "0");
}
function isTupleType(type) {
return (type.flags & 8192) && !!type.elementTypes;
return !!(type.flags & 8192);
}
function getWidenedTypeOfObjectLiteral(type) {
var properties = getPropertiesOfObjectType(type);
@@ -14860,25 +14887,36 @@ var ts;
if (isArrayType(type)) {
return createArrayType(getWidenedType(type.typeArguments[0]));
}
if (isTupleType(type)) {
return createTupleType(ts.map(type.elementTypes, getWidenedType));
}
}
return type;
}
function reportWideningErrorsInType(type) {
var errorReported = false;
if (type.flags & 16384) {
var errorReported = false;
ts.forEach(type.types, function (t) {
for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
var t = _a[_i];
if (reportWideningErrorsInType(t)) {
errorReported = true;
}
});
return errorReported;
}
}
if (isArrayType(type)) {
return reportWideningErrorsInType(type.typeArguments[0]);
}
if (isTupleType(type)) {
for (var _b = 0, _c = type.elementTypes; _b < _c.length; _b++) {
var t = _c[_b];
if (reportWideningErrorsInType(t)) {
errorReported = true;
}
}
}
if (type.flags & 524288) {
var errorReported = false;
ts.forEach(getPropertiesOfObjectType(type), function (p) {
for (var _d = 0, _e = getPropertiesOfObjectType(type); _d < _e.length; _d++) {
var p = _e[_d];
var t = getTypeOfSymbol(p);
if (t.flags & 1048576) {
if (!reportWideningErrorsInType(t)) {
@@ -14886,10 +14924,9 @@ var ts;
}
errorReported = true;
}
});
return errorReported;
}
}
return false;
return errorReported;
}
function reportImplicitAnyError(declaration, type) {
var typeAsString = typeToString(getWidenedType(type));
@@ -15037,28 +15074,31 @@ var ts;
inferFromTypes(sourceType, target);
}
}
else if (source.flags & 80896 && (target.flags & (4096 | 8192) ||
(target.flags & 65536) && target.symbol && target.symbol.flags & (8192 | 2048 | 32))) {
if (isInProcess(source, target)) {
return;
else {
source = getApparentType(source);
if (source.flags & 80896 && (target.flags & (4096 | 8192) ||
(target.flags & 65536) && target.symbol && target.symbol.flags & (8192 | 2048 | 32))) {
if (isInProcess(source, target)) {
return;
}
if (isDeeplyNestedGeneric(source, sourceStack, depth) && isDeeplyNestedGeneric(target, targetStack, depth)) {
return;
}
if (depth === 0) {
sourceStack = [];
targetStack = [];
}
sourceStack[depth] = source;
targetStack[depth] = target;
depth++;
inferFromProperties(source, target);
inferFromSignatures(source, target, 0);
inferFromSignatures(source, target, 1);
inferFromIndexTypes(source, target, 0, 0);
inferFromIndexTypes(source, target, 1, 1);
inferFromIndexTypes(source, target, 0, 1);
depth--;
}
if (isDeeplyNestedGeneric(source, sourceStack, depth) && isDeeplyNestedGeneric(target, targetStack, depth)) {
return;
}
if (depth === 0) {
sourceStack = [];
targetStack = [];
}
sourceStack[depth] = source;
targetStack[depth] = target;
depth++;
inferFromProperties(source, target);
inferFromSignatures(source, target, 0);
inferFromSignatures(source, target, 1);
inferFromIndexTypes(source, target, 0, 0);
inferFromIndexTypes(source, target, 1, 1);
inferFromIndexTypes(source, target, 0, 1);
depth--;
}
}
function inferFromProperties(source, target) {
@@ -31937,15 +31977,15 @@ var ts;
var t;
var pos = scanner.getStartPos();
while (pos < endPos) {
var t_2 = scanner.getToken();
if (!ts.isTrivia(t_2)) {
var t_1 = scanner.getToken();
if (!ts.isTrivia(t_1)) {
break;
}
scanner.scan();
var item = {
pos: pos,
end: scanner.getStartPos(),
kind: t_2
kind: t_1
};
pos = scanner.getStartPos();
if (!leadingTrivia) {
@@ -33289,6 +33329,8 @@ var ts;
case 15:
case 18:
case 19:
case 16:
case 17:
case 77:
case 101:
case 53:
@@ -33390,7 +33432,7 @@ var ts;
}
else if (tokenInfo.token.kind === listStartToken) {
startLine = sourceFile.getLineAndCharacterOfPosition(tokenInfo.token.pos).line;
var indentation_1 = computeIndentation(tokenInfo.token, startLine, -1, parent, parentDynamicIndentation, startLine);
var indentation_1 = computeIndentation(tokenInfo.token, startLine, -1, parent, parentDynamicIndentation, parentStartLine);
listDynamicIndentation = getDynamicIndentation(parent, parentStartLine, indentation_1.indentation, indentation_1.delta);
consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation);
}
@@ -35052,6 +35094,12 @@ var ts;
var newSourceFile = ts.updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks);
setSourceFileFields(newSourceFile, scriptSnapshot, version);
newSourceFile.nameTable = undefined;
if (sourceFile !== newSourceFile && sourceFile.scriptSnapshot) {
if (sourceFile.scriptSnapshot.dispose) {
sourceFile.scriptSnapshot.dispose();
}
sourceFile.scriptSnapshot = undefined;
}
return newSourceFile;
}
}
@@ -35908,20 +35956,20 @@ var ts;
}
function tryGetGlobalSymbols() {
var objectLikeContainer;
var importClause;
var namedImportsOrExports;
var jsxContainer;
if (objectLikeContainer = tryGetObjectLikeCompletionContainer(contextToken)) {
return tryGetObjectLikeCompletionSymbols(objectLikeContainer);
}
if (importClause = ts.getAncestor(contextToken, 220)) {
return tryGetImportClauseCompletionSymbols(importClause);
if (namedImportsOrExports = tryGetNamedImportsOrExportsForCompletion(contextToken)) {
return tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports);
}
if (jsxContainer = tryGetContainingJsxElement(contextToken)) {
var attrsType;
if ((jsxContainer.kind === 231) || (jsxContainer.kind === 232)) {
attrsType = typeChecker.getJsxElementAttributesType(jsxContainer);
if (attrsType) {
symbols = filterJsxAttributes(jsxContainer.attributes, typeChecker.getPropertiesOfType(attrsType));
symbols = filterJsxAttributes(typeChecker.getPropertiesOfType(attrsType), jsxContainer.attributes);
isMemberCompletion = true;
isNewIdentifierLocation = false;
return true;
@@ -35951,19 +35999,11 @@ var ts;
function isCompletionListBlocker(contextToken) {
var start = new Date().getTime();
var result = isInStringOrRegularExpressionOrTemplateLiteral(contextToken) ||
isIdentifierDefinitionLocation(contextToken) ||
isSolelyIdentifierDefinitionLocation(contextToken) ||
isDotOfNumericLiteral(contextToken);
log("getCompletionsAtPosition: isCompletionListBlocker: " + (new Date().getTime() - start));
return result;
}
function shouldShowCompletionsInImportsClause(node) {
if (node) {
if (node.kind === 14 || node.kind === 23) {
return node.parent.kind === 222;
}
}
return false;
}
function isNewIdentifierDefinitionLocation(previousToken) {
if (previousToken) {
var containingNodeKind = previousToken.parent.kind;
@@ -36055,23 +36095,23 @@ var ts;
}
return true;
}
function tryGetImportClauseCompletionSymbols(importClause) {
if (shouldShowCompletionsInImportsClause(contextToken)) {
isMemberCompletion = true;
isNewIdentifierLocation = false;
var importDeclaration = importClause.parent;
ts.Debug.assert(importDeclaration !== undefined && importDeclaration.kind === 219);
var exports_2;
var moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(importDeclaration.moduleSpecifier);
if (moduleSpecifierSymbol) {
exports_2 = typeChecker.getExportsOfModule(moduleSpecifierSymbol);
}
symbols = exports_2 ? filterModuleExports(exports_2, importDeclaration) : emptyArray;
function tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports) {
var declarationKind = namedImportsOrExports.kind === 222 ?
219 :
225;
var importOrExportDeclaration = ts.getAncestor(namedImportsOrExports, declarationKind);
var moduleSpecifier = importOrExportDeclaration.moduleSpecifier;
if (!moduleSpecifier) {
return false;
}
else {
isMemberCompletion = false;
isNewIdentifierLocation = true;
isMemberCompletion = true;
isNewIdentifierLocation = false;
var exports;
var moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(importOrExportDeclaration.moduleSpecifier);
if (moduleSpecifierSymbol) {
exports = typeChecker.getExportsOfModule(moduleSpecifierSymbol);
}
symbols = exports ? filterNamedImportOrExportCompletionItems(exports, namedImportsOrExports.elements) : emptyArray;
return true;
}
function tryGetObjectLikeCompletionContainer(contextToken) {
@@ -36088,6 +36128,20 @@ var ts;
}
return undefined;
}
function tryGetNamedImportsOrExportsForCompletion(contextToken) {
if (contextToken) {
switch (contextToken.kind) {
case 14:
case 23:
switch (contextToken.parent.kind) {
case 222:
case 226:
return contextToken.parent;
}
}
}
return undefined;
}
function tryGetContainingJsxElement(contextToken) {
if (contextToken) {
var parent_12 = contextToken.parent;
@@ -36127,7 +36181,7 @@ var ts;
}
return false;
}
function isIdentifierDefinitionLocation(contextToken) {
function isSolelyIdentifierDefinitionLocation(contextToken) {
var containingNodeKind = contextToken.parent.kind;
switch (contextToken.kind) {
case 23:
@@ -36173,6 +36227,10 @@ var ts;
case 107:
case 108:
return containingNodeKind === 135;
case 113:
containingNodeKind === 223 ||
containingNodeKind === 227 ||
containingNodeKind === 221;
case 70:
case 78:
case 104:
@@ -36208,25 +36266,20 @@ var ts;
}
return false;
}
function filterModuleExports(exports, importDeclaration) {
var exisingImports = {};
if (!importDeclaration.importClause) {
return exports;
function filterNamedImportOrExportCompletionItems(exportsOfModule, namedImportsOrExports) {
var exisingImportsOrExports = {};
for (var _i = 0; _i < namedImportsOrExports.length; _i++) {
var element = namedImportsOrExports[_i];
if (element.getStart() <= position && position <= element.getEnd()) {
continue;
}
var name_31 = element.propertyName || element.name;
exisingImportsOrExports[name_31.text] = true;
}
if (importDeclaration.importClause.namedBindings &&
importDeclaration.importClause.namedBindings.kind === 222) {
ts.forEach(importDeclaration.importClause.namedBindings.elements, function (el) {
if (el.getStart() <= position && position <= el.getEnd()) {
return;
}
var name = el.propertyName || el.name;
exisingImports[name.text] = true;
});
if (ts.isEmpty(exisingImportsOrExports)) {
return exportsOfModule;
}
if (ts.isEmpty(exisingImports)) {
return exports;
}
return ts.filter(exports, function (e) { return !ts.lookUp(exisingImports, e.name); });
return ts.filter(exportsOfModule, function (e) { return !ts.lookUp(exisingImportsOrExports, e.name); });
}
function filterObjectMembersList(contextualMemberSymbols, existingMembers) {
if (!existingMembers || existingMembers.length === 0) {
@@ -36252,15 +36305,9 @@ var ts;
}
existingMemberNames[existingName] = true;
}
var filteredMembers = [];
ts.forEach(contextualMemberSymbols, function (s) {
if (!existingMemberNames[s.name]) {
filteredMembers.push(s);
}
});
return filteredMembers;
return ts.filter(contextualMemberSymbols, function (m) { return !ts.lookUp(existingMemberNames, m.name); });
}
function filterJsxAttributes(attributes, symbols) {
function filterJsxAttributes(symbols, attributes) {
var seenNames = {};
for (var _i = 0; _i < attributes.length; _i++) {
var attr = attributes[_i];
@@ -36271,14 +36318,7 @@ var ts;
seenNames[attr.name.text] = true;
}
}
var result = [];
for (var _a = 0; _a < symbols.length; _a++) {
var sym = symbols[_a];
if (!seenNames[sym.name]) {
result.push(sym);
}
}
return result;
return ts.filter(symbols, function (a) { return !ts.lookUp(seenNames, a.name); });
}
}
function getCompletionsAtPosition(fileName, position) {
@@ -36310,10 +36350,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_31 in nameTable) {
if (!allNames[name_31]) {
allNames[name_31] = name_31;
var displayName = getCompletionEntryDisplayName(name_31, target, true);
for (var name_32 in nameTable) {
if (!allNames[name_32]) {
allNames[name_32] = name_32;
var displayName = getCompletionEntryDisplayName(name_32, target, true);
if (displayName) {
var entry = {
name: displayName,
@@ -37117,6 +37157,7 @@ var ts;
if (hasKind(node.parent, 142) || hasKind(node.parent, 143)) {
return getGetAndSetOccurrences(node.parent);
}
break;
default:
if (ts.isModifier(node.kind) && node.parent &&
(ts.isDeclaration(node.parent) || node.parent.kind === 190)) {
@@ -37216,12 +37257,13 @@ var ts;
var container = declaration.parent;
if (ts.isAccessibilityModifier(modifier)) {
if (!(container.kind === 211 ||
container.kind === 183 ||
(declaration.kind === 135 && hasKind(container, 141)))) {
return undefined;
}
}
else if (modifier === 110) {
if (container.kind !== 211) {
if (!(container.kind === 211 || container.kind === 183)) {
return undefined;
}
}
@@ -37230,6 +37272,11 @@ var ts;
return undefined;
}
}
else if (modifier === 112) {
if (!(container.kind === 211 || declaration.kind === 211)) {
return undefined;
}
}
else {
return undefined;
}
@@ -37239,12 +37286,18 @@ var ts;
switch (container.kind) {
case 216:
case 245:
nodes = container.statements;
if (modifierFlag & 256) {
nodes = declaration.members.concat(declaration);
}
else {
nodes = container.statements;
}
break;
case 141:
nodes = container.parameters.concat(container.parent.members);
break;
case 211:
case 183:
nodes = container.members;
if (modifierFlag & 112) {
var constructor = ts.forEach(container.members, function (member) {
@@ -37254,6 +37307,9 @@ var ts;
nodes = nodes.concat(constructor.parameters);
}
}
else if (modifierFlag & 256) {
nodes = nodes.concat(container);
}
break;
default:
ts.Debug.fail("Invalid container kind.");
@@ -37278,6 +37334,8 @@ var ts;
return 1;
case 119:
return 2;
case 112:
return 256;
default:
ts.Debug.fail();
}
@@ -37975,17 +38033,17 @@ var ts;
if (isNameOfPropertyAssignment(node)) {
var objectLiteral = node.parent.parent;
var contextualType = typeChecker.getContextualType(objectLiteral);
var name_32 = node.text;
var name_33 = node.text;
if (contextualType) {
if (contextualType.flags & 16384) {
var unionProperty = contextualType.getProperty(name_32);
var unionProperty = contextualType.getProperty(name_33);
if (unionProperty) {
return [unionProperty];
}
else {
var result_4 = [];
ts.forEach(contextualType.types, function (t) {
var symbol = t.getProperty(name_32);
var symbol = t.getProperty(name_33);
if (symbol) {
result_4.push(symbol);
}
@@ -37994,7 +38052,7 @@ var ts;
}
}
else {
var symbol_1 = contextualType.getProperty(name_32);
var symbol_1 = contextualType.getProperty(name_33);
if (symbol_1) {
return [symbol_1];
}
@@ -38593,7 +38651,7 @@ var ts;
return;
}
}
return 9;
return 2;
}
}
function processElement(element) {
@@ -39337,10 +39395,113 @@ var ts;
this.fileHash = {};
this.nextFileId = 1;
this.changeSeq = 0;
this.handlers = (_a = {},
_a[CommandNames.Exit] = function () {
_this.exit();
return {};
},
_a[CommandNames.Definition] = function (request) {
var defArgs = request.arguments;
return { response: _this.getDefinition(defArgs.line, defArgs.offset, defArgs.file) };
},
_a[CommandNames.TypeDefinition] = function (request) {
var defArgs = request.arguments;
return { response: _this.getTypeDefinition(defArgs.line, defArgs.offset, defArgs.file) };
},
_a[CommandNames.References] = function (request) {
var defArgs = request.arguments;
return { response: _this.getReferences(defArgs.line, defArgs.offset, defArgs.file) };
},
_a[CommandNames.Rename] = function (request) {
var renameArgs = request.arguments;
return { response: _this.getRenameLocations(renameArgs.line, renameArgs.offset, renameArgs.file, renameArgs.findInComments, renameArgs.findInStrings) };
},
_a[CommandNames.Open] = function (request) {
var openArgs = request.arguments;
_this.openClientFile(openArgs.file);
return {};
},
_a[CommandNames.Quickinfo] = function (request) {
var quickinfoArgs = request.arguments;
return { response: _this.getQuickInfo(quickinfoArgs.line, quickinfoArgs.offset, quickinfoArgs.file) };
},
_a[CommandNames.Format] = function (request) {
var formatArgs = request.arguments;
return { response: _this.getFormattingEditsForRange(formatArgs.line, formatArgs.offset, formatArgs.endLine, formatArgs.endOffset, formatArgs.file) };
},
_a[CommandNames.Formatonkey] = function (request) {
var formatOnKeyArgs = request.arguments;
return { response: _this.getFormattingEditsAfterKeystroke(formatOnKeyArgs.line, formatOnKeyArgs.offset, formatOnKeyArgs.key, formatOnKeyArgs.file) };
},
_a[CommandNames.Completions] = function (request) {
var completionsArgs = request.arguments;
return { response: _this.getCompletions(completionsArgs.line, completionsArgs.offset, completionsArgs.prefix, completionsArgs.file) };
},
_a[CommandNames.CompletionDetails] = function (request) {
var completionDetailsArgs = request.arguments;
return { response: _this.getCompletionEntryDetails(completionDetailsArgs.line, completionDetailsArgs.offset, completionDetailsArgs.entryNames, completionDetailsArgs.file) };
},
_a[CommandNames.SignatureHelp] = function (request) {
var signatureHelpArgs = request.arguments;
return { response: _this.getSignatureHelpItems(signatureHelpArgs.line, signatureHelpArgs.offset, signatureHelpArgs.file) };
},
_a[CommandNames.Geterr] = function (request) {
var geterrArgs = request.arguments;
return { response: _this.getDiagnostics(geterrArgs.delay, geterrArgs.files), responseRequired: false };
},
_a[CommandNames.Change] = function (request) {
var changeArgs = request.arguments;
_this.change(changeArgs.line, changeArgs.offset, changeArgs.endLine, changeArgs.endOffset, changeArgs.insertString, changeArgs.file);
return { responseRequired: false };
},
_a[CommandNames.Configure] = function (request) {
var configureArgs = request.arguments;
_this.projectService.setHostConfiguration(configureArgs);
_this.output(undefined, CommandNames.Configure, request.seq);
return { responseRequired: false };
},
_a[CommandNames.Reload] = function (request) {
var reloadArgs = request.arguments;
_this.reload(reloadArgs.file, reloadArgs.tmpfile, request.seq);
return { responseRequired: false };
},
_a[CommandNames.Saveto] = function (request) {
var savetoArgs = request.arguments;
_this.saveToTmp(savetoArgs.file, savetoArgs.tmpfile);
return { responseRequired: false };
},
_a[CommandNames.Close] = function (request) {
var closeArgs = request.arguments;
_this.closeClientFile(closeArgs.file);
return { responseRequired: false };
},
_a[CommandNames.Navto] = function (request) {
var navtoArgs = request.arguments;
return { response: _this.getNavigateToItems(navtoArgs.searchValue, navtoArgs.file, navtoArgs.maxResultCount) };
},
_a[CommandNames.Brace] = function (request) {
var braceArguments = request.arguments;
return { response: _this.getBraceMatching(braceArguments.line, braceArguments.offset, braceArguments.file) };
},
_a[CommandNames.NavBar] = function (request) {
var navBarArgs = request.arguments;
return { response: _this.getNavigationBarItems(navBarArgs.file) };
},
_a[CommandNames.Occurrences] = function (request) {
var _a = request.arguments, line = _a.line, offset = _a.offset, fileName = _a.file;
return { response: _this.getOccurrences(line, offset, fileName) };
},
_a[CommandNames.ProjectInfo] = function (request) {
var _a = request.arguments, file = _a.file, needFileNameList = _a.needFileNameList;
return { response: _this.getProjectInfo(file, needFileNameList) };
},
_a
);
this.projectService =
new server.ProjectService(host, logger, function (eventName, project, fileName) {
_this.handleEvent(eventName, project, fileName);
});
var _a;
}
Session.prototype.handleEvent = function (eventName, project, fileName) {
var _this = this;
@@ -39957,6 +40118,23 @@ var ts;
};
Session.prototype.exit = function () {
};
Session.prototype.addProtocolHandler = function (command, handler) {
if (this.handlers[command]) {
throw new Error("Protocol handler already exists for command \"" + command + "\"");
}
this.handlers[command] = handler;
};
Session.prototype.executeCommand = function (request) {
var handler = this.handlers[request.command];
if (handler) {
return handler(request);
}
else {
this.projectService.log("Unrecognized JSON command: " + JSON.stringify(request));
this.output(undefined, CommandNames.Unknown, request.seq, "Unrecognized JSON command: " + request.command);
return { responseRequired: false };
}
};
Session.prototype.onMessage = function (message) {
if (this.logger.isVerbose()) {
this.logger.info("request: " + message);
@@ -39964,140 +40142,7 @@ var ts;
}
try {
var request = JSON.parse(message);
var response;
var errorMessage;
var responseRequired = true;
switch (request.command) {
case CommandNames.Exit: {
this.exit();
responseRequired = false;
break;
}
case CommandNames.Definition: {
var defArgs = request.arguments;
response = this.getDefinition(defArgs.line, defArgs.offset, defArgs.file);
break;
}
case CommandNames.TypeDefinition: {
var defArgs = request.arguments;
response = this.getTypeDefinition(defArgs.line, defArgs.offset, defArgs.file);
break;
}
case CommandNames.References: {
var refArgs = request.arguments;
response = this.getReferences(refArgs.line, refArgs.offset, refArgs.file);
break;
}
case CommandNames.Rename: {
var renameArgs = request.arguments;
response = this.getRenameLocations(renameArgs.line, renameArgs.offset, renameArgs.file, renameArgs.findInComments, renameArgs.findInStrings);
break;
}
case CommandNames.Open: {
var openArgs = request.arguments;
this.openClientFile(openArgs.file);
responseRequired = false;
break;
}
case CommandNames.Quickinfo: {
var quickinfoArgs = request.arguments;
response = this.getQuickInfo(quickinfoArgs.line, quickinfoArgs.offset, quickinfoArgs.file);
break;
}
case CommandNames.Format: {
var formatArgs = request.arguments;
response = this.getFormattingEditsForRange(formatArgs.line, formatArgs.offset, formatArgs.endLine, formatArgs.endOffset, formatArgs.file);
break;
}
case CommandNames.Formatonkey: {
var formatOnKeyArgs = request.arguments;
response = this.getFormattingEditsAfterKeystroke(formatOnKeyArgs.line, formatOnKeyArgs.offset, formatOnKeyArgs.key, formatOnKeyArgs.file);
break;
}
case CommandNames.Completions: {
var completionsArgs = request.arguments;
response = this.getCompletions(completionsArgs.line, completionsArgs.offset, completionsArgs.prefix, completionsArgs.file);
break;
}
case CommandNames.CompletionDetails: {
var completionDetailsArgs = request.arguments;
response =
this.getCompletionEntryDetails(completionDetailsArgs.line, completionDetailsArgs.offset, completionDetailsArgs.entryNames, completionDetailsArgs.file);
break;
}
case CommandNames.SignatureHelp: {
var signatureHelpArgs = request.arguments;
response = this.getSignatureHelpItems(signatureHelpArgs.line, signatureHelpArgs.offset, signatureHelpArgs.file);
break;
}
case CommandNames.Geterr: {
var geterrArgs = request.arguments;
response = this.getDiagnostics(geterrArgs.delay, geterrArgs.files);
responseRequired = false;
break;
}
case CommandNames.Change: {
var changeArgs = request.arguments;
this.change(changeArgs.line, changeArgs.offset, changeArgs.endLine, changeArgs.endOffset, changeArgs.insertString, changeArgs.file);
responseRequired = false;
break;
}
case CommandNames.Configure: {
var configureArgs = request.arguments;
this.projectService.setHostConfiguration(configureArgs);
this.output(undefined, CommandNames.Configure, request.seq);
responseRequired = false;
break;
}
case CommandNames.Reload: {
var reloadArgs = request.arguments;
this.reload(reloadArgs.file, reloadArgs.tmpfile, request.seq);
responseRequired = false;
break;
}
case CommandNames.Saveto: {
var savetoArgs = request.arguments;
this.saveToTmp(savetoArgs.file, savetoArgs.tmpfile);
responseRequired = false;
break;
}
case CommandNames.Close: {
var closeArgs = request.arguments;
this.closeClientFile(closeArgs.file);
responseRequired = false;
break;
}
case CommandNames.Navto: {
var navtoArgs = request.arguments;
response = this.getNavigateToItems(navtoArgs.searchValue, navtoArgs.file, navtoArgs.maxResultCount);
break;
}
case CommandNames.Brace: {
var braceArguments = request.arguments;
response = this.getBraceMatching(braceArguments.line, braceArguments.offset, braceArguments.file);
break;
}
case CommandNames.NavBar: {
var navBarArgs = request.arguments;
response = this.getNavigationBarItems(navBarArgs.file);
break;
}
case CommandNames.Occurrences: {
var _a = request.arguments, line = _a.line, offset = _a.offset, fileName = _a.file;
response = this.getOccurrences(line, offset, fileName);
break;
}
case CommandNames.ProjectInfo: {
var _b = request.arguments, file = _b.file, needFileNameList = _b.needFileNameList;
response = this.getProjectInfo(file, needFileNameList);
break;
}
default: {
this.projectService.log("Unrecognized JSON command: " + message);
this.output(undefined, CommandNames.Unknown, request.seq, "Unrecognized JSON command: " + request.command);
break;
}
}
var _a = this.executeCommand(request), response = _a.response, responseRequired = _a.responseRequired;
if (this.logger.isVerbose()) {
var elapsed = this.hrtime(start);
var seconds = elapsed[0];
@@ -42027,6 +42072,11 @@ var ts;
var decoded = JSON.parse(encoded);
return ts.createTextChangeRange(ts.createTextSpan(decoded.span.start, decoded.span.length), decoded.newLength);
};
ScriptSnapshotShimAdapter.prototype.dispose = function () {
if ("dispose" in this.scriptSnapshotShim) {
this.scriptSnapshotShim.dispose();
}
};
return ScriptSnapshotShimAdapter;
})();
var LanguageServiceShimHostAdapter = (function () {
+2
View File
@@ -1591,6 +1591,8 @@ declare module "typescript" {
* not happen and the entire document will be re - parsed.
*/
getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange;
/** Releases all resources held by this script snapshot */
dispose?(): void;
}
module ScriptSnapshot {
function fromString(text: string): IScriptSnapshot;
+243 -129
View File
@@ -1775,8 +1775,15 @@ var ts;
newLine: _os.EOL,
useCaseSensitiveFileNames: useCaseSensitiveFileNames,
write: function (s) {
var buffer = new Buffer(s, 'utf8');
var offset = 0;
var toWrite = buffer.length;
var written = 0;
// 1 is a standard descriptor for stdout
_fs.writeSync(1, s);
while ((written = _fs.writeSync(1, buffer, offset, toWrite)) < toWrite) {
offset += written;
toWrite -= written;
}
},
readFile: readFile,
writeFile: writeFile,
@@ -2247,7 +2254,7 @@ var ts;
Classes_containing_abstract_methods_must_be_marked_abstract: { code: 2514, category: ts.DiagnosticCategory.Error, key: "Classes containing abstract methods must be marked abstract." },
Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2: { code: 2515, category: ts.DiagnosticCategory.Error, key: "Non-abstract class '{0}' does not implement inherited abstract member '{1}' from class '{2}'." },
All_declarations_of_an_abstract_method_must_be_consecutive: { code: 2516, category: ts.DiagnosticCategory.Error, key: "All declarations of an abstract method must be consecutive." },
Constructor_objects_of_abstract_type_cannot_be_assigned_to_constructor_objects_of_non_abstract_type: { code: 2517, category: ts.DiagnosticCategory.Error, key: "Constructor objects of abstract type cannot be assigned to constructor objects of non-abstract type" },
Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type: { code: 2517, category: ts.DiagnosticCategory.Error, key: "Cannot assign an abstract constructor type to a non-abstract constructor type." },
Only_an_ambient_class_can_be_merged_with_an_interface: { code: 2518, category: ts.DiagnosticCategory.Error, key: "Only an ambient class can be merged with an interface." },
Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions: { code: 2520, category: ts.DiagnosticCategory.Error, key: "Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions." },
Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions: { code: 2521, category: ts.DiagnosticCategory.Error, key: "Expression resolves to variable declaration '{0}' that compiler uses to support async functions." },
@@ -11517,7 +11524,11 @@ var ts;
}
else {
node.exportClause = parseNamedImportsOrExports(226 /* NamedExports */);
if (parseOptional(130 /* FromKeyword */)) {
// It is not uncommon to accidentally omit the 'from' keyword. Additionally, in editing scenarios,
// the 'from' keyword can be parsed as a named export when the export clause is unterminated (i.e. `export { from "moduleName";`)
// If we don't have a 'from' keyword, see if we have a string literal such that ASI won't take effect.
if (token === 130 /* FromKeyword */ || (token === 8 /* StringLiteral */ && !scanner.hasPrecedingLineBreak())) {
parseExpected(130 /* FromKeyword */);
node.moduleSpecifier = parseModuleSpecifier();
}
}
@@ -16299,7 +16310,7 @@ var ts;
var id = getTypeListId(elementTypes);
var type = tupleTypes[id];
if (!type) {
type = tupleTypes[id] = createObjectType(8192 /* Tuple */);
type = tupleTypes[id] = createObjectType(8192 /* Tuple */ | getWideningFlagsOfTypes(elementTypes));
type.elementTypes = elementTypes;
}
return type;
@@ -17200,10 +17211,33 @@ var ts;
var targetSignatures = getSignaturesOfType(target, kind);
var result = -1 /* True */;
var saveErrorInfo = errorInfo;
// Because the "abstractness" of a class is the same across all construct signatures
// (internally we are checking the corresponding declaration), it is enough to perform
// the check and report an error once over all pairs of source and target construct signatures.
var sourceSig = sourceSignatures[0];
// Note that in an extends-clause, targetSignatures is stripped, so the check never proceeds.
var targetSig = targetSignatures[0];
if (sourceSig && targetSig) {
var sourceErasedSignature = getErasedSignature(sourceSig);
var targetErasedSignature = getErasedSignature(targetSig);
var sourceReturnType = sourceErasedSignature && getReturnTypeOfSignature(sourceErasedSignature);
var targetReturnType = targetErasedSignature && getReturnTypeOfSignature(targetErasedSignature);
var sourceReturnDecl = sourceReturnType && sourceReturnType.symbol && ts.getDeclarationOfKind(sourceReturnType.symbol, 211 /* ClassDeclaration */);
var targetReturnDecl = targetReturnType && targetReturnType.symbol && ts.getDeclarationOfKind(targetReturnType.symbol, 211 /* ClassDeclaration */);
var sourceIsAbstract = sourceReturnDecl && sourceReturnDecl.flags & 256 /* Abstract */;
var targetIsAbstract = targetReturnDecl && targetReturnDecl.flags & 256 /* Abstract */;
if (sourceIsAbstract && !targetIsAbstract) {
if (reportErrors) {
reportError(ts.Diagnostics.Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type);
}
return 0 /* False */;
}
}
outer: for (var _i = 0; _i < targetSignatures.length; _i++) {
var t = targetSignatures[_i];
if (!t.hasStringLiterals || target.flags & 262144 /* FromSignature */) {
var localErrors = reportErrors;
var checkedAbstractAssignability = false;
for (var _a = 0; _a < sourceSignatures.length; _a++) {
var s = sourceSignatures[_a];
if (!s.hasStringLiterals || source.flags & 262144 /* FromSignature */) {
@@ -17254,12 +17288,12 @@ var ts;
target = getErasedSignature(target);
var result = -1 /* True */;
for (var i = 0; i < checkCount; i++) {
var s_1 = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source);
var t_1 = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target);
var s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source);
var t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target);
var saveErrorInfo = errorInfo;
var related = isRelatedTo(s_1, t_1, reportErrors);
var related = isRelatedTo(s, t, reportErrors);
if (!related) {
related = isRelatedTo(t_1, s_1, false);
related = isRelatedTo(t, s, false);
if (!related) {
if (reportErrors) {
reportError(ts.Diagnostics.Types_of_parameters_0_and_1_are_incompatible, source.parameters[i < sourceMax ? i : sourceMax].name, target.parameters[i < targetMax ? i : targetMax].name);
@@ -17297,11 +17331,11 @@ var ts;
}
return 0 /* False */;
}
var t = getReturnTypeOfSignature(target);
if (t === voidType)
var targetReturnType = getReturnTypeOfSignature(target);
if (targetReturnType === voidType)
return result;
var s = getReturnTypeOfSignature(source);
return result & isRelatedTo(s, t, reportErrors);
var sourceReturnType = getReturnTypeOfSignature(source);
return result & isRelatedTo(sourceReturnType, targetReturnType, reportErrors);
}
function signaturesIdenticalTo(source, target, kind) {
var sourceSignatures = getSignaturesOfType(source, kind);
@@ -17537,7 +17571,7 @@ var ts;
* Prefer using isTupleLikeType() unless the use of `elementTypes` is required.
*/
function isTupleType(type) {
return (type.flags & 8192 /* Tuple */) && !!type.elementTypes;
return !!(type.flags & 8192 /* Tuple */);
}
function getWidenedTypeOfObjectLiteral(type) {
var properties = getPropertiesOfObjectType(type);
@@ -17579,25 +17613,47 @@ var ts;
if (isArrayType(type)) {
return createArrayType(getWidenedType(type.typeArguments[0]));
}
if (isTupleType(type)) {
return createTupleType(ts.map(type.elementTypes, getWidenedType));
}
}
return type;
}
/**
* Reports implicit any errors that occur as a result of widening 'null' and 'undefined'
* to 'any'. A call to reportWideningErrorsInType is normally accompanied by a call to
* getWidenedType. But in some cases getWidenedType is called without reporting errors
* (type argument inference is an example).
*
* The return value indicates whether an error was in fact reported. The particular circumstances
* are on a best effort basis. Currently, if the null or undefined that causes widening is inside
* an object literal property (arbitrarily deeply), this function reports an error. If no error is
* reported, reportImplicitAnyError is a suitable fallback to report a general error.
*/
function reportWideningErrorsInType(type) {
var errorReported = false;
if (type.flags & 16384 /* Union */) {
var errorReported = false;
ts.forEach(type.types, function (t) {
for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
var t = _a[_i];
if (reportWideningErrorsInType(t)) {
errorReported = true;
}
});
return errorReported;
}
}
if (isArrayType(type)) {
return reportWideningErrorsInType(type.typeArguments[0]);
}
if (isTupleType(type)) {
for (var _b = 0, _c = type.elementTypes; _b < _c.length; _b++) {
var t = _c[_b];
if (reportWideningErrorsInType(t)) {
errorReported = true;
}
}
}
if (type.flags & 524288 /* ObjectLiteral */) {
var errorReported = false;
ts.forEach(getPropertiesOfObjectType(type), function (p) {
for (var _d = 0, _e = getPropertiesOfObjectType(type); _d < _e.length; _d++) {
var p = _e[_d];
var t = getTypeOfSymbol(p);
if (t.flags & 1048576 /* ContainsUndefinedOrNull */) {
if (!reportWideningErrorsInType(t)) {
@@ -17605,10 +17661,9 @@ var ts;
}
errorReported = true;
}
});
return errorReported;
}
}
return false;
return errorReported;
}
function reportImplicitAnyError(declaration, type) {
var typeAsString = typeToString(getWidenedType(type));
@@ -17771,29 +17826,32 @@ var ts;
inferFromTypes(sourceType, target);
}
}
else if (source.flags & 80896 /* ObjectType */ && (target.flags & (4096 /* Reference */ | 8192 /* Tuple */) ||
(target.flags & 65536 /* Anonymous */) && target.symbol && target.symbol.flags & (8192 /* Method */ | 2048 /* TypeLiteral */ | 32 /* Class */))) {
// If source is an object type, and target is a type reference, a tuple type, the type of a method, or a type literal, infer from members
if (isInProcess(source, target)) {
return;
else {
source = getApparentType(source);
if (source.flags & 80896 /* ObjectType */ && (target.flags & (4096 /* Reference */ | 8192 /* Tuple */) ||
(target.flags & 65536 /* Anonymous */) && target.symbol && target.symbol.flags & (8192 /* Method */ | 2048 /* TypeLiteral */ | 32 /* Class */))) {
// If source is an object type, and target is a type reference, a tuple type, the type of a method, or a type literal, infer from members
if (isInProcess(source, target)) {
return;
}
if (isDeeplyNestedGeneric(source, sourceStack, depth) && isDeeplyNestedGeneric(target, targetStack, depth)) {
return;
}
if (depth === 0) {
sourceStack = [];
targetStack = [];
}
sourceStack[depth] = source;
targetStack[depth] = target;
depth++;
inferFromProperties(source, target);
inferFromSignatures(source, target, 0 /* Call */);
inferFromSignatures(source, target, 1 /* Construct */);
inferFromIndexTypes(source, target, 0 /* String */, 0 /* String */);
inferFromIndexTypes(source, target, 1 /* Number */, 1 /* Number */);
inferFromIndexTypes(source, target, 0 /* String */, 1 /* Number */);
depth--;
}
if (isDeeplyNestedGeneric(source, sourceStack, depth) && isDeeplyNestedGeneric(target, targetStack, depth)) {
return;
}
if (depth === 0) {
sourceStack = [];
targetStack = [];
}
sourceStack[depth] = source;
targetStack[depth] = target;
depth++;
inferFromProperties(source, target);
inferFromSignatures(source, target, 0 /* Call */);
inferFromSignatures(source, target, 1 /* Construct */);
inferFromIndexTypes(source, target, 0 /* String */, 0 /* String */);
inferFromIndexTypes(source, target, 1 /* Number */, 1 /* Number */);
inferFromIndexTypes(source, target, 0 /* String */, 1 /* Number */);
depth--;
}
}
function inferFromProperties(source, target) {
@@ -37768,8 +37826,8 @@ var ts;
var pos = scanner.getStartPos();
// Read leading trivia and token
while (pos < endPos) {
var t_2 = scanner.getToken();
if (!ts.isTrivia(t_2)) {
var t_1 = scanner.getToken();
if (!ts.isTrivia(t_1)) {
break;
}
// consume leading trivia
@@ -37777,7 +37835,7 @@ var ts;
var item = {
pos: pos,
end: scanner.getStartPos(),
kind: t_2
kind: t_1
};
pos = scanner.getStartPos();
if (!leadingTrivia) {
@@ -39359,6 +39417,8 @@ var ts;
case 15 /* CloseBraceToken */:
case 18 /* OpenBracketToken */:
case 19 /* CloseBracketToken */:
case 16 /* OpenParenToken */:
case 17 /* CloseParenToken */:
case 77 /* ElseKeyword */:
case 101 /* WhileKeyword */:
case 53 /* AtToken */:
@@ -39483,7 +39543,7 @@ var ts;
else if (tokenInfo.token.kind === listStartToken) {
// consume list start token
startLine = sourceFile.getLineAndCharacterOfPosition(tokenInfo.token.pos).line;
var indentation_1 = computeIndentation(tokenInfo.token, startLine, -1 /* Unknown */, parent, parentDynamicIndentation, startLine);
var indentation_1 = computeIndentation(tokenInfo.token, startLine, -1 /* Unknown */, parent, parentDynamicIndentation, parentStartLine);
listDynamicIndentation = getDynamicIndentation(parent, parentStartLine, indentation_1.indentation, indentation_1.delta);
consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation);
}
@@ -41389,6 +41449,13 @@ var ts;
// after incremental parsing nameTable might not be up-to-date
// drop it so it can be lazily recreated later
newSourceFile.nameTable = undefined;
// dispose all resources held by old script snapshot
if (sourceFile !== newSourceFile && sourceFile.scriptSnapshot) {
if (sourceFile.scriptSnapshot.dispose) {
sourceFile.scriptSnapshot.dispose();
}
sourceFile.scriptSnapshot = undefined;
}
return newSourceFile;
}
}
@@ -42410,15 +42477,15 @@ var ts;
}
function tryGetGlobalSymbols() {
var objectLikeContainer;
var importClause;
var namedImportsOrExports;
var jsxContainer;
if (objectLikeContainer = tryGetObjectLikeCompletionContainer(contextToken)) {
return tryGetObjectLikeCompletionSymbols(objectLikeContainer);
}
if (importClause = ts.getAncestor(contextToken, 220 /* ImportClause */)) {
if (namedImportsOrExports = tryGetNamedImportsOrExportsForCompletion(contextToken)) {
// cursor is in an import clause
// try to show exported member for imported module
return tryGetImportClauseCompletionSymbols(importClause);
return tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports);
}
if (jsxContainer = tryGetContainingJsxElement(contextToken)) {
var attrsType;
@@ -42426,7 +42493,7 @@ var ts;
// Cursor is inside a JSX self-closing element or opening element
attrsType = typeChecker.getJsxElementAttributesType(jsxContainer);
if (attrsType) {
symbols = filterJsxAttributes(jsxContainer.attributes, typeChecker.getPropertiesOfType(attrsType));
symbols = filterJsxAttributes(typeChecker.getPropertiesOfType(attrsType), jsxContainer.attributes);
isMemberCompletion = true;
isNewIdentifierLocation = false;
return true;
@@ -42487,21 +42554,11 @@ var ts;
function isCompletionListBlocker(contextToken) {
var start = new Date().getTime();
var result = isInStringOrRegularExpressionOrTemplateLiteral(contextToken) ||
isIdentifierDefinitionLocation(contextToken) ||
isSolelyIdentifierDefinitionLocation(contextToken) ||
isDotOfNumericLiteral(contextToken);
log("getCompletionsAtPosition: isCompletionListBlocker: " + (new Date().getTime() - start));
return result;
}
function shouldShowCompletionsInImportsClause(node) {
if (node) {
// import {|
// import {a,|
if (node.kind === 14 /* OpenBraceToken */ || node.kind === 23 /* CommaToken */) {
return node.parent.kind === 222 /* NamedImports */;
}
}
return false;
}
function isNewIdentifierDefinitionLocation(previousToken) {
if (previousToken) {
var containingNodeKind = previousToken.parent.kind;
@@ -42610,34 +42667,37 @@ var ts;
return true;
}
/**
* Aggregates relevant symbols for completion in import clauses; for instance,
* Aggregates relevant symbols for completion in import clauses and export clauses
* whose declarations have a module specifier; for instance, symbols will be aggregated for
*
* import { $ } from "moduleName";
* import { | } from "moduleName";
* export { a as foo, | } from "moduleName";
*
* but not for
*
* export { | };
*
* Relevant symbols are stored in the captured 'symbols' variable.
*
* @returns true if 'symbols' was successfully populated; false otherwise.
*/
function tryGetImportClauseCompletionSymbols(importClause) {
// cursor is in import clause
// try to show exported member for imported module
if (shouldShowCompletionsInImportsClause(contextToken)) {
isMemberCompletion = true;
isNewIdentifierLocation = false;
var importDeclaration = importClause.parent;
ts.Debug.assert(importDeclaration !== undefined && importDeclaration.kind === 219 /* ImportDeclaration */);
var exports;
var moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(importDeclaration.moduleSpecifier);
if (moduleSpecifierSymbol) {
exports = typeChecker.getExportsOfModule(moduleSpecifierSymbol);
}
//let exports = typeInfoResolver.getExportsOfImportDeclaration(importDeclaration);
symbols = exports ? filterModuleExports(exports, importDeclaration) : emptyArray;
function tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports) {
var declarationKind = namedImportsOrExports.kind === 222 /* NamedImports */ ?
219 /* ImportDeclaration */ :
225 /* ExportDeclaration */;
var importOrExportDeclaration = ts.getAncestor(namedImportsOrExports, declarationKind);
var moduleSpecifier = importOrExportDeclaration.moduleSpecifier;
if (!moduleSpecifier) {
return false;
}
else {
isMemberCompletion = false;
isNewIdentifierLocation = true;
isMemberCompletion = true;
isNewIdentifierLocation = false;
var exports;
var moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(importOrExportDeclaration.moduleSpecifier);
if (moduleSpecifierSymbol) {
exports = typeChecker.getExportsOfModule(moduleSpecifierSymbol);
}
symbols = exports ? filterNamedImportOrExportCompletionItems(exports, namedImportsOrExports.elements) : emptyArray;
return true;
}
/**
@@ -42658,6 +42718,24 @@ var ts;
}
return undefined;
}
/**
* Returns the containing list of named imports or exports of a context token,
* on the condition that one exists and that the context implies completion should be given.
*/
function tryGetNamedImportsOrExportsForCompletion(contextToken) {
if (contextToken) {
switch (contextToken.kind) {
case 14 /* OpenBraceToken */: // import { |
case 23 /* CommaToken */:
switch (contextToken.parent.kind) {
case 222 /* NamedImports */:
case 226 /* NamedExports */:
return contextToken.parent;
}
}
}
return undefined;
}
function tryGetContainingJsxElement(contextToken) {
if (contextToken) {
var parent_12 = contextToken.parent;
@@ -42700,7 +42778,10 @@ var ts;
}
return false;
}
function isIdentifierDefinitionLocation(contextToken) {
/**
* @returns true if we are certain that the currently edited location must define a new location; false otherwise.
*/
function isSolelyIdentifierDefinitionLocation(contextToken) {
var containingNodeKind = contextToken.parent.kind;
switch (contextToken.kind) {
case 23 /* CommaToken */:
@@ -42746,6 +42827,10 @@ var ts;
case 107 /* PrivateKeyword */:
case 108 /* ProtectedKeyword */:
return containingNodeKind === 135 /* Parameter */;
case 113 /* AsKeyword */:
containingNodeKind === 223 /* ImportSpecifier */ ||
containingNodeKind === 227 /* ExportSpecifier */ ||
containingNodeKind === 221 /* NamespaceImport */;
case 70 /* ClassKeyword */:
case 78 /* EnumKeyword */:
case 104 /* InterfaceKeyword */:
@@ -42782,27 +42867,37 @@ var ts;
}
return false;
}
function filterModuleExports(exports, importDeclaration) {
var exisingImports = {};
if (!importDeclaration.importClause) {
return exports;
/**
* Filters out completion suggestions for named imports or exports.
*
* @param exportsOfModule The list of symbols which a module exposes.
* @param namedImportsOrExports The list of existing import/export specifiers in the import/export clause.
*
* @returns Symbols to be suggested at an import/export clause, barring those whose named imports/exports
* do not occur at the current position and have not otherwise been typed.
*/
function filterNamedImportOrExportCompletionItems(exportsOfModule, namedImportsOrExports) {
var exisingImportsOrExports = {};
for (var _i = 0; _i < namedImportsOrExports.length; _i++) {
var element = namedImportsOrExports[_i];
// If this is the current item we are editing right now, do not filter it out
if (element.getStart() <= position && position <= element.getEnd()) {
continue;
}
var name_31 = element.propertyName || element.name;
exisingImportsOrExports[name_31.text] = true;
}
if (importDeclaration.importClause.namedBindings &&
importDeclaration.importClause.namedBindings.kind === 222 /* NamedImports */) {
ts.forEach(importDeclaration.importClause.namedBindings.elements, function (el) {
// If this is the current item we are editing right now, do not filter it out
if (el.getStart() <= position && position <= el.getEnd()) {
return;
}
var name = el.propertyName || el.name;
exisingImports[name.text] = true;
});
if (ts.isEmpty(exisingImportsOrExports)) {
return exportsOfModule;
}
if (ts.isEmpty(exisingImports)) {
return exports;
}
return ts.filter(exports, function (e) { return !ts.lookUp(exisingImports, e.name); });
return ts.filter(exportsOfModule, function (e) { return !ts.lookUp(exisingImportsOrExports, e.name); });
}
/**
* Filters out completion suggestions for named imports or exports.
*
* @returns Symbols to be suggested in an object binding pattern or object literal expression, barring those whose declarations
* do not occur at the current position and have not otherwise been typed.
*/
function filterObjectMembersList(contextualMemberSymbols, existingMembers) {
if (!existingMembers || existingMembers.length === 0) {
return contextualMemberSymbols;
@@ -42832,15 +42927,15 @@ var ts;
}
existingMemberNames[existingName] = true;
}
var filteredMembers = [];
ts.forEach(contextualMemberSymbols, function (s) {
if (!existingMemberNames[s.name]) {
filteredMembers.push(s);
}
});
return filteredMembers;
return ts.filter(contextualMemberSymbols, function (m) { return !ts.lookUp(existingMemberNames, m.name); });
}
function filterJsxAttributes(attributes, symbols) {
/**
* Filters out completion suggestions from 'symbols' according to existing JSX attributes.
*
* @returns Symbols to be suggested in a JSX element, barring those whose attributes
* do not occur at the current position and have not otherwise been typed.
*/
function filterJsxAttributes(symbols, attributes) {
var seenNames = {};
for (var _i = 0; _i < attributes.length; _i++) {
var attr = attributes[_i];
@@ -42852,14 +42947,7 @@ var ts;
seenNames[attr.name.text] = true;
}
}
var result = [];
for (var _a = 0; _a < symbols.length; _a++) {
var sym = symbols[_a];
if (!seenNames[sym.name]) {
result.push(sym);
}
}
return result;
return ts.filter(symbols, function (a) { return !ts.lookUp(seenNames, a.name); });
}
}
function getCompletionsAtPosition(fileName, position) {
@@ -42892,10 +42980,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_31 in nameTable) {
if (!allNames[name_31]) {
allNames[name_31] = name_31;
var displayName = getCompletionEntryDisplayName(name_31, target, true);
for (var name_32 in nameTable) {
if (!allNames[name_32]) {
allNames[name_32] = name_32;
var displayName = getCompletionEntryDisplayName(name_32, target, true);
if (displayName) {
var entry = {
name: displayName,
@@ -43764,6 +43852,7 @@ var ts;
if (hasKind(node.parent, 142 /* GetAccessor */) || hasKind(node.parent, 143 /* SetAccessor */)) {
return getGetAndSetOccurrences(node.parent);
}
break;
default:
if (ts.isModifier(node.kind) && node.parent &&
(ts.isDeclaration(node.parent) || node.parent.kind === 190 /* VariableStatement */)) {
@@ -43879,12 +43968,13 @@ var ts;
// Make sure we only highlight the keyword when it makes sense to do so.
if (ts.isAccessibilityModifier(modifier)) {
if (!(container.kind === 211 /* ClassDeclaration */ ||
container.kind === 183 /* ClassExpression */ ||
(declaration.kind === 135 /* Parameter */ && hasKind(container, 141 /* Constructor */)))) {
return undefined;
}
}
else if (modifier === 110 /* StaticKeyword */) {
if (container.kind !== 211 /* ClassDeclaration */) {
if (!(container.kind === 211 /* ClassDeclaration */ || container.kind === 183 /* ClassExpression */)) {
return undefined;
}
}
@@ -43893,6 +43983,11 @@ var ts;
return undefined;
}
}
else if (modifier === 112 /* AbstractKeyword */) {
if (!(container.kind === 211 /* ClassDeclaration */ || declaration.kind === 211 /* ClassDeclaration */)) {
return undefined;
}
}
else {
// unsupported modifier
return undefined;
@@ -43903,12 +43998,19 @@ var ts;
switch (container.kind) {
case 216 /* ModuleBlock */:
case 245 /* SourceFile */:
nodes = container.statements;
// Container is either a class declaration or the declaration is a classDeclaration
if (modifierFlag & 256 /* Abstract */) {
nodes = declaration.members.concat(declaration);
}
else {
nodes = container.statements;
}
break;
case 141 /* Constructor */:
nodes = container.parameters.concat(container.parent.members);
break;
case 211 /* ClassDeclaration */:
case 183 /* ClassExpression */:
nodes = container.members;
// If we're an accessibility modifier, we're in an instance member and should search
// the constructor's parameter list for instance members as well.
@@ -43920,6 +44022,9 @@ var ts;
nodes = nodes.concat(constructor.parameters);
}
}
else if (modifierFlag & 256 /* Abstract */) {
nodes = nodes.concat(container);
}
break;
default:
ts.Debug.fail("Invalid container kind.");
@@ -43944,6 +44049,8 @@ var ts;
return 1 /* Export */;
case 119 /* DeclareKeyword */:
return 2 /* Ambient */;
case 112 /* AbstractKeyword */:
return 256 /* Abstract */;
default:
ts.Debug.fail();
}
@@ -44761,19 +44868,19 @@ var ts;
if (isNameOfPropertyAssignment(node)) {
var objectLiteral = node.parent.parent;
var contextualType = typeChecker.getContextualType(objectLiteral);
var name_32 = node.text;
var name_33 = 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_32);
var unionProperty = contextualType.getProperty(name_33);
if (unionProperty) {
return [unionProperty];
}
else {
var result_4 = [];
ts.forEach(contextualType.types, function (t) {
var symbol = t.getProperty(name_32);
var symbol = t.getProperty(name_33);
if (symbol) {
result_4.push(symbol);
}
@@ -44782,7 +44889,7 @@ var ts;
}
}
else {
var symbol_1 = contextualType.getProperty(name_32);
var symbol_1 = contextualType.getProperty(name_33);
if (symbol_1) {
return [symbol_1];
}
@@ -45464,7 +45571,7 @@ var ts;
return;
}
}
return 9 /* text */;
return 2 /* identifier */;
}
}
function processElement(element) {
@@ -46760,6 +46867,13 @@ var ts;
var decoded = JSON.parse(encoded);
return ts.createTextChangeRange(ts.createTextSpan(decoded.span.start, decoded.span.length), decoded.newLength);
};
ScriptSnapshotShimAdapter.prototype.dispose = function () {
// if scriptSnapshotShim is a COM object then property check becomes method call with no arguments
// 'in' does not have this effect
if ("dispose" in this.scriptSnapshotShim) {
this.scriptSnapshotShim.dispose();
}
};
return ScriptSnapshotShimAdapter;
})();
var LanguageServiceShimHostAdapter = (function () {
+2
View File
@@ -1591,6 +1591,8 @@ declare namespace ts {
* not happen and the entire document will be re - parsed.
*/
getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange;
/** Releases all resources held by this script snapshot */
dispose?(): void;
}
module ScriptSnapshot {
function fromString(text: string): IScriptSnapshot;
+243 -129
View File
@@ -1775,8 +1775,15 @@ var ts;
newLine: _os.EOL,
useCaseSensitiveFileNames: useCaseSensitiveFileNames,
write: function (s) {
var buffer = new Buffer(s, 'utf8');
var offset = 0;
var toWrite = buffer.length;
var written = 0;
// 1 is a standard descriptor for stdout
_fs.writeSync(1, s);
while ((written = _fs.writeSync(1, buffer, offset, toWrite)) < toWrite) {
offset += written;
toWrite -= written;
}
},
readFile: readFile,
writeFile: writeFile,
@@ -2247,7 +2254,7 @@ var ts;
Classes_containing_abstract_methods_must_be_marked_abstract: { code: 2514, category: ts.DiagnosticCategory.Error, key: "Classes containing abstract methods must be marked abstract." },
Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2: { code: 2515, category: ts.DiagnosticCategory.Error, key: "Non-abstract class '{0}' does not implement inherited abstract member '{1}' from class '{2}'." },
All_declarations_of_an_abstract_method_must_be_consecutive: { code: 2516, category: ts.DiagnosticCategory.Error, key: "All declarations of an abstract method must be consecutive." },
Constructor_objects_of_abstract_type_cannot_be_assigned_to_constructor_objects_of_non_abstract_type: { code: 2517, category: ts.DiagnosticCategory.Error, key: "Constructor objects of abstract type cannot be assigned to constructor objects of non-abstract type" },
Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type: { code: 2517, category: ts.DiagnosticCategory.Error, key: "Cannot assign an abstract constructor type to a non-abstract constructor type." },
Only_an_ambient_class_can_be_merged_with_an_interface: { code: 2518, category: ts.DiagnosticCategory.Error, key: "Only an ambient class can be merged with an interface." },
Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions: { code: 2520, category: ts.DiagnosticCategory.Error, key: "Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions." },
Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions: { code: 2521, category: ts.DiagnosticCategory.Error, key: "Expression resolves to variable declaration '{0}' that compiler uses to support async functions." },
@@ -11517,7 +11524,11 @@ var ts;
}
else {
node.exportClause = parseNamedImportsOrExports(226 /* NamedExports */);
if (parseOptional(130 /* FromKeyword */)) {
// It is not uncommon to accidentally omit the 'from' keyword. Additionally, in editing scenarios,
// the 'from' keyword can be parsed as a named export when the export clause is unterminated (i.e. `export { from "moduleName";`)
// If we don't have a 'from' keyword, see if we have a string literal such that ASI won't take effect.
if (token === 130 /* FromKeyword */ || (token === 8 /* StringLiteral */ && !scanner.hasPrecedingLineBreak())) {
parseExpected(130 /* FromKeyword */);
node.moduleSpecifier = parseModuleSpecifier();
}
}
@@ -16299,7 +16310,7 @@ var ts;
var id = getTypeListId(elementTypes);
var type = tupleTypes[id];
if (!type) {
type = tupleTypes[id] = createObjectType(8192 /* Tuple */);
type = tupleTypes[id] = createObjectType(8192 /* Tuple */ | getWideningFlagsOfTypes(elementTypes));
type.elementTypes = elementTypes;
}
return type;
@@ -17200,10 +17211,33 @@ var ts;
var targetSignatures = getSignaturesOfType(target, kind);
var result = -1 /* True */;
var saveErrorInfo = errorInfo;
// Because the "abstractness" of a class is the same across all construct signatures
// (internally we are checking the corresponding declaration), it is enough to perform
// the check and report an error once over all pairs of source and target construct signatures.
var sourceSig = sourceSignatures[0];
// Note that in an extends-clause, targetSignatures is stripped, so the check never proceeds.
var targetSig = targetSignatures[0];
if (sourceSig && targetSig) {
var sourceErasedSignature = getErasedSignature(sourceSig);
var targetErasedSignature = getErasedSignature(targetSig);
var sourceReturnType = sourceErasedSignature && getReturnTypeOfSignature(sourceErasedSignature);
var targetReturnType = targetErasedSignature && getReturnTypeOfSignature(targetErasedSignature);
var sourceReturnDecl = sourceReturnType && sourceReturnType.symbol && ts.getDeclarationOfKind(sourceReturnType.symbol, 211 /* ClassDeclaration */);
var targetReturnDecl = targetReturnType && targetReturnType.symbol && ts.getDeclarationOfKind(targetReturnType.symbol, 211 /* ClassDeclaration */);
var sourceIsAbstract = sourceReturnDecl && sourceReturnDecl.flags & 256 /* Abstract */;
var targetIsAbstract = targetReturnDecl && targetReturnDecl.flags & 256 /* Abstract */;
if (sourceIsAbstract && !targetIsAbstract) {
if (reportErrors) {
reportError(ts.Diagnostics.Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type);
}
return 0 /* False */;
}
}
outer: for (var _i = 0; _i < targetSignatures.length; _i++) {
var t = targetSignatures[_i];
if (!t.hasStringLiterals || target.flags & 262144 /* FromSignature */) {
var localErrors = reportErrors;
var checkedAbstractAssignability = false;
for (var _a = 0; _a < sourceSignatures.length; _a++) {
var s = sourceSignatures[_a];
if (!s.hasStringLiterals || source.flags & 262144 /* FromSignature */) {
@@ -17254,12 +17288,12 @@ var ts;
target = getErasedSignature(target);
var result = -1 /* True */;
for (var i = 0; i < checkCount; i++) {
var s_1 = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source);
var t_1 = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target);
var s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source);
var t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target);
var saveErrorInfo = errorInfo;
var related = isRelatedTo(s_1, t_1, reportErrors);
var related = isRelatedTo(s, t, reportErrors);
if (!related) {
related = isRelatedTo(t_1, s_1, false);
related = isRelatedTo(t, s, false);
if (!related) {
if (reportErrors) {
reportError(ts.Diagnostics.Types_of_parameters_0_and_1_are_incompatible, source.parameters[i < sourceMax ? i : sourceMax].name, target.parameters[i < targetMax ? i : targetMax].name);
@@ -17297,11 +17331,11 @@ var ts;
}
return 0 /* False */;
}
var t = getReturnTypeOfSignature(target);
if (t === voidType)
var targetReturnType = getReturnTypeOfSignature(target);
if (targetReturnType === voidType)
return result;
var s = getReturnTypeOfSignature(source);
return result & isRelatedTo(s, t, reportErrors);
var sourceReturnType = getReturnTypeOfSignature(source);
return result & isRelatedTo(sourceReturnType, targetReturnType, reportErrors);
}
function signaturesIdenticalTo(source, target, kind) {
var sourceSignatures = getSignaturesOfType(source, kind);
@@ -17537,7 +17571,7 @@ var ts;
* Prefer using isTupleLikeType() unless the use of `elementTypes` is required.
*/
function isTupleType(type) {
return (type.flags & 8192 /* Tuple */) && !!type.elementTypes;
return !!(type.flags & 8192 /* Tuple */);
}
function getWidenedTypeOfObjectLiteral(type) {
var properties = getPropertiesOfObjectType(type);
@@ -17579,25 +17613,47 @@ var ts;
if (isArrayType(type)) {
return createArrayType(getWidenedType(type.typeArguments[0]));
}
if (isTupleType(type)) {
return createTupleType(ts.map(type.elementTypes, getWidenedType));
}
}
return type;
}
/**
* Reports implicit any errors that occur as a result of widening 'null' and 'undefined'
* to 'any'. A call to reportWideningErrorsInType is normally accompanied by a call to
* getWidenedType. But in some cases getWidenedType is called without reporting errors
* (type argument inference is an example).
*
* The return value indicates whether an error was in fact reported. The particular circumstances
* are on a best effort basis. Currently, if the null or undefined that causes widening is inside
* an object literal property (arbitrarily deeply), this function reports an error. If no error is
* reported, reportImplicitAnyError is a suitable fallback to report a general error.
*/
function reportWideningErrorsInType(type) {
var errorReported = false;
if (type.flags & 16384 /* Union */) {
var errorReported = false;
ts.forEach(type.types, function (t) {
for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
var t = _a[_i];
if (reportWideningErrorsInType(t)) {
errorReported = true;
}
});
return errorReported;
}
}
if (isArrayType(type)) {
return reportWideningErrorsInType(type.typeArguments[0]);
}
if (isTupleType(type)) {
for (var _b = 0, _c = type.elementTypes; _b < _c.length; _b++) {
var t = _c[_b];
if (reportWideningErrorsInType(t)) {
errorReported = true;
}
}
}
if (type.flags & 524288 /* ObjectLiteral */) {
var errorReported = false;
ts.forEach(getPropertiesOfObjectType(type), function (p) {
for (var _d = 0, _e = getPropertiesOfObjectType(type); _d < _e.length; _d++) {
var p = _e[_d];
var t = getTypeOfSymbol(p);
if (t.flags & 1048576 /* ContainsUndefinedOrNull */) {
if (!reportWideningErrorsInType(t)) {
@@ -17605,10 +17661,9 @@ var ts;
}
errorReported = true;
}
});
return errorReported;
}
}
return false;
return errorReported;
}
function reportImplicitAnyError(declaration, type) {
var typeAsString = typeToString(getWidenedType(type));
@@ -17771,29 +17826,32 @@ var ts;
inferFromTypes(sourceType, target);
}
}
else if (source.flags & 80896 /* ObjectType */ && (target.flags & (4096 /* Reference */ | 8192 /* Tuple */) ||
(target.flags & 65536 /* Anonymous */) && target.symbol && target.symbol.flags & (8192 /* Method */ | 2048 /* TypeLiteral */ | 32 /* Class */))) {
// If source is an object type, and target is a type reference, a tuple type, the type of a method, or a type literal, infer from members
if (isInProcess(source, target)) {
return;
else {
source = getApparentType(source);
if (source.flags & 80896 /* ObjectType */ && (target.flags & (4096 /* Reference */ | 8192 /* Tuple */) ||
(target.flags & 65536 /* Anonymous */) && target.symbol && target.symbol.flags & (8192 /* Method */ | 2048 /* TypeLiteral */ | 32 /* Class */))) {
// If source is an object type, and target is a type reference, a tuple type, the type of a method, or a type literal, infer from members
if (isInProcess(source, target)) {
return;
}
if (isDeeplyNestedGeneric(source, sourceStack, depth) && isDeeplyNestedGeneric(target, targetStack, depth)) {
return;
}
if (depth === 0) {
sourceStack = [];
targetStack = [];
}
sourceStack[depth] = source;
targetStack[depth] = target;
depth++;
inferFromProperties(source, target);
inferFromSignatures(source, target, 0 /* Call */);
inferFromSignatures(source, target, 1 /* Construct */);
inferFromIndexTypes(source, target, 0 /* String */, 0 /* String */);
inferFromIndexTypes(source, target, 1 /* Number */, 1 /* Number */);
inferFromIndexTypes(source, target, 0 /* String */, 1 /* Number */);
depth--;
}
if (isDeeplyNestedGeneric(source, sourceStack, depth) && isDeeplyNestedGeneric(target, targetStack, depth)) {
return;
}
if (depth === 0) {
sourceStack = [];
targetStack = [];
}
sourceStack[depth] = source;
targetStack[depth] = target;
depth++;
inferFromProperties(source, target);
inferFromSignatures(source, target, 0 /* Call */);
inferFromSignatures(source, target, 1 /* Construct */);
inferFromIndexTypes(source, target, 0 /* String */, 0 /* String */);
inferFromIndexTypes(source, target, 1 /* Number */, 1 /* Number */);
inferFromIndexTypes(source, target, 0 /* String */, 1 /* Number */);
depth--;
}
}
function inferFromProperties(source, target) {
@@ -37768,8 +37826,8 @@ var ts;
var pos = scanner.getStartPos();
// Read leading trivia and token
while (pos < endPos) {
var t_2 = scanner.getToken();
if (!ts.isTrivia(t_2)) {
var t_1 = scanner.getToken();
if (!ts.isTrivia(t_1)) {
break;
}
// consume leading trivia
@@ -37777,7 +37835,7 @@ var ts;
var item = {
pos: pos,
end: scanner.getStartPos(),
kind: t_2
kind: t_1
};
pos = scanner.getStartPos();
if (!leadingTrivia) {
@@ -39359,6 +39417,8 @@ var ts;
case 15 /* CloseBraceToken */:
case 18 /* OpenBracketToken */:
case 19 /* CloseBracketToken */:
case 16 /* OpenParenToken */:
case 17 /* CloseParenToken */:
case 77 /* ElseKeyword */:
case 101 /* WhileKeyword */:
case 53 /* AtToken */:
@@ -39483,7 +39543,7 @@ var ts;
else if (tokenInfo.token.kind === listStartToken) {
// consume list start token
startLine = sourceFile.getLineAndCharacterOfPosition(tokenInfo.token.pos).line;
var indentation_1 = computeIndentation(tokenInfo.token, startLine, -1 /* Unknown */, parent, parentDynamicIndentation, startLine);
var indentation_1 = computeIndentation(tokenInfo.token, startLine, -1 /* Unknown */, parent, parentDynamicIndentation, parentStartLine);
listDynamicIndentation = getDynamicIndentation(parent, parentStartLine, indentation_1.indentation, indentation_1.delta);
consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation);
}
@@ -41389,6 +41449,13 @@ var ts;
// after incremental parsing nameTable might not be up-to-date
// drop it so it can be lazily recreated later
newSourceFile.nameTable = undefined;
// dispose all resources held by old script snapshot
if (sourceFile !== newSourceFile && sourceFile.scriptSnapshot) {
if (sourceFile.scriptSnapshot.dispose) {
sourceFile.scriptSnapshot.dispose();
}
sourceFile.scriptSnapshot = undefined;
}
return newSourceFile;
}
}
@@ -42410,15 +42477,15 @@ var ts;
}
function tryGetGlobalSymbols() {
var objectLikeContainer;
var importClause;
var namedImportsOrExports;
var jsxContainer;
if (objectLikeContainer = tryGetObjectLikeCompletionContainer(contextToken)) {
return tryGetObjectLikeCompletionSymbols(objectLikeContainer);
}
if (importClause = ts.getAncestor(contextToken, 220 /* ImportClause */)) {
if (namedImportsOrExports = tryGetNamedImportsOrExportsForCompletion(contextToken)) {
// cursor is in an import clause
// try to show exported member for imported module
return tryGetImportClauseCompletionSymbols(importClause);
return tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports);
}
if (jsxContainer = tryGetContainingJsxElement(contextToken)) {
var attrsType;
@@ -42426,7 +42493,7 @@ var ts;
// Cursor is inside a JSX self-closing element or opening element
attrsType = typeChecker.getJsxElementAttributesType(jsxContainer);
if (attrsType) {
symbols = filterJsxAttributes(jsxContainer.attributes, typeChecker.getPropertiesOfType(attrsType));
symbols = filterJsxAttributes(typeChecker.getPropertiesOfType(attrsType), jsxContainer.attributes);
isMemberCompletion = true;
isNewIdentifierLocation = false;
return true;
@@ -42487,21 +42554,11 @@ var ts;
function isCompletionListBlocker(contextToken) {
var start = new Date().getTime();
var result = isInStringOrRegularExpressionOrTemplateLiteral(contextToken) ||
isIdentifierDefinitionLocation(contextToken) ||
isSolelyIdentifierDefinitionLocation(contextToken) ||
isDotOfNumericLiteral(contextToken);
log("getCompletionsAtPosition: isCompletionListBlocker: " + (new Date().getTime() - start));
return result;
}
function shouldShowCompletionsInImportsClause(node) {
if (node) {
// import {|
// import {a,|
if (node.kind === 14 /* OpenBraceToken */ || node.kind === 23 /* CommaToken */) {
return node.parent.kind === 222 /* NamedImports */;
}
}
return false;
}
function isNewIdentifierDefinitionLocation(previousToken) {
if (previousToken) {
var containingNodeKind = previousToken.parent.kind;
@@ -42610,34 +42667,37 @@ var ts;
return true;
}
/**
* Aggregates relevant symbols for completion in import clauses; for instance,
* Aggregates relevant symbols for completion in import clauses and export clauses
* whose declarations have a module specifier; for instance, symbols will be aggregated for
*
* import { $ } from "moduleName";
* import { | } from "moduleName";
* export { a as foo, | } from "moduleName";
*
* but not for
*
* export { | };
*
* Relevant symbols are stored in the captured 'symbols' variable.
*
* @returns true if 'symbols' was successfully populated; false otherwise.
*/
function tryGetImportClauseCompletionSymbols(importClause) {
// cursor is in import clause
// try to show exported member for imported module
if (shouldShowCompletionsInImportsClause(contextToken)) {
isMemberCompletion = true;
isNewIdentifierLocation = false;
var importDeclaration = importClause.parent;
ts.Debug.assert(importDeclaration !== undefined && importDeclaration.kind === 219 /* ImportDeclaration */);
var exports;
var moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(importDeclaration.moduleSpecifier);
if (moduleSpecifierSymbol) {
exports = typeChecker.getExportsOfModule(moduleSpecifierSymbol);
}
//let exports = typeInfoResolver.getExportsOfImportDeclaration(importDeclaration);
symbols = exports ? filterModuleExports(exports, importDeclaration) : emptyArray;
function tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports) {
var declarationKind = namedImportsOrExports.kind === 222 /* NamedImports */ ?
219 /* ImportDeclaration */ :
225 /* ExportDeclaration */;
var importOrExportDeclaration = ts.getAncestor(namedImportsOrExports, declarationKind);
var moduleSpecifier = importOrExportDeclaration.moduleSpecifier;
if (!moduleSpecifier) {
return false;
}
else {
isMemberCompletion = false;
isNewIdentifierLocation = true;
isMemberCompletion = true;
isNewIdentifierLocation = false;
var exports;
var moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(importOrExportDeclaration.moduleSpecifier);
if (moduleSpecifierSymbol) {
exports = typeChecker.getExportsOfModule(moduleSpecifierSymbol);
}
symbols = exports ? filterNamedImportOrExportCompletionItems(exports, namedImportsOrExports.elements) : emptyArray;
return true;
}
/**
@@ -42658,6 +42718,24 @@ var ts;
}
return undefined;
}
/**
* Returns the containing list of named imports or exports of a context token,
* on the condition that one exists and that the context implies completion should be given.
*/
function tryGetNamedImportsOrExportsForCompletion(contextToken) {
if (contextToken) {
switch (contextToken.kind) {
case 14 /* OpenBraceToken */: // import { |
case 23 /* CommaToken */:
switch (contextToken.parent.kind) {
case 222 /* NamedImports */:
case 226 /* NamedExports */:
return contextToken.parent;
}
}
}
return undefined;
}
function tryGetContainingJsxElement(contextToken) {
if (contextToken) {
var parent_12 = contextToken.parent;
@@ -42700,7 +42778,10 @@ var ts;
}
return false;
}
function isIdentifierDefinitionLocation(contextToken) {
/**
* @returns true if we are certain that the currently edited location must define a new location; false otherwise.
*/
function isSolelyIdentifierDefinitionLocation(contextToken) {
var containingNodeKind = contextToken.parent.kind;
switch (contextToken.kind) {
case 23 /* CommaToken */:
@@ -42746,6 +42827,10 @@ var ts;
case 107 /* PrivateKeyword */:
case 108 /* ProtectedKeyword */:
return containingNodeKind === 135 /* Parameter */;
case 113 /* AsKeyword */:
containingNodeKind === 223 /* ImportSpecifier */ ||
containingNodeKind === 227 /* ExportSpecifier */ ||
containingNodeKind === 221 /* NamespaceImport */;
case 70 /* ClassKeyword */:
case 78 /* EnumKeyword */:
case 104 /* InterfaceKeyword */:
@@ -42782,27 +42867,37 @@ var ts;
}
return false;
}
function filterModuleExports(exports, importDeclaration) {
var exisingImports = {};
if (!importDeclaration.importClause) {
return exports;
/**
* Filters out completion suggestions for named imports or exports.
*
* @param exportsOfModule The list of symbols which a module exposes.
* @param namedImportsOrExports The list of existing import/export specifiers in the import/export clause.
*
* @returns Symbols to be suggested at an import/export clause, barring those whose named imports/exports
* do not occur at the current position and have not otherwise been typed.
*/
function filterNamedImportOrExportCompletionItems(exportsOfModule, namedImportsOrExports) {
var exisingImportsOrExports = {};
for (var _i = 0; _i < namedImportsOrExports.length; _i++) {
var element = namedImportsOrExports[_i];
// If this is the current item we are editing right now, do not filter it out
if (element.getStart() <= position && position <= element.getEnd()) {
continue;
}
var name_31 = element.propertyName || element.name;
exisingImportsOrExports[name_31.text] = true;
}
if (importDeclaration.importClause.namedBindings &&
importDeclaration.importClause.namedBindings.kind === 222 /* NamedImports */) {
ts.forEach(importDeclaration.importClause.namedBindings.elements, function (el) {
// If this is the current item we are editing right now, do not filter it out
if (el.getStart() <= position && position <= el.getEnd()) {
return;
}
var name = el.propertyName || el.name;
exisingImports[name.text] = true;
});
if (ts.isEmpty(exisingImportsOrExports)) {
return exportsOfModule;
}
if (ts.isEmpty(exisingImports)) {
return exports;
}
return ts.filter(exports, function (e) { return !ts.lookUp(exisingImports, e.name); });
return ts.filter(exportsOfModule, function (e) { return !ts.lookUp(exisingImportsOrExports, e.name); });
}
/**
* Filters out completion suggestions for named imports or exports.
*
* @returns Symbols to be suggested in an object binding pattern or object literal expression, barring those whose declarations
* do not occur at the current position and have not otherwise been typed.
*/
function filterObjectMembersList(contextualMemberSymbols, existingMembers) {
if (!existingMembers || existingMembers.length === 0) {
return contextualMemberSymbols;
@@ -42832,15 +42927,15 @@ var ts;
}
existingMemberNames[existingName] = true;
}
var filteredMembers = [];
ts.forEach(contextualMemberSymbols, function (s) {
if (!existingMemberNames[s.name]) {
filteredMembers.push(s);
}
});
return filteredMembers;
return ts.filter(contextualMemberSymbols, function (m) { return !ts.lookUp(existingMemberNames, m.name); });
}
function filterJsxAttributes(attributes, symbols) {
/**
* Filters out completion suggestions from 'symbols' according to existing JSX attributes.
*
* @returns Symbols to be suggested in a JSX element, barring those whose attributes
* do not occur at the current position and have not otherwise been typed.
*/
function filterJsxAttributes(symbols, attributes) {
var seenNames = {};
for (var _i = 0; _i < attributes.length; _i++) {
var attr = attributes[_i];
@@ -42852,14 +42947,7 @@ var ts;
seenNames[attr.name.text] = true;
}
}
var result = [];
for (var _a = 0; _a < symbols.length; _a++) {
var sym = symbols[_a];
if (!seenNames[sym.name]) {
result.push(sym);
}
}
return result;
return ts.filter(symbols, function (a) { return !ts.lookUp(seenNames, a.name); });
}
}
function getCompletionsAtPosition(fileName, position) {
@@ -42892,10 +42980,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_31 in nameTable) {
if (!allNames[name_31]) {
allNames[name_31] = name_31;
var displayName = getCompletionEntryDisplayName(name_31, target, true);
for (var name_32 in nameTable) {
if (!allNames[name_32]) {
allNames[name_32] = name_32;
var displayName = getCompletionEntryDisplayName(name_32, target, true);
if (displayName) {
var entry = {
name: displayName,
@@ -43764,6 +43852,7 @@ var ts;
if (hasKind(node.parent, 142 /* GetAccessor */) || hasKind(node.parent, 143 /* SetAccessor */)) {
return getGetAndSetOccurrences(node.parent);
}
break;
default:
if (ts.isModifier(node.kind) && node.parent &&
(ts.isDeclaration(node.parent) || node.parent.kind === 190 /* VariableStatement */)) {
@@ -43879,12 +43968,13 @@ var ts;
// Make sure we only highlight the keyword when it makes sense to do so.
if (ts.isAccessibilityModifier(modifier)) {
if (!(container.kind === 211 /* ClassDeclaration */ ||
container.kind === 183 /* ClassExpression */ ||
(declaration.kind === 135 /* Parameter */ && hasKind(container, 141 /* Constructor */)))) {
return undefined;
}
}
else if (modifier === 110 /* StaticKeyword */) {
if (container.kind !== 211 /* ClassDeclaration */) {
if (!(container.kind === 211 /* ClassDeclaration */ || container.kind === 183 /* ClassExpression */)) {
return undefined;
}
}
@@ -43893,6 +43983,11 @@ var ts;
return undefined;
}
}
else if (modifier === 112 /* AbstractKeyword */) {
if (!(container.kind === 211 /* ClassDeclaration */ || declaration.kind === 211 /* ClassDeclaration */)) {
return undefined;
}
}
else {
// unsupported modifier
return undefined;
@@ -43903,12 +43998,19 @@ var ts;
switch (container.kind) {
case 216 /* ModuleBlock */:
case 245 /* SourceFile */:
nodes = container.statements;
// Container is either a class declaration or the declaration is a classDeclaration
if (modifierFlag & 256 /* Abstract */) {
nodes = declaration.members.concat(declaration);
}
else {
nodes = container.statements;
}
break;
case 141 /* Constructor */:
nodes = container.parameters.concat(container.parent.members);
break;
case 211 /* ClassDeclaration */:
case 183 /* ClassExpression */:
nodes = container.members;
// If we're an accessibility modifier, we're in an instance member and should search
// the constructor's parameter list for instance members as well.
@@ -43920,6 +44022,9 @@ var ts;
nodes = nodes.concat(constructor.parameters);
}
}
else if (modifierFlag & 256 /* Abstract */) {
nodes = nodes.concat(container);
}
break;
default:
ts.Debug.fail("Invalid container kind.");
@@ -43944,6 +44049,8 @@ var ts;
return 1 /* Export */;
case 119 /* DeclareKeyword */:
return 2 /* Ambient */;
case 112 /* AbstractKeyword */:
return 256 /* Abstract */;
default:
ts.Debug.fail();
}
@@ -44761,19 +44868,19 @@ var ts;
if (isNameOfPropertyAssignment(node)) {
var objectLiteral = node.parent.parent;
var contextualType = typeChecker.getContextualType(objectLiteral);
var name_32 = node.text;
var name_33 = 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_32);
var unionProperty = contextualType.getProperty(name_33);
if (unionProperty) {
return [unionProperty];
}
else {
var result_4 = [];
ts.forEach(contextualType.types, function (t) {
var symbol = t.getProperty(name_32);
var symbol = t.getProperty(name_33);
if (symbol) {
result_4.push(symbol);
}
@@ -44782,7 +44889,7 @@ var ts;
}
}
else {
var symbol_1 = contextualType.getProperty(name_32);
var symbol_1 = contextualType.getProperty(name_33);
if (symbol_1) {
return [symbol_1];
}
@@ -45464,7 +45571,7 @@ var ts;
return;
}
}
return 9 /* text */;
return 2 /* identifier */;
}
}
function processElement(element) {
@@ -46760,6 +46867,13 @@ var ts;
var decoded = JSON.parse(encoded);
return ts.createTextChangeRange(ts.createTextSpan(decoded.span.start, decoded.span.length), decoded.newLength);
};
ScriptSnapshotShimAdapter.prototype.dispose = function () {
// if scriptSnapshotShim is a COM object then property check becomes method call with no arguments
// 'in' does not have this effect
if ("dispose" in this.scriptSnapshotShim) {
this.scriptSnapshotShim.dispose();
}
};
return ScriptSnapshotShimAdapter;
})();
var LanguageServiceShimHostAdapter = (function () {
+196 -104
View File
@@ -59,7 +59,10 @@ namespace ts {
isArgumentsSymbol: symbol => symbol === argumentsSymbol,
getDiagnostics,
getGlobalDiagnostics,
getTypeOfSymbolAtLocation,
// The language service will always care about the narrowed type of a symbol, because that is
// the type the language says the symbol should have.
getTypeOfSymbolAtLocation: getNarrowedTypeOfSymbol,
getDeclaredTypeOfSymbol,
getPropertiesOfType,
getPropertyOfType,
@@ -69,7 +72,7 @@ namespace ts {
getSymbolsInScope,
getSymbolAtLocation,
getShorthandAssignmentValueSymbol,
getTypeAtLocation,
getTypeAtLocation: getTypeOfNode,
typeToString,
getSymbolDisplayBuilder,
symbolToString,
@@ -159,8 +162,9 @@ namespace ts {
let emitAwaiter = false;
let emitGenerator = false;
let resolutionTargets: Object[] = [];
let resolutionTargets: TypeSystemEntity[] = [];
let resolutionResults: boolean[] = [];
let resolutionPropertyNames: TypeSystemPropertyName[] = [];
let mergedSymbols: Symbol[] = [];
let symbolLinks: SymbolLinks[] = [];
@@ -201,6 +205,15 @@ namespace ts {
let assignableRelation: Map<RelationComparisonResult> = {};
let identityRelation: Map<RelationComparisonResult> = {};
type TypeSystemEntity = Symbol | Type | Signature;
const enum TypeSystemPropertyName {
Type,
ResolvedBaseConstructorType,
DeclaredType,
ResolvedReturnType
}
initializeTypeChecker();
return checker;
@@ -2177,35 +2190,69 @@ namespace ts {
}
}
// Push an entry on the type resolution stack. If an entry with the given target is not already on the stack,
// a new entry with that target and an associated result value of true is pushed on the stack, and the value
// true is returned. Otherwise, a circularity has occurred and the result values of the existing entry and
// all entries pushed after it are changed to false, and the value false is returned. The target object provides
// a unique identity for a particular type resolution result: Symbol instances are used to track resolution of
// SymbolLinks.type, SymbolLinks instances are used to track resolution of SymbolLinks.declaredType, and
// Signature instances are used to track resolution of Signature.resolvedReturnType.
function pushTypeResolution(target: Object): boolean {
let i = 0;
let count = resolutionTargets.length;
while (i < count && resolutionTargets[i] !== target) {
i++;
}
if (i < count) {
do {
resolutionResults[i++] = false;
/**
* Push an entry on the type resolution stack. If an entry with the given target and the given property name
* is already on the stack, and no entries in between already have a type, then a circularity has occurred.
* In this case, the result values of the existing entry and all entries pushed after it are changed to false,
* and the value false is returned. Otherwise, the new entry is just pushed onto the stack, and true is returned.
* In order to see if the same query has already been done before, the target object and the propertyName both
* must match the one passed in.
*
* @param target The symbol, type, or signature whose type is being queried
* @param propertyName The property name that should be used to query the target for its type
*/
function pushTypeResolution(target: TypeSystemEntity, propertyName: TypeSystemPropertyName): boolean {
let resolutionCycleStartIndex = findResolutionCycleStartIndex(target, propertyName);
if (resolutionCycleStartIndex >= 0) {
// A cycle was found
let { length } = resolutionTargets;
for (let i = resolutionCycleStartIndex; i < length; i++) {
resolutionResults[i] = false;
}
while (i < count);
return false;
}
resolutionTargets.push(target);
resolutionResults.push(true);
resolutionPropertyNames.push(propertyName);
return true;
}
function findResolutionCycleStartIndex(target: TypeSystemEntity, propertyName: TypeSystemPropertyName): number {
for (let i = resolutionTargets.length - 1; i >= 0; i--) {
if (hasType(resolutionTargets[i], resolutionPropertyNames[i])) {
return -1;
}
if (resolutionTargets[i] === target && resolutionPropertyNames[i] === propertyName) {
return i;
}
}
return -1;
}
function hasType(target: TypeSystemEntity, propertyName: TypeSystemPropertyName): Type {
if (propertyName === TypeSystemPropertyName.Type) {
return getSymbolLinks(<Symbol>target).type;
}
if (propertyName === TypeSystemPropertyName.DeclaredType) {
return getSymbolLinks(<Symbol>target).declaredType;
}
if (propertyName === TypeSystemPropertyName.ResolvedBaseConstructorType) {
Debug.assert(!!((<Type>target).flags & TypeFlags.Class));
return (<InterfaceType>target).resolvedBaseConstructorType;
}
if (propertyName === TypeSystemPropertyName.ResolvedReturnType) {
return (<Signature>target).resolvedReturnType;
}
Debug.fail("Unhandled TypeSystemPropertyName " + propertyName);
}
// Pop an entry from the type resolution stack and return its associated result value. The result value will
// be true if no circularities were detected, or false if a circularity was found.
function popTypeResolution(): boolean {
resolutionTargets.pop();
resolutionPropertyNames.pop();
return resolutionResults.pop();
}
@@ -2274,10 +2321,6 @@ namespace ts {
// fact an iterable or array (depending on target language).
let elementType = checkIteratedTypeOrElementType(parentType, pattern, /*allowStringInput*/ false);
if (!declaration.dotDotDotToken) {
if (isTypeAny(elementType)) {
return elementType;
}
// Use specific property type when parent is a tuple or numeric index type when parent is an array
let propName = "" + indexOf(pattern.elements, declaration);
type = isTupleLikeType(parentType)
@@ -2307,6 +2350,7 @@ namespace ts {
if (declaration.parent.parent.kind === SyntaxKind.ForInStatement) {
return anyType;
}
if (declaration.parent.parent.kind === SyntaxKind.ForOfStatement) {
// checkRightHandSideOfForOf will return undefined if the for-of expression type was
// missing properties/signatures required to get its iteratedType (like
@@ -2314,13 +2358,16 @@ namespace ts {
// or it may have led to an error inside getElementTypeOfIterable.
return checkRightHandSideOfForOf((<ForOfStatement>declaration.parent.parent).expression) || anyType;
}
if (isBindingPattern(declaration.parent)) {
return getTypeForBindingElement(<BindingElement>declaration);
}
// Use type from type annotation if one is present
if (declaration.type) {
return getTypeFromTypeNode(declaration.type);
}
if (declaration.kind === SyntaxKind.Parameter) {
let func = <FunctionLikeDeclaration>declaration.parent;
// For a parameter of a set accessor, use the type of the get accessor if one is present
@@ -2336,14 +2383,22 @@ namespace ts {
return type;
}
}
// Use the type of the initializer expression if one is present
if (declaration.initializer) {
return checkExpressionCached(declaration.initializer);
}
// If it is a short-hand property assignment, use the type of the identifier
if (declaration.kind === SyntaxKind.ShorthandPropertyAssignment) {
return checkIdentifier(<Identifier>declaration.name);
}
// If the declaration specifies a binding pattern, use the type implied by the binding pattern
if (isBindingPattern(declaration.name)) {
return getTypeFromBindingPattern(<BindingPattern>declaration.name);
}
// No type specified and nothing can be inferred
return undefined;
}
@@ -2429,13 +2484,10 @@ namespace ts {
// tools see the actual type.
return declaration.kind !== SyntaxKind.PropertyAssignment ? getWidenedType(type) : type;
}
// If no type was specified and nothing could be inferred, and if the declaration specifies a binding pattern, use
// the type implied by the binding pattern
if (isBindingPattern(declaration.name)) {
return getTypeFromBindingPattern(<BindingPattern>declaration.name);
}
// Rest parameters default to type any[], other parameters default to type any
type = declaration.dotDotDotToken ? anyArrayType : anyType;
// Report implicit any errors unless this is a private property within an ambient declaration
if (reportErrors && compilerOptions.noImplicitAny) {
let root = getRootDeclaration(declaration);
@@ -2463,7 +2515,7 @@ namespace ts {
return links.type = checkExpression((<ExportAssignment>declaration).expression);
}
// Handle variable, parameter or property
if (!pushTypeResolution(symbol)) {
if (!pushTypeResolution(symbol, TypeSystemPropertyName.Type)) {
return unknownType;
}
let type = getWidenedTypeForVariableLikeDeclaration(<VariableLikeDeclaration>declaration, /*reportErrors*/ true);
@@ -2504,7 +2556,7 @@ namespace ts {
function getTypeOfAccessors(symbol: Symbol): Type {
let links = getSymbolLinks(symbol);
if (!links.type) {
if (!pushTypeResolution(symbol)) {
if (!pushTypeResolution(symbol, TypeSystemPropertyName.Type)) {
return unknownType;
}
let getter = <AccessorDeclaration>getDeclarationOfKind(symbol, SyntaxKind.GetAccessor);
@@ -2720,7 +2772,7 @@ namespace ts {
if (!baseTypeNode) {
return type.resolvedBaseConstructorType = undefinedType;
}
if (!pushTypeResolution(type)) {
if (!pushTypeResolution(type, TypeSystemPropertyName.ResolvedBaseConstructorType)) {
return unknownType;
}
let baseConstructorType = checkExpression(baseTypeNode.expression);
@@ -2847,7 +2899,7 @@ namespace ts {
if (!links.declaredType) {
// Note that we use the links object as the target here because the symbol object is used as the unique
// identity for resolution of the 'type' property in SymbolLinks.
if (!pushTypeResolution(links)) {
if (!pushTypeResolution(symbol, TypeSystemPropertyName.DeclaredType)) {
return unknownType;
}
let declaration = <TypeAliasDeclaration>getDeclarationOfKind(symbol, SyntaxKind.TypeAliasDeclaration);
@@ -3534,7 +3586,7 @@ namespace ts {
function getReturnTypeOfSignature(signature: Signature): Type {
if (!signature.resolvedReturnType) {
if (!pushTypeResolution(signature)) {
if (!pushTypeResolution(signature, TypeSystemPropertyName.ResolvedReturnType)) {
return unknownType;
}
let type: Type;
@@ -4179,7 +4231,7 @@ namespace ts {
// Callers should first ensure this by calling isTypeNode
case SyntaxKind.Identifier:
case SyntaxKind.QualifiedName:
let symbol = getSymbolInfo(node);
let symbol = getSymbolAtLocation(node);
return symbol && getDeclaredTypeOfSymbol(symbol);
default:
return unknownType;
@@ -4244,15 +4296,18 @@ namespace ts {
}
function createInferenceMapper(context: InferenceContext): TypeMapper {
return t => {
let mapper: TypeMapper = t => {
for (let i = 0; i < context.typeParameters.length; i++) {
if (t === context.typeParameters[i]) {
context.inferences[i].isFixed = true;
return getInferredType(context, i);
}
}
return t;
return t;
};
mapper.context = context;
return mapper;
}
function identityMapper(type: Type): Type {
@@ -5463,7 +5518,9 @@ namespace ts {
function createInferenceContext(typeParameters: TypeParameter[], inferUnionTypes: boolean): InferenceContext {
let inferences: TypeInferences[] = [];
for (let unused of typeParameters) {
inferences.push({ primary: undefined, secondary: undefined, isFixed: false });
inferences.push({
primary: undefined, secondary: undefined, isFixed: false
});
}
return {
typeParameters,
@@ -5831,47 +5888,6 @@ namespace ts {
}
}
function resolveLocation(node: Node) {
// Resolve location from top down towards node if it is a context sensitive expression
// That helps in making sure not assigning types as any when resolved out of order
let containerNodes: Node[] = [];
for (let parent = node.parent; parent; parent = parent.parent) {
if ((isExpression(parent) || isObjectLiteralMethod(node)) &&
isContextSensitive(<Expression>parent)) {
containerNodes.unshift(parent);
}
}
ts.forEach(containerNodes, node => { getTypeOfNode(node); });
}
function getSymbolAtLocation(node: Node): Symbol {
resolveLocation(node);
return getSymbolInfo(node);
}
function getTypeAtLocation(node: Node): Type {
resolveLocation(node);
return getTypeOfNode(node);
}
function getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type {
resolveLocation(node);
// Get the narrowed type of symbol at given location instead of just getting
// the type of the symbol.
// eg.
// function foo(a: string | number) {
// if (typeof a === "string") {
// a/**/
// }
// }
// getTypeOfSymbol for a would return type of parameter symbol string | number
// Unless we provide location /**/, checker wouldn't know how to narrow the type
// By using getNarrowedTypeOfSymbol would return string since it would be able to narrow
// it by typeguard in the if true condition
return getNarrowedTypeOfSymbol(symbol, node);
}
// Get the narrowed type of a given symbol at a given location
function getNarrowedTypeOfSymbol(symbol: Symbol, node: Node) {
let type = getTypeOfSymbol(symbol);
@@ -6764,10 +6780,23 @@ namespace ts {
return result;
}
// Presence of a contextual type mapper indicates inferential typing, except the identityMapper object is
// used as a special marker for other purposes.
/**
* Detect if the mapper implies an inference context. Specifically, there are 4 possible values
* for a mapper. Let's go through each one of them:
*
* 1. undefined - this means we are not doing inferential typing, but we may do contextual typing,
* which could cause us to assign a parameter a type
* 2. identityMapper - means we want to avoid assigning a parameter a type, whether or not we are in
* inferential typing (context is undefined for the identityMapper)
* 3. a mapper created by createInferenceMapper - we are doing inferential typing, we want to assign
* types to parameters and fix type parameters (context is defined)
* 4. an instantiation mapper created by createTypeMapper or createTypeEraser - this should never be
* passed as the contextual mapper when checking an expression (context is undefined for these)
*
* isInferentialContext is detecting if we are in case 3
*/
function isInferentialContext(mapper: TypeMapper) {
return mapper && mapper !== identityMapper;
return mapper && mapper.context;
}
// A node is an assignment target if it is on the left hand side of an '=' token, if it is parented by a property
@@ -8487,6 +8516,9 @@ namespace ts {
if (!produceDiagnostics) {
for (let candidate of candidates) {
if (hasCorrectArity(node, args, candidate)) {
if (candidate.typeParameters && typeArguments) {
candidate = getSignatureInstantiation(candidate, map(typeArguments, getTypeFromTypeNode));
}
return candidate;
}
}
@@ -8856,13 +8888,52 @@ namespace ts {
let len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0);
for (let i = 0; i < len; i++) {
let parameter = signature.parameters[i];
let links = getSymbolLinks(parameter);
links.type = instantiateType(getTypeAtPosition(context, i), mapper);
let contextualParameterType = getTypeAtPosition(context, i);
assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper);
}
if (signature.hasRestParameter && context.hasRestParameter && signature.parameters.length >= context.parameters.length) {
let parameter = lastOrUndefined(signature.parameters);
let links = getSymbolLinks(parameter);
links.type = instantiateType(getTypeOfSymbol(lastOrUndefined(context.parameters)), mapper);
let contextualParameterType = getTypeOfSymbol(lastOrUndefined(context.parameters));
assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper);
}
}
function assignTypeToParameterAndFixTypeParameters(parameter: Symbol, contextualType: Type, mapper: TypeMapper) {
let links = getSymbolLinks(parameter);
if (!links.type) {
links.type = instantiateType(contextualType, mapper);
}
else if (isInferentialContext(mapper)) {
// Even if the parameter already has a type, it might be because it was given a type while
// processing the function as an argument to a prior signature during overload resolution.
// If this was the case, it may have caused some type parameters to be fixed. So here,
// we need to ensure that type parameters at the same positions get fixed again. This is
// done by calling instantiateType to attach the mapper to the contextualType, and then
// calling inferTypes to force a walk of contextualType so that all the correct fixing
// happens. The choice to pass in links.type may seem kind of arbitrary, but it serves
// to make sure that all the correct positions in contextualType are reached by the walk.
// Here is an example:
//
// interface Base {
// baseProp;
// }
// interface Derived extends Base {
// toBase(): Base;
// }
//
// var derived: Derived;
//
// declare function foo<T>(x: T, func: (p: T) => T): T;
// declare function foo<T>(x: T, func: (p: T) => T): T;
//
// var result = foo(derived, d => d.toBase());
//
// We are typing d while checking the second overload. But we've already given d
// a type (Derived) from the first overload. However, we still want to fix the
// T in the second overload so that we do not infer Base as a candidate for T
// (inferring Base would make type argument inference inconsistent between the two
// overloads).
inferTypes(mapper.context, links.type, instantiateType(contextualType, mapper));
}
}
@@ -9082,27 +9153,36 @@ namespace ts {
let links = getNodeLinks(node);
let type = getTypeOfSymbol(node.symbol);
// Check if function expression is contextually typed and assign parameter types if so
if (!(links.flags & NodeCheckFlags.ContextChecked)) {
let contextSensitive = isContextSensitive(node);
let mightFixTypeParameters = contextSensitive && isInferentialContext(contextualMapper);
// Check if function expression is contextually typed and assign parameter types if so.
// See the comment in assignTypeToParameterAndFixTypeParameters to understand why we need to
// check mightFixTypeParameters.
if (mightFixTypeParameters || !(links.flags & NodeCheckFlags.ContextChecked)) {
let contextualSignature = getContextualSignature(node);
// If a type check is started at a function expression that is an argument of a function call, obtaining the
// contextual type may recursively get back to here during overload resolution of the call. If so, we will have
// already assigned contextual types.
if (!(links.flags & NodeCheckFlags.ContextChecked)) {
let contextChecked = !!(links.flags & NodeCheckFlags.ContextChecked);
if (mightFixTypeParameters || !contextChecked) {
links.flags |= NodeCheckFlags.ContextChecked;
if (contextualSignature) {
let signature = getSignaturesOfType(type, SignatureKind.Call)[0];
if (isContextSensitive(node)) {
if (contextSensitive) {
assignContextualParameterTypes(signature, contextualSignature, contextualMapper || identityMapper);
}
if (!node.type && !signature.resolvedReturnType) {
if (mightFixTypeParameters || !node.type && !signature.resolvedReturnType) {
let returnType = getReturnTypeFromBody(node, contextualMapper);
if (!signature.resolvedReturnType) {
signature.resolvedReturnType = returnType;
}
}
}
checkSignatureDeclaration(node);
if (!contextChecked) {
checkSignatureDeclaration(node);
}
}
}
@@ -9792,7 +9872,7 @@ namespace ts {
}
function instantiateTypeWithSingleGenericCallSignature(node: Expression | MethodDeclaration, type: Type, contextualMapper?: TypeMapper) {
if (contextualMapper && contextualMapper !== identityMapper) {
if (isInferentialContext(contextualMapper)) {
let signature = getSingleCallSignature(type);
if (signature && signature.typeParameters) {
let contextualType = getContextualType(<Expression>node);
@@ -10037,7 +10117,7 @@ namespace ts {
}
else {
checkTypeAssignableTo(typePredicate.type,
getTypeAtLocation(node.parameters[typePredicate.parameterIndex]),
getTypeOfNode(node.parameters[typePredicate.parameterIndex]),
typePredicateNode.type);
}
}
@@ -13667,7 +13747,7 @@ namespace ts {
return undefined;
}
function getSymbolInfo(node: Node) {
function getSymbolAtLocation(node: Node) {
if (isInsideWithStatementBody(node)) {
// We cannot answer semantic questions within a with block, do not proceed any further
return undefined;
@@ -13678,10 +13758,22 @@ namespace ts {
return getSymbolOfNode(node.parent);
}
if (node.kind === SyntaxKind.Identifier && isInRightSideOfImportOrExportAssignment(<Identifier>node)) {
return node.parent.kind === SyntaxKind.ExportAssignment
? getSymbolOfEntityNameOrPropertyAccessExpression(<Identifier>node)
: getSymbolOfPartOfRightHandSideOfImportEquals(<Identifier>node);
if (node.kind === SyntaxKind.Identifier) {
if (isInRightSideOfImportOrExportAssignment(<Identifier>node)) {
return node.parent.kind === SyntaxKind.ExportAssignment
? getSymbolOfEntityNameOrPropertyAccessExpression(<Identifier>node)
: getSymbolOfPartOfRightHandSideOfImportEquals(<Identifier>node);
}
else if (node.parent.kind === SyntaxKind.BindingElement &&
node.parent.parent.kind === SyntaxKind.ObjectBindingPattern &&
node === (<BindingElement>node.parent).propertyName) {
let typeOfPattern = getTypeOfNode(node.parent.parent);
let propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, (<Identifier>node).text);
if (propertyDeclaration) {
return propertyDeclaration;
}
}
}
switch (node.kind) {
@@ -13758,24 +13850,24 @@ namespace ts {
}
if (isTypeDeclaration(node)) {
// In this case, we call getSymbolOfNode instead of getSymbolInfo because it is a declaration
// In this case, we call getSymbolOfNode instead of getSymbolAtLocation because it is a declaration
let symbol = getSymbolOfNode(node);
return getDeclaredTypeOfSymbol(symbol);
}
if (isTypeDeclarationName(node)) {
let symbol = getSymbolInfo(node);
let symbol = getSymbolAtLocation(node);
return symbol && getDeclaredTypeOfSymbol(symbol);
}
if (isDeclaration(node)) {
// In this case, we call getSymbolOfNode instead of getSymbolInfo because it is a declaration
// In this case, we call getSymbolOfNode instead of getSymbolAtLocation because it is a declaration
let symbol = getSymbolOfNode(node);
return getTypeOfSymbol(symbol);
}
if (isDeclarationName(node)) {
let symbol = getSymbolInfo(node);
let symbol = getSymbolAtLocation(node);
return symbol && getTypeOfSymbol(symbol);
}
@@ -13784,7 +13876,7 @@ namespace ts {
}
if (isInRightSideOfImportOrExportAssignment(<Identifier>node)) {
let symbol = getSymbolInfo(node);
let symbol = getSymbolAtLocation(node);
let declaredType = symbol && getDeclaredTypeOfSymbol(symbol);
return declaredType !== unknownType ? declaredType : getTypeOfSymbol(symbol);
}
+35 -3
View File
@@ -3012,6 +3012,26 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
return result;
}
function emitEs6ExportDefaultCompat(node: Node) {
if (node.parent.kind === SyntaxKind.SourceFile) {
Debug.assert(!!(node.flags & NodeFlags.Default) || node.kind === SyntaxKind.ExportAssignment);
// only allow export default at a source file level
if (compilerOptions.module === ModuleKind.CommonJS || compilerOptions.module === ModuleKind.AMD || compilerOptions.module === ModuleKind.UMD) {
if (!currentSourceFile.symbol.exports["___esModule"]) {
if (languageVersion === ScriptTarget.ES5) {
// default value of configurable, enumerable, writable are `false`.
write("Object.defineProperty(exports, \"__esModule\", { value: true });");
writeLine();
}
else if (languageVersion === ScriptTarget.ES3) {
write("exports.__esModule = true;");
writeLine();
}
}
}
}
}
function emitExportMemberAssignment(node: FunctionLikeDeclaration | ClassDeclaration) {
if (node.flags & NodeFlags.Export) {
writeLine();
@@ -3034,9 +3054,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
}
else {
if (node.flags & NodeFlags.Default) {
emitEs6ExportDefaultCompat(node);
if (languageVersion === ScriptTarget.ES3) {
write("exports[\"default\"]");
} else {
}
else {
write("exports.default");
}
}
@@ -3249,7 +3271,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
function emitAssignmentExpression(root: BinaryExpression) {
let target = root.left;
let value = root.right;
if (isAssignmentExpressionStatement) {
if (isEmptyObjectLiteralOrArrayLiteral(target)) {
emit(value);
}
else if (isAssignmentExpressionStatement) {
emitDestructuringAssignment(target, value);
}
else {
@@ -4215,10 +4241,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
}
}
let startIndex = 0;
write(" {");
scopeEmitStart(node, "constructor");
increaseIndent();
if (ctor) {
// Emit all the directive prologues (like "use strict"). These have to come before
// any other preamble code we write (like parameter initializers).
startIndex = emitDirectivePrologues(ctor.body.statements, /*startWithNewLine*/ true);
emitDetachedComments(ctor.body.statements);
}
emitCaptureThisForNodeIfNecessary(node);
@@ -4253,7 +4284,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
if (superCall) {
statements = statements.slice(1);
}
emitLines(statements);
emitLinesStartingAt(statements, startIndex);
}
emitTempDeclarations(/*newLine*/ true);
writeLine();
@@ -5529,6 +5560,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
write(")");
}
else {
emitEs6ExportDefaultCompat(node);
emitContainingModuleName(node);
if (languageVersion === ScriptTarget.ES3) {
write("[\"default\"] = ");
+1 -1
View File
@@ -3295,7 +3295,7 @@ namespace ts {
function parseSuperExpression(): MemberExpression {
let expression = parseTokenNode<PrimaryExpression>();
if (token === SyntaxKind.OpenParenToken || token === SyntaxKind.DotToken) {
if (token === SyntaxKind.OpenParenToken || token === SyntaxKind.DotToken || token === SyntaxKind.OpenBracketToken) {
return expression;
}
+3
View File
@@ -1912,6 +1912,9 @@ namespace ts {
/* @internal */
export interface TypeMapper {
(t: TypeParameter): Type;
context?: InferenceContext; // The inference context this mapper was created from.
// Only inference mappers have this set (in createInferenceMapper).
// The identity mapper and regular instantiation mappers do not need it.
}
/* @internal */
+12 -1
View File
@@ -568,7 +568,7 @@ namespace ts {
}
}
export function isVariableLike(node: Node): boolean {
export function isVariableLike(node: Node): node is VariableLikeDeclaration {
if (node) {
switch (node.kind) {
case SyntaxKind.BindingElement:
@@ -1981,6 +1981,17 @@ namespace ts {
(node.parent.kind === SyntaxKind.PropertyAccessExpression && (<PropertyAccessExpression>node.parent).name === node);
}
export function isEmptyObjectLiteralOrArrayLiteral(expression: Node): boolean {
let kind = expression.kind;
if (kind === SyntaxKind.ObjectLiteralExpression) {
return (<ObjectLiteralExpression>expression).properties.length === 0;
}
if (kind === SyntaxKind.ArrayLiteralExpression) {
return (<ArrayLiteralExpression>expression).elements.length === 0;
}
return false;
}
export function getLocalSymbolForExportDefault(symbol: Symbol) {
return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & NodeFlags.Default) ? symbol.valueDeclaration.localSymbol : undefined;
}
+5 -5
View File
@@ -671,20 +671,20 @@ module FourSlash {
let completions = this.getCompletionListAtCaret();
if ((!completions || completions.entries.length === 0) && negative) {
this.raiseError("Completion list is empty at Caret");
} else if ((completions && completions.entries.length !== 0) && !negative) {
this.raiseError("Completion list is empty at caret at position " + this.activeFile.fileName + " " + this.currentCaretPosition);
}
else if (completions && completions.entries.length !== 0 && !negative) {
let errorMsg = "\n" + "Completion List contains: [" + completions.entries[0].name;
for (let i = 1; i < completions.entries.length; i++) {
errorMsg += ", " + completions.entries[i].name;
}
errorMsg += "]\n";
Harness.IO.log(errorMsg);
this.raiseError("Completion list is not empty at Caret");
this.raiseError("Completion list is not empty at caret at position " + this.activeFile.fileName + " " + this.currentCaretPosition + errorMsg);
}
}
public verifyCompletionListAllowsNewIdentifier(negative: boolean) {
let completions = this.getCompletionListAtCaret();
+1 -1
View File
@@ -123,7 +123,7 @@ module RWC {
content = ts.sys.readFile(unitName);
}
catch (e) {
// Leave content undefined.
content = ts.sys.readFile(fileName);
}
return { unitName, content };
}
+3 -3
View File
@@ -971,14 +971,14 @@ interface JSON {
* @param replacer A function that transforms the results.
* @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.
*/
stringify(value: any, replacer: (key: string, value: any) => any, space: any): string;
stringify(value: any, replacer: (key: string, value: any) => any, space: string | number): string;
/**
* Converts a JavaScript value to a JavaScript Object Notation (JSON) string.
* @param value A JavaScript value, usually an object or array, to be converted.
* @param replacer Array that transforms the results.
* @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.
*/
stringify(value: any, replacer: any[], space: any): string;
stringify(value: any, replacer: any[], space: string | number): string;
}
/**
* An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format.
@@ -1181,4 +1181,4 @@ interface PromiseLike<T> {
*/
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>;
}
}
+1 -1
View File
@@ -377,7 +377,7 @@ interface String {
* @param searchString search string
* @param position If position is undefined, 0 is assumed, so as to search all of the String.
*/
contains(searchString: string, position?: number): boolean;
includes(searchString: string, position?: number): boolean;
/**
* Returns true if the sequence of elements of searchString converted to a String is the
+17 -17
View File
@@ -842,53 +842,53 @@ namespace ts.server {
private handlers : Map<(request: protocol.Request) => {response?: any, responseRequired?: boolean}> = {
[CommandNames.Exit]: () => {
this.exit();
return {};
return { responseRequired: false};
},
[CommandNames.Definition]: (request: protocol.Request) => {
var defArgs = <protocol.FileLocationRequestArgs>request.arguments;
return {response: this.getDefinition(defArgs.line, defArgs.offset, defArgs.file)};
return {response: this.getDefinition(defArgs.line, defArgs.offset, defArgs.file), responseRequired: true};
},
[CommandNames.TypeDefinition]: (request: protocol.Request) => {
var defArgs = <protocol.FileLocationRequestArgs>request.arguments;
return {response: this.getTypeDefinition(defArgs.line, defArgs.offset, defArgs.file)};
return {response: this.getTypeDefinition(defArgs.line, defArgs.offset, defArgs.file), responseRequired: true};
},
[CommandNames.References]: (request: protocol.Request) => {
var defArgs = <protocol.FileLocationRequestArgs>request.arguments;
return {response: this.getReferences(defArgs.line, defArgs.offset, defArgs.file)};
return {response: this.getReferences(defArgs.line, defArgs.offset, defArgs.file), responseRequired: true};
},
[CommandNames.Rename]: (request: protocol.Request) => {
var renameArgs = <protocol.RenameRequestArgs>request.arguments;
return {response: this.getRenameLocations(renameArgs.line, renameArgs.offset, renameArgs.file, renameArgs.findInComments, renameArgs.findInStrings)}
return {response: this.getRenameLocations(renameArgs.line, renameArgs.offset, renameArgs.file, renameArgs.findInComments, renameArgs.findInStrings), responseRequired: true}
},
[CommandNames.Open]: (request: protocol.Request) => {
var openArgs = <protocol.OpenRequestArgs>request.arguments;
this.openClientFile(openArgs.file);
return {}
return {responseRequired: false}
},
[CommandNames.Quickinfo]: (request: protocol.Request) => {
var quickinfoArgs = <protocol.FileLocationRequestArgs>request.arguments;
return {response: this.getQuickInfo(quickinfoArgs.line, quickinfoArgs.offset, quickinfoArgs.file)};
return {response: this.getQuickInfo(quickinfoArgs.line, quickinfoArgs.offset, quickinfoArgs.file), responseRequired: true};
},
[CommandNames.Format]: (request: protocol.Request) => {
var formatArgs = <protocol.FormatRequestArgs>request.arguments;
return {response: this.getFormattingEditsForRange(formatArgs.line, formatArgs.offset, formatArgs.endLine, formatArgs.endOffset, formatArgs.file)};
return {response: this.getFormattingEditsForRange(formatArgs.line, formatArgs.offset, formatArgs.endLine, formatArgs.endOffset, formatArgs.file), responseRequired: true};
},
[CommandNames.Formatonkey]: (request: protocol.Request) => {
var formatOnKeyArgs = <protocol.FormatOnKeyRequestArgs>request.arguments;
return {response: this.getFormattingEditsAfterKeystroke(formatOnKeyArgs.line, formatOnKeyArgs.offset, formatOnKeyArgs.key, formatOnKeyArgs.file)};
return {response: this.getFormattingEditsAfterKeystroke(formatOnKeyArgs.line, formatOnKeyArgs.offset, formatOnKeyArgs.key, formatOnKeyArgs.file), responseRequired: true};
},
[CommandNames.Completions]: (request: protocol.Request) => {
var completionsArgs = <protocol.CompletionsRequestArgs>request.arguments;
return {response: this.getCompletions(completionsArgs.line, completionsArgs.offset, completionsArgs.prefix, completionsArgs.file)}
return {response: this.getCompletions(completionsArgs.line, completionsArgs.offset, completionsArgs.prefix, completionsArgs.file), responseRequired: true}
},
[CommandNames.CompletionDetails]: (request: protocol.Request) => {
var completionDetailsArgs = <protocol.CompletionDetailsRequestArgs>request.arguments;
return {response: this.getCompletionEntryDetails(completionDetailsArgs.line,completionDetailsArgs.offset,
completionDetailsArgs.entryNames,completionDetailsArgs.file)}
completionDetailsArgs.entryNames,completionDetailsArgs.file), responseRequired: true}
},
[CommandNames.SignatureHelp]: (request: protocol.Request) => {
var signatureHelpArgs = <protocol.SignatureHelpRequestArgs>request.arguments;
return {response: this.getSignatureHelpItems(signatureHelpArgs.line, signatureHelpArgs.offset, signatureHelpArgs.file)}
return {response: this.getSignatureHelpItems(signatureHelpArgs.line, signatureHelpArgs.offset, signatureHelpArgs.file), responseRequired: true}
},
[CommandNames.Geterr]: (request: protocol.Request) => {
var geterrArgs = <protocol.GeterrRequestArgs>request.arguments;
@@ -923,23 +923,23 @@ namespace ts.server {
},
[CommandNames.Navto]: (request: protocol.Request) => {
var navtoArgs = <protocol.NavtoRequestArgs>request.arguments;
return {response: this.getNavigateToItems(navtoArgs.searchValue, navtoArgs.file, navtoArgs.maxResultCount)};
return {response: this.getNavigateToItems(navtoArgs.searchValue, navtoArgs.file, navtoArgs.maxResultCount), responseRequired: true};
},
[CommandNames.Brace]: (request: protocol.Request) => {
var braceArguments = <protocol.FileLocationRequestArgs>request.arguments;
return {response: this.getBraceMatching(braceArguments.line, braceArguments.offset, braceArguments.file)};
return {response: this.getBraceMatching(braceArguments.line, braceArguments.offset, braceArguments.file), responseRequired: true};
},
[CommandNames.NavBar]: (request: protocol.Request) => {
var navBarArgs = <protocol.FileRequestArgs>request.arguments;
return {response: this.getNavigationBarItems(navBarArgs.file)};
return {response: this.getNavigationBarItems(navBarArgs.file), responseRequired: true};
},
[CommandNames.Occurrences]: (request: protocol.Request) => {
var { line, offset, file: fileName } = <protocol.FileLocationRequestArgs>request.arguments;
return {response: this.getOccurrences(line, offset, fileName)};
return {response: this.getOccurrences(line, offset, fileName), responseRequired: true};
},
[CommandNames.ProjectInfo]: (request: protocol.Request) => {
var { file, needFileNameList } = <protocol.ProjectInfoRequestArgs>request.arguments;
return {response: this.getProjectInfo(file, needFileNameList)};
return {response: this.getProjectInfo(file, needFileNameList), responseRequired: true};
},
};
addProtocolHandler(command: string, handler: (request: protocol.Request) => {response?: any, responseRequired: boolean}) {
+13 -2
View File
@@ -3234,8 +3234,19 @@ namespace ts {
// We are *only* completing on properties from the type being destructured.
isNewIdentifierLocation = false;
typeForObject = typeChecker.getTypeAtLocation(objectLikeContainer);
existingMembers = (<BindingPattern>objectLikeContainer).elements;
let rootDeclaration = getRootDeclaration(objectLikeContainer.parent);
if (isVariableLike(rootDeclaration)) {
// We don't want to complete using the type acquired by the shape
// of the binding pattern; we are only interested in types acquired
// through type declaration or inference.
if (rootDeclaration.initializer || rootDeclaration.type) {
typeForObject = typeChecker.getTypeAtLocation(objectLikeContainer);
existingMembers = (<BindingPattern>objectLikeContainer).elements;
}
}
else {
Debug.fail("Root declaration is not variable-like.")
}
}
else {
Debug.fail("Expected object literal or binding pattern, got " + objectLikeContainer.kind);
+19 -4
View File
@@ -64,8 +64,13 @@ namespace ts {
/** Public interface of the the of a config service shim instance.*/
export interface CoreServicesShimHost extends Logger {
/** Returns a JSON-encoded value of the type: string[] */
readDirectory(rootDir: string, extension: string): string;
/**
* Returns a JSON-encoded value of the type: string[]
*
* @param exclude A JSON encoded string[] containing the paths to exclude
* when enumerating the directory.
*/
readDirectory(rootDir: string, extension: string, exclude?: string): string;
}
///
@@ -386,8 +391,18 @@ namespace ts {
constructor(private shimHost: CoreServicesShimHost) {
}
public readDirectory(rootDir: string, extension: string): string[] {
var encoded = this.shimHost.readDirectory(rootDir, extension);
public readDirectory(rootDir: string, extension: string, exclude: string[]): string[] {
// Wrap the API changes for 1.5 release. This try/catch
// should be removed once TypeScript 1.5 has shipped.
// Also consider removing the optional designation for
// the exclude param at this time.
var encoded: string;
try {
encoded = this.shimHost.readDirectory(rootDir, extension, JSON.stringify(exclude));
}
catch (e) {
encoded = this.shimHost.readDirectory(rootDir, extension);
}
return JSON.parse(encoded);
}
}
@@ -1,6 +1,7 @@
tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(13,12): error TS2493: Tuple type '[string, number]' with length '2' cannot be assigned to tuple with length '3'.
tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(14,12): error TS2460: Type 'StrNum' has no property '2'.
tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(15,5): error TS2461: Type '{ 0: string; 1: number; }' is not an array type.
tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(15,12): error TS2460: Type '{ 0: string; 1: number; }' has no property '2'.
tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(16,5): error TS2322: Type '[string, number]' is not assignable to type '[number, number, number]'.
Types of property '0' are incompatible.
Type 'string' is not assignable to type 'number'.
@@ -46,7 +47,7 @@ tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(30,5): error
Type 'string' is not assignable to type 'number'.
==== tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts (18 errors) ====
==== tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts (19 errors) ====
interface StrNum extends Array<string|number> {
0: string;
1: number;
@@ -68,6 +69,8 @@ tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(30,5): error
var [g, h, i] = z;
~~~~~~~~~
!!! error TS2461: Type '{ 0: string; 1: number; }' is not an array type.
~
!!! error TS2460: Type '{ 0: string; 1: number; }' has no property '2'.
var j1: [number, number, number] = x;
~~
!!! error TS2322: Type '[string, number]' is not assignable to type '[number, number, number]'.
@@ -70,6 +70,7 @@ var p6 = ({ a }) => { };
var p7 = ({ a: { b } }) => { };
>p7 : Symbol(p7, Decl(arrowFunctionExpressions.ts, 21, 3))
>a : Symbol(a)
>b : Symbol(b, Decl(arrowFunctionExpressions.ts, 21, 16))
var p8 = ({ a = 1 }) => { };
@@ -78,6 +79,7 @@ var p8 = ({ a = 1 }) => { };
var p9 = ({ a: { b = 1 } = { b: 1 } }) => { };
>p9 : Symbol(p9, Decl(arrowFunctionExpressions.ts, 23, 3))
>a : Symbol(a)
>b : Symbol(b, Decl(arrowFunctionExpressions.ts, 23, 16))
>b : Symbol(b, Decl(arrowFunctionExpressions.ts, 23, 28))
@@ -23,6 +23,7 @@ function bar({a1, b1, c1}: { a1: number, b1: boolean, c1: string }): void { }
function baz({a2, b2: {b1, c1}}: { a2: number, b2: { b1: boolean, c1: string } }): void { }
>baz : Symbol(baz, Decl(declarationEmitDestructuring1.ts, 2, 77))
>a2 : Symbol(a2, Decl(declarationEmitDestructuring1.ts, 3, 14))
>b2 : Symbol(b2, Decl(declarationEmitDestructuring1.ts, 3, 46))
>b1 : Symbol(b1, Decl(declarationEmitDestructuring1.ts, 3, 23))
>c1 : Symbol(c1, Decl(declarationEmitDestructuring1.ts, 3, 26))
>a2 : Symbol(a2, Decl(declarationEmitDestructuring1.ts, 3, 34))
@@ -17,6 +17,7 @@ var [a2, [b2, { x12, y12: c2 }]=["abc", { x12: 10, y12: false }]] = [1, ["hello"
>a2 : Symbol(a2, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 5))
>b2 : Symbol(b2, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 10))
>x12 : Symbol(x12, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 15))
>y12 : Symbol(y12, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 91))
>c2 : Symbol(c2, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 20))
>x12 : Symbol(x12, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 41))
>y12 : Symbol(y12, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 50))
@@ -21,24 +21,33 @@ var { x6, y6 } = { x6: 5, y6: "hello" };
>y6 : Symbol(y6, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 4, 25))
var { x7: a1 } = { x7: 5, y7: "hello" };
>x7 : Symbol(x7, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 5, 18))
>a1 : Symbol(a1, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 5, 5))
>x7 : Symbol(x7, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 5, 18))
>y7 : Symbol(y7, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 5, 25))
var { y8: b1 } = { x8: 5, y8: "hello" };
>y8 : Symbol(y8, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 6, 25))
>b1 : Symbol(b1, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 6, 5))
>x8 : Symbol(x8, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 6, 18))
>y8 : Symbol(y8, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 6, 25))
var { x9: a2, y9: b2 } = { x9: 5, y9: "hello" };
>x9 : Symbol(x9, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 7, 26))
>a2 : Symbol(a2, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 7, 5))
>y9 : Symbol(y9, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 7, 33))
>b2 : Symbol(b2, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 7, 13))
>x9 : Symbol(x9, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 7, 26))
>y9 : Symbol(y9, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 7, 33))
var { a: x11, b: { a: y11, b: { a: z11 }}} = { a: 1, b: { a: "hello", b: { a: true } } };
>a : Symbol(a, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 46))
>x11 : Symbol(x11, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 5))
>b : Symbol(b, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 52))
>a : Symbol(a, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 57))
>y11 : Symbol(y11, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 18))
>b : Symbol(b, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 69))
>a : Symbol(a, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 74))
>z11 : Symbol(z11, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 31))
>a : Symbol(a, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 46))
>b : Symbol(b, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 52))
@@ -21,17 +21,21 @@ var { x6, y6 } = { x6: 5, y6: "hello" };
>y6 : Symbol(y6, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 4, 25))
var { x7: a1 } = { x7: 5, y7: "hello" };
>x7 : Symbol(x7, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 5, 18))
>a1 : Symbol(a1, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 5, 5))
>x7 : Symbol(x7, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 5, 18))
>y7 : Symbol(y7, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 5, 25))
var { y8: b1 } = { x8: 5, y8: "hello" };
>y8 : Symbol(y8, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 6, 25))
>b1 : Symbol(b1, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 6, 5))
>x8 : Symbol(x8, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 6, 18))
>y8 : Symbol(y8, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 6, 25))
var { x9: a2, y9: b2 } = { x9: 5, y9: "hello" };
>x9 : Symbol(x9, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 7, 26))
>a2 : Symbol(a2, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 7, 5))
>y9 : Symbol(y9, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 7, 33))
>b2 : Symbol(b2, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 7, 13))
>x9 : Symbol(x9, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 7, 26))
>y9 : Symbol(y9, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 7, 33))
@@ -1,8 +1,13 @@
=== tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern2.ts ===
var { a: x11, b: { a: y11, b: { a: z11 }}} = { a: 1, b: { a: "hello", b: { a: true } } };
>a : Symbol(a, Decl(declarationEmitDestructuringObjectLiteralPattern2.ts, 1, 46))
>x11 : Symbol(x11, Decl(declarationEmitDestructuringObjectLiteralPattern2.ts, 1, 5))
>b : Symbol(b, Decl(declarationEmitDestructuringObjectLiteralPattern2.ts, 1, 52))
>a : Symbol(a, Decl(declarationEmitDestructuringObjectLiteralPattern2.ts, 1, 57))
>y11 : Symbol(y11, Decl(declarationEmitDestructuringObjectLiteralPattern2.ts, 1, 18))
>b : Symbol(b, Decl(declarationEmitDestructuringObjectLiteralPattern2.ts, 1, 69))
>a : Symbol(a, Decl(declarationEmitDestructuringObjectLiteralPattern2.ts, 1, 74))
>z11 : Symbol(z11, Decl(declarationEmitDestructuringObjectLiteralPattern2.ts, 1, 31))
>a : Symbol(a, Decl(declarationEmitDestructuringObjectLiteralPattern2.ts, 1, 46))
>b : Symbol(b, Decl(declarationEmitDestructuringObjectLiteralPattern2.ts, 1, 52))
@@ -19,6 +19,7 @@ var { b1, } = { b1:1, };
>b1 : Symbol(b1, Decl(destructuringObjectBindingPatternAndAssignment1ES5.ts, 11, 15))
var { b2: { b21 } = { b21: "string" } } = { b2: { b21: "world" } };
>b2 : Symbol(b2, Decl(destructuringObjectBindingPatternAndAssignment1ES5.ts, 12, 44))
>b21 : Symbol(b21, Decl(destructuringObjectBindingPatternAndAssignment1ES5.ts, 12, 11))
>b21 : Symbol(b21, Decl(destructuringObjectBindingPatternAndAssignment1ES5.ts, 12, 21))
>b2 : Symbol(b2, Decl(destructuringObjectBindingPatternAndAssignment1ES5.ts, 12, 44))
@@ -32,6 +33,7 @@ var {b4 = 1}: any = { b4: 100000 };
>b4 : Symbol(b4, Decl(destructuringObjectBindingPatternAndAssignment1ES5.ts, 14, 21))
var {b5: { b52 } } = { b5: { b52 } };
>b5 : Symbol(b5, Decl(destructuringObjectBindingPatternAndAssignment1ES5.ts, 15, 23))
>b52 : Symbol(b52, Decl(destructuringObjectBindingPatternAndAssignment1ES5.ts, 15, 10))
>b5 : Symbol(b5, Decl(destructuringObjectBindingPatternAndAssignment1ES5.ts, 15, 23))
>b52 : Symbol(b52, Decl(destructuringObjectBindingPatternAndAssignment1ES5.ts, 15, 29))
@@ -19,6 +19,7 @@ var { b1, } = { b1:1, };
>b1 : Symbol(b1, Decl(destructuringObjectBindingPatternAndAssignment1ES6.ts, 11, 15))
var { b2: { b21 } = { b21: "string" } } = { b2: { b21: "world" } };
>b2 : Symbol(b2, Decl(destructuringObjectBindingPatternAndAssignment1ES6.ts, 12, 44))
>b21 : Symbol(b21, Decl(destructuringObjectBindingPatternAndAssignment1ES6.ts, 12, 11))
>b21 : Symbol(b21, Decl(destructuringObjectBindingPatternAndAssignment1ES6.ts, 12, 21))
>b2 : Symbol(b2, Decl(destructuringObjectBindingPatternAndAssignment1ES6.ts, 12, 44))
@@ -32,6 +33,7 @@ var {b4 = 1}: any = { b4: 100000 };
>b4 : Symbol(b4, Decl(destructuringObjectBindingPatternAndAssignment1ES6.ts, 14, 21))
var {b5: { b52 } } = { b5: { b52 } };
>b5 : Symbol(b5, Decl(destructuringObjectBindingPatternAndAssignment1ES6.ts, 15, 23))
>b52 : Symbol(b52, Decl(destructuringObjectBindingPatternAndAssignment1ES6.ts, 15, 10))
>b5 : Symbol(b5, Decl(destructuringObjectBindingPatternAndAssignment1ES6.ts, 15, 23))
>b52 : Symbol(b52, Decl(destructuringObjectBindingPatternAndAssignment1ES6.ts, 15, 29))
@@ -17,6 +17,7 @@ var [a3, [[a4]], a5]: [number, [[string]], boolean] = [1, [["hello"]], true];
// The type T associated with a destructuring variable declaration is determined as follows:
// Otherwise, if the declaration includes an initializer expression, T is the type of that initializer expression.
var { b1: { b11 } = { b11: "string" } } = { b1: { b11: "world" } };
>b1 : Symbol(b1, Decl(destructuringVariableDeclaration1ES5.ts, 7, 44))
>b11 : Symbol(b11, Decl(destructuringVariableDeclaration1ES5.ts, 7, 11))
>b11 : Symbol(b11, Decl(destructuringVariableDeclaration1ES5.ts, 7, 21))
>b1 : Symbol(b1, Decl(destructuringVariableDeclaration1ES5.ts, 7, 44))
@@ -74,6 +75,7 @@ var [d3, d4] = [1, "string", ...temp1];
// Combining both forms of destructuring,
var {e: [e1, e2, e3 = { b1: 1000, b4: 200 }]} = { e: [1, 2, { b1: 4, b4: 0 }] };
>e : Symbol(e, Decl(destructuringVariableDeclaration1ES5.ts, 31, 49))
>e1 : Symbol(e1, Decl(destructuringVariableDeclaration1ES5.ts, 31, 9))
>e2 : Symbol(e2, Decl(destructuringVariableDeclaration1ES5.ts, 31, 12))
>e3 : Symbol(e3, Decl(destructuringVariableDeclaration1ES5.ts, 31, 16))
@@ -84,8 +86,10 @@ var {e: [e1, e2, e3 = { b1: 1000, b4: 200 }]} = { e: [1, 2, { b1: 4, b4: 0 }] };
>b4 : Symbol(b4, Decl(destructuringVariableDeclaration1ES5.ts, 31, 68))
var {f: [f1, f2, { f3: f4, f5 }, , ]} = { f: [1, 2, { f3: 4, f5: 0 }] };
>f : Symbol(f, Decl(destructuringVariableDeclaration1ES5.ts, 32, 41))
>f1 : Symbol(f1, Decl(destructuringVariableDeclaration1ES5.ts, 32, 9))
>f2 : Symbol(f2, Decl(destructuringVariableDeclaration1ES5.ts, 32, 12))
>f3 : Symbol(f3, Decl(destructuringVariableDeclaration1ES5.ts, 32, 53))
>f4 : Symbol(f4, Decl(destructuringVariableDeclaration1ES5.ts, 32, 18))
>f5 : Symbol(f5, Decl(destructuringVariableDeclaration1ES5.ts, 32, 26))
>f : Symbol(f, Decl(destructuringVariableDeclaration1ES5.ts, 32, 41))
@@ -96,6 +100,7 @@ var {f: [f1, f2, { f3: f4, f5 }, , ]} = { f: [1, 2, { f3: 4, f5: 0 }] };
// an initializer expression, the type of the initializer expression is required to be assignable
// to the widened form of the type associated with the destructuring variable declaration, binding property, or binding element.
var {g: {g1 = [undefined, null]}}: { g: { g1: any[] } } = { g: { g1: [1, 2] } };
>g : Symbol(g, Decl(destructuringVariableDeclaration1ES5.ts, 37, 36))
>g1 : Symbol(g1, Decl(destructuringVariableDeclaration1ES5.ts, 37, 9))
>undefined : Symbol(undefined)
>g : Symbol(g, Decl(destructuringVariableDeclaration1ES5.ts, 37, 36))
@@ -104,6 +109,7 @@ var {g: {g1 = [undefined, null]}}: { g: { g1: any[] } } = { g: { g1: [1, 2] } };
>g1 : Symbol(g1, Decl(destructuringVariableDeclaration1ES5.ts, 37, 64))
var {h: {h1 = [undefined, null]}}: { h: { h1: number[] } } = { h: { h1: [1, 2] } };
>h : Symbol(h, Decl(destructuringVariableDeclaration1ES5.ts, 38, 36))
>h1 : Symbol(h1, Decl(destructuringVariableDeclaration1ES5.ts, 38, 9))
>undefined : Symbol(undefined)
>h : Symbol(h, Decl(destructuringVariableDeclaration1ES5.ts, 38, 36))
@@ -17,6 +17,7 @@ var [a3, [[a4]], a5]: [number, [[string]], boolean] = [1, [["hello"]], true];
// The type T associated with a destructuring variable declaration is determined as follows:
// Otherwise, if the declaration includes an initializer expression, T is the type of that initializer expression.
var { b1: { b11 } = { b11: "string" } } = { b1: { b11: "world" } };
>b1 : Symbol(b1, Decl(destructuringVariableDeclaration1ES6.ts, 7, 44))
>b11 : Symbol(b11, Decl(destructuringVariableDeclaration1ES6.ts, 7, 11))
>b11 : Symbol(b11, Decl(destructuringVariableDeclaration1ES6.ts, 7, 21))
>b1 : Symbol(b1, Decl(destructuringVariableDeclaration1ES6.ts, 7, 44))
@@ -74,6 +75,7 @@ var [d3, d4] = [1, "string", ...temp1];
// Combining both forms of destructuring,
var {e: [e1, e2, e3 = { b1: 1000, b4: 200 }]} = { e: [1, 2, { b1: 4, b4: 0 }] };
>e : Symbol(e, Decl(destructuringVariableDeclaration1ES6.ts, 31, 49))
>e1 : Symbol(e1, Decl(destructuringVariableDeclaration1ES6.ts, 31, 9))
>e2 : Symbol(e2, Decl(destructuringVariableDeclaration1ES6.ts, 31, 12))
>e3 : Symbol(e3, Decl(destructuringVariableDeclaration1ES6.ts, 31, 16))
@@ -84,8 +86,10 @@ var {e: [e1, e2, e3 = { b1: 1000, b4: 200 }]} = { e: [1, 2, { b1: 4, b4: 0 }] };
>b4 : Symbol(b4, Decl(destructuringVariableDeclaration1ES6.ts, 31, 68))
var {f: [f1, f2, { f3: f4, f5 }, , ]} = { f: [1, 2, { f3: 4, f5: 0 }] };
>f : Symbol(f, Decl(destructuringVariableDeclaration1ES6.ts, 32, 41))
>f1 : Symbol(f1, Decl(destructuringVariableDeclaration1ES6.ts, 32, 9))
>f2 : Symbol(f2, Decl(destructuringVariableDeclaration1ES6.ts, 32, 12))
>f3 : Symbol(f3, Decl(destructuringVariableDeclaration1ES6.ts, 32, 53))
>f4 : Symbol(f4, Decl(destructuringVariableDeclaration1ES6.ts, 32, 18))
>f5 : Symbol(f5, Decl(destructuringVariableDeclaration1ES6.ts, 32, 26))
>f : Symbol(f, Decl(destructuringVariableDeclaration1ES6.ts, 32, 41))
@@ -96,6 +100,7 @@ var {f: [f1, f2, { f3: f4, f5 }, , ]} = { f: [1, 2, { f3: 4, f5: 0 }] };
// an initializer expression, the type of the initializer expression is required to be assignable
// to the widened form of the type associated with the destructuring variable declaration, binding property, or binding element.
var {g: {g1 = [undefined, null]}}: { g: { g1: any[] } } = { g: { g1: [1, 2] } };
>g : Symbol(g, Decl(destructuringVariableDeclaration1ES6.ts, 37, 36))
>g1 : Symbol(g1, Decl(destructuringVariableDeclaration1ES6.ts, 37, 9))
>undefined : Symbol(undefined)
>g : Symbol(g, Decl(destructuringVariableDeclaration1ES6.ts, 37, 36))
@@ -104,6 +109,7 @@ var {g: {g1 = [undefined, null]}}: { g: { g1: any[] } } = { g: { g1: [1, 2] } };
>g1 : Symbol(g1, Decl(destructuringVariableDeclaration1ES6.ts, 37, 64))
var {h: {h1 = [undefined, null]}}: { h: { h1: number[] } } = { h: { h1: [1, 2] } };
>h : Symbol(h, Decl(destructuringVariableDeclaration1ES6.ts, 38, 36))
>h1 : Symbol(h1, Decl(destructuringVariableDeclaration1ES6.ts, 38, 9))
>undefined : Symbol(undefined)
>h : Symbol(h, Decl(destructuringVariableDeclaration1ES6.ts, 38, 36))
@@ -12,6 +12,7 @@ let [baz] = [];
>baz : Symbol(baz, Decl(downlevelLetConst12.ts, 6, 5))
let {a: baz2} = { a: 1 };
>a : Symbol(a, Decl(downlevelLetConst12.ts, 7, 17))
>baz2 : Symbol(baz2, Decl(downlevelLetConst12.ts, 7, 5))
>a : Symbol(a, Decl(downlevelLetConst12.ts, 7, 17))
@@ -19,6 +20,7 @@ const [baz3] = []
>baz3 : Symbol(baz3, Decl(downlevelLetConst12.ts, 9, 7))
const {a: baz4} = { a: 1 };
>a : Symbol(a, Decl(downlevelLetConst12.ts, 10, 19))
>baz4 : Symbol(baz4, Decl(downlevelLetConst12.ts, 10, 7))
>a : Symbol(a, Decl(downlevelLetConst12.ts, 10, 19))
@@ -16,10 +16,12 @@ export const [bar2] = [2];
>bar2 : Symbol(bar2, Decl(downlevelLetConst13.ts, 7, 14))
export let {a: bar3} = { a: 1 };
>a : Symbol(a, Decl(downlevelLetConst13.ts, 8, 24))
>bar3 : Symbol(bar3, Decl(downlevelLetConst13.ts, 8, 12))
>a : Symbol(a, Decl(downlevelLetConst13.ts, 8, 24))
export const {a: bar4} = { a: 1 };
>a : Symbol(a, Decl(downlevelLetConst13.ts, 9, 26))
>bar4 : Symbol(bar4, Decl(downlevelLetConst13.ts, 9, 14))
>a : Symbol(a, Decl(downlevelLetConst13.ts, 9, 26))
@@ -39,10 +41,12 @@ export module M {
>bar6 : Symbol(bar6, Decl(downlevelLetConst13.ts, 15, 18))
export let {a: bar7} = { a: 1 };
>a : Symbol(a, Decl(downlevelLetConst13.ts, 16, 28))
>bar7 : Symbol(bar7, Decl(downlevelLetConst13.ts, 16, 16))
>a : Symbol(a, Decl(downlevelLetConst13.ts, 16, 28))
export const {a: bar8} = { a: 1 };
>a : Symbol(a, Decl(downlevelLetConst13.ts, 17, 30))
>bar8 : Symbol(bar8, Decl(downlevelLetConst13.ts, 17, 18))
>a : Symbol(a, Decl(downlevelLetConst13.ts, 17, 30))
}
@@ -35,6 +35,7 @@ var z0, z1, z2, z3;
>z1 : Symbol(z1, Decl(downlevelLetConst14.ts, 11, 9))
let {a: z2} = { a: 1 };
>a : Symbol(a, Decl(downlevelLetConst14.ts, 13, 19))
>z2 : Symbol(z2, Decl(downlevelLetConst14.ts, 13, 9))
>a : Symbol(a, Decl(downlevelLetConst14.ts, 13, 19))
@@ -43,6 +44,7 @@ var z0, z1, z2, z3;
>z2 : Symbol(z2, Decl(downlevelLetConst14.ts, 13, 9))
let {a: z3} = { a: 1 };
>a : Symbol(a, Decl(downlevelLetConst14.ts, 15, 19))
>z3 : Symbol(z3, Decl(downlevelLetConst14.ts, 15, 9))
>a : Symbol(a, Decl(downlevelLetConst14.ts, 15, 19))
@@ -86,6 +88,7 @@ var y = true;
>y : Symbol(y, Decl(downlevelLetConst14.ts, 29, 11))
let {a: z6} = {a: 1}
>a : Symbol(a, Decl(downlevelLetConst14.ts, 30, 23))
>z6 : Symbol(z6, Decl(downlevelLetConst14.ts, 30, 13))
>a : Symbol(a, Decl(downlevelLetConst14.ts, 30, 23))
@@ -129,6 +132,7 @@ var z5 = 1;
>_z : Symbol(_z, Decl(downlevelLetConst14.ts, 46, 11))
let {a: _z5} = { a: 1 };
>a : Symbol(a, Decl(downlevelLetConst14.ts, 47, 24))
>_z5 : Symbol(_z5, Decl(downlevelLetConst14.ts, 47, 13))
>a : Symbol(a, Decl(downlevelLetConst14.ts, 47, 24))
@@ -28,6 +28,7 @@ var z0, z1, z2, z3;
>z0 : Symbol(z0, Decl(downlevelLetConst15.ts, 9, 11))
const [{a: z1}] = [{a: 1}]
>a : Symbol(a, Decl(downlevelLetConst15.ts, 11, 24))
>z1 : Symbol(z1, Decl(downlevelLetConst15.ts, 11, 12))
>a : Symbol(a, Decl(downlevelLetConst15.ts, 11, 24))
@@ -36,6 +37,7 @@ var z0, z1, z2, z3;
>z1 : Symbol(z1, Decl(downlevelLetConst15.ts, 11, 12))
const {a: z2} = { a: 1 };
>a : Symbol(a, Decl(downlevelLetConst15.ts, 13, 21))
>z2 : Symbol(z2, Decl(downlevelLetConst15.ts, 13, 11))
>a : Symbol(a, Decl(downlevelLetConst15.ts, 13, 21))
@@ -44,6 +46,8 @@ var z0, z1, z2, z3;
>z2 : Symbol(z2, Decl(downlevelLetConst15.ts, 13, 11))
const {a: {b: z3}} = { a: {b: 1} };
>a : Symbol(a, Decl(downlevelLetConst15.ts, 15, 26))
>b : Symbol(b, Decl(downlevelLetConst15.ts, 15, 31))
>z3 : Symbol(z3, Decl(downlevelLetConst15.ts, 15, 15))
>a : Symbol(a, Decl(downlevelLetConst15.ts, 15, 26))
>b : Symbol(b, Decl(downlevelLetConst15.ts, 15, 31))
@@ -88,6 +92,7 @@ var y = true;
>y : Symbol(y, Decl(downlevelLetConst15.ts, 29, 13))
const {a: z6} = { a: 1 }
>a : Symbol(a, Decl(downlevelLetConst15.ts, 30, 25))
>z6 : Symbol(z6, Decl(downlevelLetConst15.ts, 30, 15))
>a : Symbol(a, Decl(downlevelLetConst15.ts, 30, 25))
@@ -131,6 +136,7 @@ var z5 = 1;
>_z : Symbol(_z, Decl(downlevelLetConst15.ts, 46, 13))
const {a: _z5} = { a: 1 };
>a : Symbol(a, Decl(downlevelLetConst15.ts, 47, 26))
>_z5 : Symbol(_z5, Decl(downlevelLetConst15.ts, 47, 15))
>a : Symbol(a, Decl(downlevelLetConst15.ts, 47, 26))
@@ -56,6 +56,7 @@ var p6 = ({ a }) => { };
var p7 = ({ a: { b } }) => { };
>p7 : Symbol(p7, Decl(emitArrowFunctionES6.ts, 15, 3))
>a : Symbol(a)
>b : Symbol(b, Decl(emitArrowFunctionES6.ts, 15, 16))
var p8 = ({ a = 1 }) => { };
@@ -64,6 +65,7 @@ var p8 = ({ a = 1 }) => { };
var p9 = ({ a: { b = 1 } = { b: 1 } }) => { };
>p9 : Symbol(p9, Decl(emitArrowFunctionES6.ts, 17, 3))
>a : Symbol(a)
>b : Symbol(b, Decl(emitArrowFunctionES6.ts, 17, 16))
>b : Symbol(b, Decl(emitArrowFunctionES6.ts, 17, 28))
@@ -4,6 +4,7 @@ function f() {
>f : Symbol(f, Decl(emitArrowFunctionWhenUsingArguments18_ES6.ts, 0, 0))
var { arguments: args } = { arguments };
>arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments18_ES6.ts, 2, 31))
>args : Symbol(args, Decl(emitArrowFunctionWhenUsingArguments18_ES6.ts, 2, 9))
>arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments18_ES6.ts, 2, 31))
@@ -2,7 +2,7 @@
function f([]) {
var x, y, z;
var x, y, z;
}
//// [emptyArrayBindingPatternParameter01.js]
@@ -4,8 +4,8 @@
function f([]) {
>f : Symbol(f, Decl(emptyArrayBindingPatternParameter01.ts, 0, 0))
var x, y, z;
>x : Symbol(x, Decl(emptyArrayBindingPatternParameter01.ts, 3, 4))
>y : Symbol(y, Decl(emptyArrayBindingPatternParameter01.ts, 3, 7))
>z : Symbol(z, Decl(emptyArrayBindingPatternParameter01.ts, 3, 10))
var x, y, z;
>x : Symbol(x, Decl(emptyArrayBindingPatternParameter01.ts, 3, 7))
>y : Symbol(y, Decl(emptyArrayBindingPatternParameter01.ts, 3, 10))
>z : Symbol(z, Decl(emptyArrayBindingPatternParameter01.ts, 3, 13))
}
@@ -4,7 +4,7 @@
function f([]) {
>f : ([]: any[]) => void
var x, y, z;
var x, y, z;
>x : any
>y : any
>z : any
@@ -0,0 +1,11 @@
//// [emptyAssignmentPatterns01_ES5.ts]
var a: any;
({} = a);
([] = a);
//// [emptyAssignmentPatterns01_ES5.js]
var a;
(a);
(a);
@@ -0,0 +1,11 @@
=== tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns01_ES5.ts ===
var a: any;
>a : Symbol(a, Decl(emptyAssignmentPatterns01_ES5.ts, 1, 3))
({} = a);
>a : Symbol(a, Decl(emptyAssignmentPatterns01_ES5.ts, 1, 3))
([] = a);
>a : Symbol(a, Decl(emptyAssignmentPatterns01_ES5.ts, 1, 3))
@@ -0,0 +1,17 @@
=== tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns01_ES5.ts ===
var a: any;
>a : any
({} = a);
>({} = a) : any
>{} = a : any
>{} : {}
>a : any
([] = a);
>([] = a) : any
>[] = a : any
>[] : undefined[]
>a : any
@@ -0,0 +1,11 @@
//// [emptyAssignmentPatterns01_ES6.ts]
var a: any;
({} = a);
([] = a);
//// [emptyAssignmentPatterns01_ES6.js]
var a;
({} = a);
([] = a);
@@ -0,0 +1,11 @@
=== tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns01_ES6.ts ===
var a: any;
>a : Symbol(a, Decl(emptyAssignmentPatterns01_ES6.ts, 1, 3))
({} = a);
>a : Symbol(a, Decl(emptyAssignmentPatterns01_ES6.ts, 1, 3))
([] = a);
>a : Symbol(a, Decl(emptyAssignmentPatterns01_ES6.ts, 1, 3))
@@ -0,0 +1,17 @@
=== tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns01_ES6.ts ===
var a: any;
>a : any
({} = a);
>({} = a) : any
>{} = a : any
>{} : {}
>a : any
([] = a);
>([] = a) : any
>[] = a : any
>[] : undefined[]
>a : any
@@ -0,0 +1,13 @@
//// [emptyAssignmentPatterns02_ES5.ts]
var a: any;
let x, y, z, a1, a2, a3;
({} = { x, y, z } = a);
([] = [ a1, a2, a3] = a);
//// [emptyAssignmentPatterns02_ES5.js]
var a;
var x, y, z, a1, a2, a3;
((x = a.x, y = a.y, z = a.z, a));
((a1 = a[0], a2 = a[1], a3 = a[2], a));
@@ -0,0 +1,25 @@
=== tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns02_ES5.ts ===
var a: any;
>a : Symbol(a, Decl(emptyAssignmentPatterns02_ES5.ts, 1, 3))
let x, y, z, a1, a2, a3;
>x : Symbol(x, Decl(emptyAssignmentPatterns02_ES5.ts, 2, 3))
>y : Symbol(y, Decl(emptyAssignmentPatterns02_ES5.ts, 2, 6))
>z : Symbol(z, Decl(emptyAssignmentPatterns02_ES5.ts, 2, 9))
>a1 : Symbol(a1, Decl(emptyAssignmentPatterns02_ES5.ts, 2, 12))
>a2 : Symbol(a2, Decl(emptyAssignmentPatterns02_ES5.ts, 2, 16))
>a3 : Symbol(a3, Decl(emptyAssignmentPatterns02_ES5.ts, 2, 20))
({} = { x, y, z } = a);
>x : Symbol(x, Decl(emptyAssignmentPatterns02_ES5.ts, 4, 7))
>y : Symbol(y, Decl(emptyAssignmentPatterns02_ES5.ts, 4, 10))
>z : Symbol(z, Decl(emptyAssignmentPatterns02_ES5.ts, 4, 13))
>a : Symbol(a, Decl(emptyAssignmentPatterns02_ES5.ts, 1, 3))
([] = [ a1, a2, a3] = a);
>a1 : Symbol(a1, Decl(emptyAssignmentPatterns02_ES5.ts, 2, 12))
>a2 : Symbol(a2, Decl(emptyAssignmentPatterns02_ES5.ts, 2, 16))
>a3 : Symbol(a3, Decl(emptyAssignmentPatterns02_ES5.ts, 2, 20))
>a : Symbol(a, Decl(emptyAssignmentPatterns02_ES5.ts, 1, 3))
@@ -0,0 +1,35 @@
=== tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns02_ES5.ts ===
var a: any;
>a : any
let x, y, z, a1, a2, a3;
>x : any
>y : any
>z : any
>a1 : any
>a2 : any
>a3 : any
({} = { x, y, z } = a);
>({} = { x, y, z } = a) : any
>{} = { x, y, z } = a : any
>{} : {}
>{ x, y, z } = a : any
>{ x, y, z } : { x: any; y: any; z: any; }
>x : any
>y : any
>z : any
>a : any
([] = [ a1, a2, a3] = a);
>([] = [ a1, a2, a3] = a) : any
>[] = [ a1, a2, a3] = a : any
>[] : undefined[]
>[ a1, a2, a3] = a : any
>[ a1, a2, a3] : [any, any, any]
>a1 : any
>a2 : any
>a3 : any
>a : any
@@ -0,0 +1,13 @@
//// [emptyAssignmentPatterns02_ES6.ts]
var a: any;
let x, y, z, a1, a2, a3;
({} = { x, y, z } = a);
([] = [ a1, a2, a3] = a);
//// [emptyAssignmentPatterns02_ES6.js]
var a;
let x, y, z, a1, a2, a3;
({} = { x, y, z } = a);
([] = [a1, a2, a3] = a);
@@ -0,0 +1,25 @@
=== tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns02_ES6.ts ===
var a: any;
>a : Symbol(a, Decl(emptyAssignmentPatterns02_ES6.ts, 1, 3))
let x, y, z, a1, a2, a3;
>x : Symbol(x, Decl(emptyAssignmentPatterns02_ES6.ts, 2, 3))
>y : Symbol(y, Decl(emptyAssignmentPatterns02_ES6.ts, 2, 6))
>z : Symbol(z, Decl(emptyAssignmentPatterns02_ES6.ts, 2, 9))
>a1 : Symbol(a1, Decl(emptyAssignmentPatterns02_ES6.ts, 2, 12))
>a2 : Symbol(a2, Decl(emptyAssignmentPatterns02_ES6.ts, 2, 16))
>a3 : Symbol(a3, Decl(emptyAssignmentPatterns02_ES6.ts, 2, 20))
({} = { x, y, z } = a);
>x : Symbol(x, Decl(emptyAssignmentPatterns02_ES6.ts, 4, 7))
>y : Symbol(y, Decl(emptyAssignmentPatterns02_ES6.ts, 4, 10))
>z : Symbol(z, Decl(emptyAssignmentPatterns02_ES6.ts, 4, 13))
>a : Symbol(a, Decl(emptyAssignmentPatterns02_ES6.ts, 1, 3))
([] = [ a1, a2, a3] = a);
>a1 : Symbol(a1, Decl(emptyAssignmentPatterns02_ES6.ts, 2, 12))
>a2 : Symbol(a2, Decl(emptyAssignmentPatterns02_ES6.ts, 2, 16))
>a3 : Symbol(a3, Decl(emptyAssignmentPatterns02_ES6.ts, 2, 20))
>a : Symbol(a, Decl(emptyAssignmentPatterns02_ES6.ts, 1, 3))
@@ -0,0 +1,35 @@
=== tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns02_ES6.ts ===
var a: any;
>a : any
let x, y, z, a1, a2, a3;
>x : any
>y : any
>z : any
>a1 : any
>a2 : any
>a3 : any
({} = { x, y, z } = a);
>({} = { x, y, z } = a) : any
>{} = { x, y, z } = a : any
>{} : {}
>{ x, y, z } = a : any
>{ x, y, z } : { x: any; y: any; z: any; }
>x : any
>y : any
>z : any
>a : any
([] = [ a1, a2, a3] = a);
>([] = [ a1, a2, a3] = a) : any
>[] = [ a1, a2, a3] = a : any
>[] : undefined[]
>[ a1, a2, a3] = a : any
>[ a1, a2, a3] : [any, any, any]
>a1 : any
>a2 : any
>a3 : any
>a : any
@@ -0,0 +1,11 @@
//// [emptyAssignmentPatterns03_ES5.ts]
var a: any;
({} = {} = a);
([] = [] = a);
//// [emptyAssignmentPatterns03_ES5.js]
var a;
(a);
(a);
@@ -0,0 +1,11 @@
=== tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns03_ES5.ts ===
var a: any;
>a : Symbol(a, Decl(emptyAssignmentPatterns03_ES5.ts, 1, 3))
({} = {} = a);
>a : Symbol(a, Decl(emptyAssignmentPatterns03_ES5.ts, 1, 3))
([] = [] = a);
>a : Symbol(a, Decl(emptyAssignmentPatterns03_ES5.ts, 1, 3))
@@ -0,0 +1,21 @@
=== tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns03_ES5.ts ===
var a: any;
>a : any
({} = {} = a);
>({} = {} = a) : any
>{} = {} = a : any
>{} : {}
>{} = a : any
>{} : {}
>a : any
([] = [] = a);
>([] = [] = a) : any
>[] = [] = a : any
>[] : undefined[]
>[] = a : any
>[] : undefined[]
>a : any
@@ -0,0 +1,11 @@
//// [emptyAssignmentPatterns03_ES6.ts]
var a: any;
({} = {} = a);
([] = [] = a);
//// [emptyAssignmentPatterns03_ES6.js]
var a;
({} = {} = a);
([] = [] = a);
@@ -0,0 +1,11 @@
=== tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns03_ES6.ts ===
var a: any;
>a : Symbol(a, Decl(emptyAssignmentPatterns03_ES6.ts, 1, 3))
({} = {} = a);
>a : Symbol(a, Decl(emptyAssignmentPatterns03_ES6.ts, 1, 3))
([] = [] = a);
>a : Symbol(a, Decl(emptyAssignmentPatterns03_ES6.ts, 1, 3))
@@ -0,0 +1,21 @@
=== tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns03_ES6.ts ===
var a: any;
>a : any
({} = {} = a);
>({} = {} = a) : any
>{} = {} = a : any
>{} : {}
>{} = a : any
>{} : {}
>a : any
([] = [] = a);
>([] = [] = a) : any
>[] = [] = a : any
>[] : undefined[]
>[] = a : any
>[] : undefined[]
>a : any
@@ -0,0 +1,14 @@
//// [emptyAssignmentPatterns04_ES5.ts]
var a: any;
let x, y, z, a1, a2, a3;
({ x, y, z } = {} = a);
([ a1, a2, a3] = [] = a);
//// [emptyAssignmentPatterns04_ES5.js]
var a;
var x, y, z, a1, a2, a3;
(_a = a, x = _a.x, y = _a.y, z = _a.z, _a);
(_b = a, a1 = _b[0], a2 = _b[1], a3 = _b[2], _b);
var _a, _b;
@@ -0,0 +1,25 @@
=== tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns04_ES5.ts ===
var a: any;
>a : Symbol(a, Decl(emptyAssignmentPatterns04_ES5.ts, 1, 3))
let x, y, z, a1, a2, a3;
>x : Symbol(x, Decl(emptyAssignmentPatterns04_ES5.ts, 2, 3))
>y : Symbol(y, Decl(emptyAssignmentPatterns04_ES5.ts, 2, 6))
>z : Symbol(z, Decl(emptyAssignmentPatterns04_ES5.ts, 2, 9))
>a1 : Symbol(a1, Decl(emptyAssignmentPatterns04_ES5.ts, 2, 12))
>a2 : Symbol(a2, Decl(emptyAssignmentPatterns04_ES5.ts, 2, 16))
>a3 : Symbol(a3, Decl(emptyAssignmentPatterns04_ES5.ts, 2, 20))
({ x, y, z } = {} = a);
>x : Symbol(x, Decl(emptyAssignmentPatterns04_ES5.ts, 4, 2))
>y : Symbol(y, Decl(emptyAssignmentPatterns04_ES5.ts, 4, 5))
>z : Symbol(z, Decl(emptyAssignmentPatterns04_ES5.ts, 4, 8))
>a : Symbol(a, Decl(emptyAssignmentPatterns04_ES5.ts, 1, 3))
([ a1, a2, a3] = [] = a);
>a1 : Symbol(a1, Decl(emptyAssignmentPatterns04_ES5.ts, 2, 12))
>a2 : Symbol(a2, Decl(emptyAssignmentPatterns04_ES5.ts, 2, 16))
>a3 : Symbol(a3, Decl(emptyAssignmentPatterns04_ES5.ts, 2, 20))
>a : Symbol(a, Decl(emptyAssignmentPatterns04_ES5.ts, 1, 3))
@@ -0,0 +1,35 @@
=== tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns04_ES5.ts ===
var a: any;
>a : any
let x, y, z, a1, a2, a3;
>x : any
>y : any
>z : any
>a1 : any
>a2 : any
>a3 : any
({ x, y, z } = {} = a);
>({ x, y, z } = {} = a) : any
>{ x, y, z } = {} = a : any
>{ x, y, z } : { x: any; y: any; z: any; }
>x : any
>y : any
>z : any
>{} = a : any
>{} : {}
>a : any
([ a1, a2, a3] = [] = a);
>([ a1, a2, a3] = [] = a) : any
>[ a1, a2, a3] = [] = a : any
>[ a1, a2, a3] : [any, any, any]
>a1 : any
>a2 : any
>a3 : any
>[] = a : any
>[] : undefined[]
>a : any
@@ -0,0 +1,13 @@
//// [emptyAssignmentPatterns04_ES6.ts]
var a: any;
let x, y, z, a1, a2, a3;
({ x, y, z } = {} = a);
([ a1, a2, a3] = [] = a);
//// [emptyAssignmentPatterns04_ES6.js]
var a;
let x, y, z, a1, a2, a3;
({ x, y, z } = {} = a);
([a1, a2, a3] = [] = a);
@@ -0,0 +1,25 @@
=== tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns04_ES6.ts ===
var a: any;
>a : Symbol(a, Decl(emptyAssignmentPatterns04_ES6.ts, 1, 3))
let x, y, z, a1, a2, a3;
>x : Symbol(x, Decl(emptyAssignmentPatterns04_ES6.ts, 2, 3))
>y : Symbol(y, Decl(emptyAssignmentPatterns04_ES6.ts, 2, 6))
>z : Symbol(z, Decl(emptyAssignmentPatterns04_ES6.ts, 2, 9))
>a1 : Symbol(a1, Decl(emptyAssignmentPatterns04_ES6.ts, 2, 12))
>a2 : Symbol(a2, Decl(emptyAssignmentPatterns04_ES6.ts, 2, 16))
>a3 : Symbol(a3, Decl(emptyAssignmentPatterns04_ES6.ts, 2, 20))
({ x, y, z } = {} = a);
>x : Symbol(x, Decl(emptyAssignmentPatterns04_ES6.ts, 4, 2))
>y : Symbol(y, Decl(emptyAssignmentPatterns04_ES6.ts, 4, 5))
>z : Symbol(z, Decl(emptyAssignmentPatterns04_ES6.ts, 4, 8))
>a : Symbol(a, Decl(emptyAssignmentPatterns04_ES6.ts, 1, 3))
([ a1, a2, a3] = [] = a);
>a1 : Symbol(a1, Decl(emptyAssignmentPatterns04_ES6.ts, 2, 12))
>a2 : Symbol(a2, Decl(emptyAssignmentPatterns04_ES6.ts, 2, 16))
>a3 : Symbol(a3, Decl(emptyAssignmentPatterns04_ES6.ts, 2, 20))
>a : Symbol(a, Decl(emptyAssignmentPatterns04_ES6.ts, 1, 3))
@@ -0,0 +1,35 @@
=== tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns04_ES6.ts ===
var a: any;
>a : any
let x, y, z, a1, a2, a3;
>x : any
>y : any
>z : any
>a1 : any
>a2 : any
>a3 : any
({ x, y, z } = {} = a);
>({ x, y, z } = {} = a) : any
>{ x, y, z } = {} = a : any
>{ x, y, z } : { x: any; y: any; z: any; }
>x : any
>y : any
>z : any
>{} = a : any
>{} : {}
>a : any
([ a1, a2, a3] = [] = a);
>([ a1, a2, a3] = [] = a) : any
>[ a1, a2, a3] = [] = a : any
>[ a1, a2, a3] : [any, any, any]
>a1 : any
>a2 : any
>a3 : any
>[] = a : any
>[] : undefined[]
>a : any
+27
View File
@@ -0,0 +1,27 @@
//// [es5-commonjs.ts]
export default class A
{
constructor ()
{
}
public B()
{
return 42;
}
}
//// [es5-commonjs.js]
var A = (function () {
function A() {
}
A.prototype.B = function () {
return 42;
};
return A;
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = A;
@@ -0,0 +1,17 @@
=== tests/cases/compiler/es5-commonjs.ts ===
export default class A
>A : Symbol(A, Decl(es5-commonjs.ts, 0, 0))
{
constructor ()
{
}
public B()
>B : Symbol(B, Decl(es5-commonjs.ts, 6, 5))
{
return 42;
}
}
@@ -0,0 +1,18 @@
=== tests/cases/compiler/es5-commonjs.ts ===
export default class A
>A : A
{
constructor ()
{
}
public B()
>B : () => number
{
return 42;
>42 : number
}
}
@@ -0,0 +1,8 @@
//// [es5-commonjs2.ts]
export default 1;
//// [es5-commonjs2.js]
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = 1;
@@ -0,0 +1,5 @@
=== tests/cases/compiler/es5-commonjs2.ts ===
No type information for this code.export default 1;
No type information for this code.
No type information for this code.
@@ -0,0 +1,5 @@
=== tests/cases/compiler/es5-commonjs2.ts ===
No type information for this code.export default 1;
No type information for this code.
No type information for this code.
@@ -0,0 +1,9 @@
//// [es5-commonjs3.ts]
export default "test";
export var __esModule = 1;
//// [es5-commonjs3.js]
exports.default = "test";
exports.__esModule = 1;
@@ -0,0 +1,6 @@
=== tests/cases/compiler/es5-commonjs3.ts ===
export default "test";
export var __esModule = 1;
>__esModule : Symbol(__esModule, Decl(es5-commonjs3.ts, 2, 10))
@@ -0,0 +1,7 @@
=== tests/cases/compiler/es5-commonjs3.ts ===
export default "test";
export var __esModule = 1;
>__esModule : number
>1 : number
@@ -0,0 +1,28 @@
//// [es5-commonjs4.ts]
export default class A
{
constructor ()
{
}
public B()
{
return 42;
}
}
export var __esModule = 1;
//// [es5-commonjs4.js]
var A = (function () {
function A() {
}
A.prototype.B = function () {
return 42;
};
return A;
})();
exports.default = A;
exports.__esModule = 1;
@@ -0,0 +1,19 @@
=== tests/cases/compiler/es5-commonjs4.ts ===
export default class A
>A : Symbol(A, Decl(es5-commonjs4.ts, 0, 0))
{
constructor ()
{
}
public B()
>B : Symbol(B, Decl(es5-commonjs4.ts, 6, 5))
{
return 42;
}
}
export var __esModule = 1;
>__esModule : Symbol(__esModule, Decl(es5-commonjs4.ts, 13, 10))
@@ -0,0 +1,21 @@
=== tests/cases/compiler/es5-commonjs4.ts ===
export default class A
>A : A
{
constructor ()
{
}
public B()
>B : () => number
{
return 42;
>42 : number
}
}
export var __esModule = 1;
>__esModule : number
>1 : number
@@ -0,0 +1,13 @@
//// [es5-commonjs5.ts]
export default function () {
return "test";
}
//// [es5-commonjs5.js]
function default_1() {
return "test";
}
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = default_1;
@@ -0,0 +1,7 @@
=== tests/cases/compiler/es5-commonjs5.ts ===
No type information for this code.export default function () {
No type information for this code. return "test";
No type information for this code.}
No type information for this code.
No type information for this code.
@@ -0,0 +1,7 @@
=== tests/cases/compiler/es5-commonjs5.ts ===
export default function () {
return "test";
>"test" : string
}
@@ -0,0 +1,10 @@
//// [es5-commonjs6.ts]
export default "test";
var __esModule = 1;
//// [es5-commonjs6.js]
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = "test";
var __esModule = 1;
@@ -0,0 +1,6 @@
=== tests/cases/compiler/es5-commonjs6.ts ===
export default "test";
var __esModule = 1;
>__esModule : Symbol(__esModule, Decl(es5-commonjs6.ts, 2, 3))
@@ -0,0 +1,7 @@
=== tests/cases/compiler/es5-commonjs6.ts ===
export default "test";
var __esModule = 1;
>__esModule : number
>1 : number
+34
View File
@@ -0,0 +1,34 @@
//// [es5-system.ts]
export default class A
{
constructor ()
{
}
public B()
{
return 42;
}
}
//// [es5-system.js]
System.register([], function(exports_1) {
var A;
return {
setters:[],
execute: function() {
A = (function () {
function A() {
}
A.prototype.B = function () {
return 42;
};
return A;
})();
exports_1("default", A);
}
}
});
@@ -0,0 +1,17 @@
=== tests/cases/compiler/es5-system.ts ===
export default class A
>A : Symbol(A, Decl(es5-system.ts, 0, 0))
{
constructor ()
{
}
public B()
>B : Symbol(B, Decl(es5-system.ts, 6, 5))
{
return 42;
}
}
@@ -0,0 +1,18 @@
=== tests/cases/compiler/es5-system.ts ===
export default class A
>A : A
{
constructor ()
{
}
public B()
>B : () => number
{
return 42;
>42 : number
}
}
+1
View File
@@ -31,5 +31,6 @@ export default class A
};
return A;
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = A;
});
@@ -12,6 +12,7 @@ var C = (function () {
C.prototype.method = function () { };
return C;
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = C;
@@ -12,6 +12,7 @@ var default_1 = (function () {
default_1.prototype.method = function () { };
return default_1;
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = default_1;
@@ -24,6 +24,7 @@ var C = (function () {
};
return C;
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = C;
var after = new C();
var t = C;
@@ -4,6 +4,7 @@ export default (1 + 2);
//// [es5ExportDefaultExpression.js]
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = (1 + 2);
@@ -5,6 +5,7 @@ export default function f() { }
//// [es5ExportDefaultFunctionDeclaration.js]
function f() { }
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = f;
@@ -5,6 +5,7 @@ export default function () { }
//// [es5ExportDefaultFunctionDeclaration2.js]
function default_1() { }
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = default_1;
@@ -13,6 +13,7 @@ var before = func();
function func() {
return func;
}
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = func;
var after = func();
@@ -8,6 +8,7 @@ export default f;
//// [es5ExportDefaultIdentifier.js]
function f() { }
exports.f = f;
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = f;
@@ -14,6 +14,7 @@ import defaultBinding2 from "es6ImportDefaultBindingAmd_0"; // elide this import
//// [es6ImportDefaultBindingAmd_0.js]
define(["require", "exports"], function (require, exports) {
var a = 10;
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = a;
});
//// [es6ImportDefaultBindingAmd_1.js]
@@ -17,6 +17,7 @@ var c = (function () {
}
return c;
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = c;
//// [client.js]
var server_1 = require("server");
@@ -22,6 +22,7 @@ var x: number = defaultBinding6;
//// [es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0.js]
var a = 10;
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = a;
//// [es6ImportDefaultBindingFollowedWithNamedImport1InEs5_1.js]
var es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_1 = require("es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0");
@@ -22,6 +22,7 @@ export var x1: number = defaultBinding6;
//// [server.js]
var a = 10;
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = a;
//// [client.js]
var server_1 = require("server");
@@ -25,6 +25,7 @@ var a = (function () {
}
return a;
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = a;
//// [client.js]
var server_1 = require("server");
@@ -27,6 +27,7 @@ define(["require", "exports"], function (require, exports) {
exports.a = 10;
exports.x = exports.a;
exports.m = exports.a;
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = {};
});
//// [client.js]
@@ -11,6 +11,7 @@ var x: number = defaultBinding;
//// [es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0.js]
var a = 10;
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = a;
//// [es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_1.js]
var es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0_1 = require("es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0"), nameSpaceBinding = es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0_1;
@@ -12,6 +12,7 @@ export var x: number = defaultBinding;
//// [server.js]
define(["require", "exports"], function (require, exports) {
var a = 10;
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = a;
});
//// [client.js]

Some files were not shown because too many files have changed in this diff Show More