Merge branch 'asyncFunctions' of https://github.com/Microsoft/TypeScript into asyncFunctions

This commit is contained in:
Ron Buckton
2015-05-13 11:39:37 -07:00
200 changed files with 3484 additions and 7464 deletions
+1
View File
@@ -15838,6 +15838,7 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
overrideMimeType(mime: string): void;
send(data?: Document): void;
send(data?: string): void;
send(data?: any): void;
setRequestHeader(header: string, value: string): void;
DONE: number;
HEADERS_RECEIVED: number;
+1
View File
@@ -14668,6 +14668,7 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
overrideMimeType(mime: string): void;
send(data?: Document): void;
send(data?: string): void;
send(data?: any): void;
setRequestHeader(header: string, value: string): void;
DONE: number;
HEADERS_RECEIVED: number;
+1
View File
@@ -17217,6 +17217,7 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
overrideMimeType(mime: string): void;
send(data?: Document): void;
send(data?: string): void;
send(data?: any): void;
setRequestHeader(header: string, value: string): void;
DONE: number;
HEADERS_RECEIVED: number;
+140 -96
View File
@@ -444,7 +444,7 @@ var ts;
for (var _i = 0; _i < parts.length; _i++) {
var part = parts[_i];
if (part !== ".") {
if (part === ".." && normalized.length > 0 && normalized[normalized.length - 1] !== "..") {
if (part === ".." && normalized.length > 0 && lastOrUndefined(normalized) !== "..") {
normalized.pop();
}
else {
@@ -536,7 +536,7 @@ var ts;
function getRelativePathToDirectoryOrUrl(directoryPathOrUrl, relativeOrAbsolutePath, currentDirectory, getCanonicalFileName, isAbsolutePathAnUrl) {
var pathComponents = getNormalizedPathOrUrlComponents(relativeOrAbsolutePath, currentDirectory);
var directoryComponents = getNormalizedPathOrUrlComponents(directoryPathOrUrl, currentDirectory);
if (directoryComponents.length > 1 && directoryComponents[directoryComponents.length - 1] === "") {
if (directoryComponents.length > 1 && lastOrUndefined(directoryComponents) === "") {
directoryComponents.length--;
}
for (var joinStartIndex = 0; joinStartIndex < pathComponents.length && joinStartIndex < directoryComponents.length; joinStartIndex++) {
@@ -1277,6 +1277,8 @@ var ts;
An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2499, category: ts.DiagnosticCategory.Error, key: "An interface can only extend an identifier/qualified-name with optional type arguments." },
A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2500, category: ts.DiagnosticCategory.Error, key: "A class can only implement an identifier/qualified-name with optional type arguments." },
A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: ts.DiagnosticCategory.Error, key: "A rest element cannot contain a binding pattern." },
_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 2502, category: ts.DiagnosticCategory.Error, key: "'{0}' is referenced directly or indirectly in its own type annotation." },
Cannot_find_namespace_0: { code: 2503, category: ts.DiagnosticCategory.Error, key: "Cannot find namespace '{0}'." },
Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
@@ -1416,6 +1418,9 @@ var ts;
Preserve_new_lines_when_emitting_code: { code: 6057, category: ts.DiagnosticCategory.Message, key: "Preserve new-lines when emitting code." },
Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir: { code: 6058, category: ts.DiagnosticCategory.Message, key: "Specifies the root directory of input files. Use to control the output directory structure with --outDir." },
File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files: { code: 6059, category: ts.DiagnosticCategory.Error, key: "File '{0}' is not under 'rootDir' '{1}'. 'rootDir' is expected to contain all source files." },
Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { code: 6060, category: ts.DiagnosticCategory.Message, key: "Specifies the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)." },
NEWLINE: { code: 6061, category: ts.DiagnosticCategory.Message, key: "NEWLINE" },
Argument_for_newLine_option_must_be_CRLF_or_LF: { code: 6062, category: ts.DiagnosticCategory.Error, key: "Argument for '--newLine' option must be 'CRLF' or 'LF'." },
Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable '{0}' implicitly has an '{1}' type." },
Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter '{0}' implicitly has an '{1}' type." },
Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member '{0}' implicitly has an '{1}' type." },
@@ -1428,7 +1433,6 @@ var ts;
Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: ts.DiagnosticCategory.Error, key: "Object literal's property '{0}' implicitly has an '{1}' type." },
Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: ts.DiagnosticCategory.Error, key: "Rest parameter '{0}' implicitly has an 'any[]' type." },
Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: ts.DiagnosticCategory.Error, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." },
_0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 7021, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." },
_0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." },
_0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." },
Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: ts.DiagnosticCategory.Error, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." },
@@ -1844,7 +1848,7 @@ var ts;
}
collecting = true;
if (result && result.length) {
result[result.length - 1].hasTrailingNewLine = true;
ts.lastOrUndefined(result).hasTrailingNewLine = true;
}
continue;
case 9:
@@ -1890,7 +1894,7 @@ var ts;
default:
if (ch > 127 && (isWhiteSpace(ch) || isLineBreak(ch))) {
if (result && result.length && isLineBreak(ch)) {
result[result.length - 1].hasTrailingNewLine = true;
ts.lastOrUndefined(result).hasTrailingNewLine = true;
}
pos++;
continue;
@@ -3908,7 +3912,7 @@ var ts;
}
ts.hasQuestionToken = hasQuestionToken;
function hasRestParameters(s) {
return s.parameters.length > 0 && s.parameters[s.parameters.length - 1].dotDotDotToken !== undefined;
return s.parameters.length > 0 && ts.lastOrUndefined(s.parameters).dotDotDotToken !== undefined;
}
ts.hasRestParameters = hasRestParameters;
function isLiteralKind(kind) {
@@ -4336,7 +4340,7 @@ var ts;
var lineStartsOfS = ts.computeLineStarts(s);
if (lineStartsOfS.length > 1) {
lineCount = lineCount + lineStartsOfS.length - 1;
linePos = output.length - s.length + lineStartsOfS[lineStartsOfS.length - 1];
linePos = output.length - s.length + ts.lastOrUndefined(lineStartsOfS);
}
}
}
@@ -4405,8 +4409,8 @@ var ts;
ts.getFirstConstructorWithBody = getFirstConstructorWithBody;
function shouldEmitToOwnFile(sourceFile, compilerOptions) {
if (!isDeclarationFile(sourceFile)) {
if ((isExternalModule(sourceFile) || !compilerOptions.out) && !ts.fileExtensionIs(sourceFile.fileName, ".js")) {
return true;
if ((isExternalModule(sourceFile) || !compilerOptions.out)) {
return compilerOptions.separateCompilation || !ts.fileExtensionIs(sourceFile.fileName, ".js");
}
return false;
}
@@ -5981,7 +5985,7 @@ var ts;
templateSpans.pos = getNodePos();
do {
templateSpans.push(parseTemplateSpan());
} while (templateSpans[templateSpans.length - 1].literal.kind === 12);
} while (ts.lastOrUndefined(templateSpans).literal.kind === 12);
templateSpans.end = getNodeEnd();
template.templateSpans = templateSpans;
return finishNode(template);
@@ -8580,7 +8584,6 @@ var ts;
var undefinedType = createIntrinsicType(32 | 262144, "undefined");
var nullType = createIntrinsicType(64 | 262144, "null");
var unknownType = createIntrinsicType(1, "unknown");
var resolvingType = createIntrinsicType(1, "__resolving__");
var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
@@ -8610,6 +8613,8 @@ var ts;
var emitExtends = false;
var emitDecorate = false;
var emitParam = false;
var resolutionTargets = [];
var resolutionResults = [];
var mergedSymbols = [];
var symbolLinks = [];
var nodeLinks = [];
@@ -8829,9 +8834,9 @@ var ts;
}
else if (location.kind === 228 ||
(location.kind === 206 && location.name.kind === 8)) {
result = getSymbol(getSymbolOfNode(location).exports, "default", meaning & 8914931);
result = getSymbolOfNode(location).exports["default"];
var localSymbol = ts.getLocalSymbolForExportDefault(result);
if (result && (result.flags & meaning) && localSymbol && localSymbol.name === name) {
if (result && localSymbol && (result.flags & meaning) && localSymbol.name === name) {
break loop;
}
result = undefined;
@@ -9160,7 +9165,8 @@ var ts;
}
var symbol;
if (name.kind === 65) {
symbol = resolveName(name, name.text, meaning, ts.Diagnostics.Cannot_find_name_0, name);
var message = meaning === 1536 ? ts.Diagnostics.Cannot_find_namespace_0 : ts.Diagnostics.Cannot_find_name_0;
symbol = resolveName(name, name.text, meaning, message, name);
if (!symbol) {
return undefined;
}
@@ -10131,6 +10137,26 @@ var ts;
});
}
}
function pushTypeResolution(target) {
var i = 0;
var count = resolutionTargets.length;
while (i < count && resolutionTargets[i] !== target) {
i++;
}
if (i < count) {
do {
resolutionResults[i++] = false;
} while (i < count);
return false;
}
resolutionTargets.push(target);
resolutionResults.push(true);
return true;
}
function popTypeResolution() {
resolutionTargets.pop();
return resolutionResults.pop();
}
function getRootDeclaration(node) {
while (node.kind === 153) {
node = node.parent.parent;
@@ -10308,20 +10334,23 @@ var ts;
if (declaration.kind === 215) {
return links.type = checkExpression(declaration.expression);
}
links.type = resolvingType;
if (!pushTypeResolution(symbol)) {
return unknownType;
}
var type = getWidenedTypeForVariableLikeDeclaration(declaration, true);
if (links.type === resolvingType) {
links.type = type;
}
}
else if (links.type === resolvingType) {
links.type = anyType;
if (compilerOptions.noImplicitAny) {
var diagnostic = symbol.valueDeclaration.type ?
ts.Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation :
ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer;
error(symbol.valueDeclaration, diagnostic, symbolToString(symbol));
if (!popTypeResolution()) {
if (symbol.valueDeclaration.type) {
type = unknownType;
error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));
}
else {
type = anyType;
if (compilerOptions.noImplicitAny) {
error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol));
}
}
}
links.type = type;
}
return links.type;
}
@@ -10342,13 +10371,10 @@ var ts;
}
function getTypeOfAccessors(symbol) {
var links = getSymbolLinks(symbol);
checkAndStoreTypeOfAccessors(symbol, links);
return links.type;
}
function checkAndStoreTypeOfAccessors(symbol, links) {
links = links || getSymbolLinks(symbol);
if (!links.type) {
links.type = resolvingType;
if (!pushTypeResolution(symbol)) {
return unknownType;
}
var getter = ts.getDeclarationOfKind(symbol, 137);
var setter = ts.getDeclarationOfKind(symbol, 138);
var type;
@@ -10373,17 +10399,16 @@ var ts;
}
}
}
if (links.type === resolvingType) {
links.type = type;
}
}
else if (links.type === resolvingType) {
links.type = anyType;
if (compilerOptions.noImplicitAny) {
var getter = ts.getDeclarationOfKind(symbol, 137);
error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol));
if (!popTypeResolution()) {
type = anyType;
if (compilerOptions.noImplicitAny) {
var getter_1 = ts.getDeclarationOfKind(symbol, 137);
error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol));
}
}
links.type = type;
}
return links.type;
}
function getTypeOfFuncClassEnumModule(symbol) {
var links = getSymbolLinks(symbol);
@@ -10545,17 +10570,16 @@ var ts;
function getDeclaredTypeOfTypeAlias(symbol) {
var links = getSymbolLinks(symbol);
if (!links.declaredType) {
links.declaredType = resolvingType;
if (!pushTypeResolution(links)) {
return unknownType;
}
var declaration = ts.getDeclarationOfKind(symbol, 204);
var type = getTypeFromTypeNode(declaration.type);
if (links.declaredType === resolvingType) {
links.declaredType = type;
if (!popTypeResolution()) {
type = unknownType;
error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
}
}
else if (links.declaredType === resolvingType) {
links.declaredType = unknownType;
var declaration = ts.getDeclarationOfKind(symbol, 204);
error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
links.declaredType = type;
}
return links.declaredType;
}
@@ -11094,7 +11118,9 @@ var ts;
}
function getReturnTypeOfSignature(signature) {
if (!signature.resolvedReturnType) {
signature.resolvedReturnType = resolvingType;
if (!pushTypeResolution(signature)) {
return unknownType;
}
var type;
if (signature.target) {
type = instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper);
@@ -11105,27 +11131,25 @@ var ts;
else {
type = getReturnTypeFromBody(signature.declaration);
}
if (signature.resolvedReturnType === resolvingType) {
signature.resolvedReturnType = type;
}
}
else if (signature.resolvedReturnType === resolvingType) {
signature.resolvedReturnType = anyType;
if (compilerOptions.noImplicitAny) {
var declaration = signature.declaration;
if (declaration.name) {
error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name));
}
else {
error(declaration, ts.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions);
if (!popTypeResolution()) {
type = anyType;
if (compilerOptions.noImplicitAny) {
var declaration = signature.declaration;
if (declaration.name) {
error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name));
}
else {
error(declaration, ts.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions);
}
}
}
signature.resolvedReturnType = type;
}
return signature.resolvedReturnType;
}
function getRestTypeOfSignature(signature) {
if (signature.hasRestParameter) {
var type = getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]);
var type = getTypeOfSymbol(ts.lastOrUndefined(signature.parameters));
if (type.flags & 4096 && type.target === globalArrayType) {
return type.typeArguments[0];
}
@@ -12981,15 +13005,30 @@ var ts;
return type;
}
var prototypeProperty = getPropertyOfType(rightType, "prototype");
if (!prototypeProperty) {
return type;
if (prototypeProperty) {
var targetType = getTypeOfSymbol(prototypeProperty);
if (targetType !== anyType) {
if (isTypeSubtypeOf(targetType, type)) {
return targetType;
}
if (type.flags & 16384) {
return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); }));
}
}
}
var targetType = getTypeOfSymbol(prototypeProperty);
if (isTypeSubtypeOf(targetType, type)) {
return targetType;
var constructSignatures;
if (rightType.flags & 2048) {
constructSignatures = resolveDeclaredMembers(rightType).declaredConstructSignatures;
}
if (type.flags & 16384) {
return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); }));
else if (rightType.flags & 32768) {
constructSignatures = getSignaturesOfType(rightType, 1);
}
if (constructSignatures && constructSignatures.length !== 0) {
var instanceType = getUnionType(ts.map(constructSignatures, function (signature) { return getReturnTypeOfSignature(getErasedSignature(signature)); }));
if (type.flags & 16384) {
return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, instanceType); }));
}
return instanceType;
}
return type;
}
@@ -13219,7 +13258,7 @@ var ts;
}
if (indexOfParameter === (func.parameters.length - 1) &&
funcHasRestParameters && contextualSignature.hasRestParameter && func.parameters.length >= contextualSignature.parameters.length) {
return getTypeOfSymbol(contextualSignature.parameters[contextualSignature.parameters.length - 1]);
return getTypeOfSymbol(ts.lastOrUndefined(contextualSignature.parameters));
}
}
}
@@ -14279,9 +14318,9 @@ var ts;
links.type = instantiateType(getTypeAtPosition(context, i), mapper);
}
if (signature.hasRestParameter && context.hasRestParameter && signature.parameters.length >= context.parameters.length) {
var parameter = signature.parameters[signature.parameters.length - 1];
var parameter = ts.lastOrUndefined(signature.parameters);
var links = getSymbolLinks(parameter);
links.type = instantiateType(getTypeOfSymbol(context.parameters[context.parameters.length - 1]), mapper);
links.type = instantiateType(getTypeOfSymbol(ts.lastOrUndefined(context.parameters)), mapper);
}
}
function getReturnTypeFromBody(func, contextualMapper) {
@@ -14369,10 +14408,9 @@ var ts;
if (isContextSensitive(node)) {
assignContextualParameterTypes(signature, contextualSignature, contextualMapper || identityMapper);
}
if (!node.type) {
signature.resolvedReturnType = resolvingType;
if (!node.type && !signature.resolvedReturnType) {
var returnType = getReturnTypeFromBody(node, contextualMapper);
if (signature.resolvedReturnType === resolvingType) {
if (!signature.resolvedReturnType) {
signature.resolvedReturnType = returnType;
}
}
@@ -15153,7 +15191,7 @@ var ts;
}
}
}
checkAndStoreTypeOfAccessors(getSymbolOfNode(node));
getTypeOfAccessors(getSymbolOfNode(node));
}
checkFunctionLikeDeclaration(node);
}
@@ -18660,7 +18698,7 @@ var ts;
function checkGrammarBindingElement(node) {
if (node.dotDotDotToken) {
var elements = node.parent.elements;
if (node !== elements[elements.length - 1]) {
if (node !== ts.lastOrUndefined(elements)) {
return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern);
}
if (node.name.kind === 152 || node.name.kind === 151) {
@@ -20446,7 +20484,7 @@ var ts;
var sourceMapNameIndexMap = {};
var sourceMapNameIndices = [];
function getSourceMapNameIndex() {
return sourceMapNameIndices.length ? sourceMapNameIndices[sourceMapNameIndices.length - 1] : -1;
return sourceMapNameIndices.length ? ts.lastOrUndefined(sourceMapNameIndices) : -1;
}
var lastRecordedSourceMapSpan;
var lastEncodedSourceMapSpan = {
@@ -22922,11 +22960,11 @@ var ts;
emitNodeWithoutSourceMap(memberName);
}
}
function getInitializedProperties(node, static) {
function getInitializedProperties(node, isStatic) {
var properties = [];
for (var _a = 0, _b = node.members; _a < _b.length; _a++) {
var member = _b[_a];
if (member.kind === 133 && static === ((member.flags & 128) !== 0) && member.initializer) {
if (member.kind === 133 && isStatic === ((member.flags & 128) !== 0) && member.initializer) {
properties.push(member);
}
}
@@ -23237,15 +23275,6 @@ var ts;
scopeEmitEnd();
if (thisNodeIsDecorated) {
write(";");
if (node.name) {
writeLine();
write("Object.defineProperty(");
emitDeclarationName(node);
write(", \"name\", { value: \"");
emitDeclarationName(node);
write("\", configurable: true });");
writeLine();
}
}
if (isClassExpressionWithStaticProperties) {
for (var _a = 0; _a < staticProperties.length; _a++) {
@@ -24834,10 +24863,10 @@ var ts;
}
}
function hasDetachedComments(pos) {
return detachedCommentsInfo !== undefined && detachedCommentsInfo[detachedCommentsInfo.length - 1].nodePos === pos;
return detachedCommentsInfo !== undefined && ts.lastOrUndefined(detachedCommentsInfo).nodePos === pos;
}
function getLeadingCommentsWithoutDetachedComments() {
var leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, detachedCommentsInfo[detachedCommentsInfo.length - 1].detachedCommentEndPos);
var leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, ts.lastOrUndefined(detachedCommentsInfo).detachedCommentEndPos);
if (detachedCommentsInfo.length - 1) {
detachedCommentsInfo.pop();
}
@@ -24918,12 +24947,12 @@ var ts;
lastComment = comment;
});
if (detachedComments.length) {
var lastCommentLine = ts.getLineOfLocalPosition(currentSourceFile, detachedComments[detachedComments.length - 1].end);
var lastCommentLine = ts.getLineOfLocalPosition(currentSourceFile, ts.lastOrUndefined(detachedComments).end);
var nodeLine = ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.pos));
if (nodeLine >= lastCommentLine + 2) {
ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments);
ts.emitComments(currentSourceFile, writer, detachedComments, true, newLine, writeComment);
var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: detachedComments[detachedComments.length - 1].end };
var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: ts.lastOrUndefined(detachedComments).end };
if (detachedCommentsInfo) {
detachedCommentsInfo.push(currentDetachedCommentInfo);
}
@@ -24964,6 +24993,8 @@ var ts;
ts.ioReadTime = 0;
ts.ioWriteTime = 0;
ts.version = "1.5.0";
var carriageReturnLineFeed = "\r\n";
var lineFeed = "\n";
function findConfigFile(searchPath) {
var fileName = "tsconfig.json";
while (true) {
@@ -25034,6 +25065,9 @@ var ts;
}
}
}
var newLine = options.newLine === 0 ? carriageReturnLineFeed :
options.newLine === 1 ? lineFeed :
ts.sys.newLine;
return {
getSourceFile: getSourceFile,
getDefaultLibFileName: function (options) { return ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())), ts.getDefaultLibFileName(options)); },
@@ -25041,7 +25075,7 @@ var ts;
getCurrentDirectory: function () { return currentDirectory || (currentDirectory = ts.sys.getCurrentDirectory()); },
useCaseSensitiveFileNames: function () { return ts.sys.useCaseSensitiveFileNames; },
getCanonicalFileName: getCanonicalFileName,
getNewLine: function () { return ts.sys.newLine; }
getNewLine: function () { return newLine; }
};
}
ts.createCompilerHost = createCompilerHost;
@@ -25526,6 +25560,16 @@ var ts;
paramType: ts.Diagnostics.KIND,
error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_amd_system_or_umd
},
{
name: "newLine",
type: {
"crlf": 0,
"lf": 1
},
description: ts.Diagnostics.Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix,
paramType: ts.Diagnostics.NEWLINE,
error: ts.Diagnostics.Argument_for_newLine_option_must_be_CRLF_or_LF
},
{
name: "noEmit",
type: "boolean",
+262 -169
View File
@@ -444,7 +444,7 @@ var ts;
for (var _i = 0; _i < parts.length; _i++) {
var part = parts[_i];
if (part !== ".") {
if (part === ".." && normalized.length > 0 && normalized[normalized.length - 1] !== "..") {
if (part === ".." && normalized.length > 0 && lastOrUndefined(normalized) !== "..") {
normalized.pop();
}
else {
@@ -536,7 +536,7 @@ var ts;
function getRelativePathToDirectoryOrUrl(directoryPathOrUrl, relativeOrAbsolutePath, currentDirectory, getCanonicalFileName, isAbsolutePathAnUrl) {
var pathComponents = getNormalizedPathOrUrlComponents(relativeOrAbsolutePath, currentDirectory);
var directoryComponents = getNormalizedPathOrUrlComponents(directoryPathOrUrl, currentDirectory);
if (directoryComponents.length > 1 && directoryComponents[directoryComponents.length - 1] === "") {
if (directoryComponents.length > 1 && lastOrUndefined(directoryComponents) === "") {
directoryComponents.length--;
}
for (var joinStartIndex = 0; joinStartIndex < pathComponents.length && joinStartIndex < directoryComponents.length; joinStartIndex++) {
@@ -1277,6 +1277,8 @@ var ts;
An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2499, category: ts.DiagnosticCategory.Error, key: "An interface can only extend an identifier/qualified-name with optional type arguments." },
A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2500, category: ts.DiagnosticCategory.Error, key: "A class can only implement an identifier/qualified-name with optional type arguments." },
A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: ts.DiagnosticCategory.Error, key: "A rest element cannot contain a binding pattern." },
_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 2502, category: ts.DiagnosticCategory.Error, key: "'{0}' is referenced directly or indirectly in its own type annotation." },
Cannot_find_namespace_0: { code: 2503, category: ts.DiagnosticCategory.Error, key: "Cannot find namespace '{0}'." },
Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
@@ -1416,6 +1418,9 @@ var ts;
Preserve_new_lines_when_emitting_code: { code: 6057, category: ts.DiagnosticCategory.Message, key: "Preserve new-lines when emitting code." },
Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir: { code: 6058, category: ts.DiagnosticCategory.Message, key: "Specifies the root directory of input files. Use to control the output directory structure with --outDir." },
File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files: { code: 6059, category: ts.DiagnosticCategory.Error, key: "File '{0}' is not under 'rootDir' '{1}'. 'rootDir' is expected to contain all source files." },
Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { code: 6060, category: ts.DiagnosticCategory.Message, key: "Specifies the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)." },
NEWLINE: { code: 6061, category: ts.DiagnosticCategory.Message, key: "NEWLINE" },
Argument_for_newLine_option_must_be_CRLF_or_LF: { code: 6062, category: ts.DiagnosticCategory.Error, key: "Argument for '--newLine' option must be 'CRLF' or 'LF'." },
Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable '{0}' implicitly has an '{1}' type." },
Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter '{0}' implicitly has an '{1}' type." },
Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member '{0}' implicitly has an '{1}' type." },
@@ -1428,7 +1433,6 @@ var ts;
Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: ts.DiagnosticCategory.Error, key: "Object literal's property '{0}' implicitly has an '{1}' type." },
Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: ts.DiagnosticCategory.Error, key: "Rest parameter '{0}' implicitly has an 'any[]' type." },
Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: ts.DiagnosticCategory.Error, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." },
_0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 7021, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." },
_0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." },
_0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." },
Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: ts.DiagnosticCategory.Error, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." },
@@ -1844,7 +1848,7 @@ var ts;
}
collecting = true;
if (result && result.length) {
result[result.length - 1].hasTrailingNewLine = true;
ts.lastOrUndefined(result).hasTrailingNewLine = true;
}
continue;
case 9:
@@ -1890,7 +1894,7 @@ var ts;
default:
if (ch > 127 && (isWhiteSpace(ch) || isLineBreak(ch))) {
if (result && result.length && isLineBreak(ch)) {
result[result.length - 1].hasTrailingNewLine = true;
ts.lastOrUndefined(result).hasTrailingNewLine = true;
}
pos++;
continue;
@@ -2770,6 +2774,16 @@ var ts;
paramType: ts.Diagnostics.KIND,
error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_amd_system_or_umd
},
{
name: "newLine",
type: {
"crlf": 0,
"lf": 1
},
description: ts.Diagnostics.Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix,
paramType: ts.Diagnostics.NEWLINE,
error: ts.Diagnostics.Argument_for_newLine_option_must_be_CRLF_or_LF
},
{
name: "noEmit",
type: "boolean",
@@ -3769,7 +3783,7 @@ var ts;
}
ts.hasQuestionToken = hasQuestionToken;
function hasRestParameters(s) {
return s.parameters.length > 0 && s.parameters[s.parameters.length - 1].dotDotDotToken !== undefined;
return s.parameters.length > 0 && ts.lastOrUndefined(s.parameters).dotDotDotToken !== undefined;
}
ts.hasRestParameters = hasRestParameters;
function isLiteralKind(kind) {
@@ -4197,7 +4211,7 @@ var ts;
var lineStartsOfS = ts.computeLineStarts(s);
if (lineStartsOfS.length > 1) {
lineCount = lineCount + lineStartsOfS.length - 1;
linePos = output.length - s.length + lineStartsOfS[lineStartsOfS.length - 1];
linePos = output.length - s.length + ts.lastOrUndefined(lineStartsOfS);
}
}
}
@@ -4266,8 +4280,8 @@ var ts;
ts.getFirstConstructorWithBody = getFirstConstructorWithBody;
function shouldEmitToOwnFile(sourceFile, compilerOptions) {
if (!isDeclarationFile(sourceFile)) {
if ((isExternalModule(sourceFile) || !compilerOptions.out) && !ts.fileExtensionIs(sourceFile.fileName, ".js")) {
return true;
if ((isExternalModule(sourceFile) || !compilerOptions.out)) {
return compilerOptions.separateCompilation || !ts.fileExtensionIs(sourceFile.fileName, ".js");
}
return false;
}
@@ -5842,7 +5856,7 @@ var ts;
templateSpans.pos = getNodePos();
do {
templateSpans.push(parseTemplateSpan());
} while (templateSpans[templateSpans.length - 1].literal.kind === 12);
} while (ts.lastOrUndefined(templateSpans).literal.kind === 12);
templateSpans.end = getNodeEnd();
template.templateSpans = templateSpans;
return finishNode(template);
@@ -8954,7 +8968,6 @@ var ts;
var undefinedType = createIntrinsicType(32 | 262144, "undefined");
var nullType = createIntrinsicType(64 | 262144, "null");
var unknownType = createIntrinsicType(1, "unknown");
var resolvingType = createIntrinsicType(1, "__resolving__");
var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
@@ -8984,6 +8997,8 @@ var ts;
var emitExtends = false;
var emitDecorate = false;
var emitParam = false;
var resolutionTargets = [];
var resolutionResults = [];
var mergedSymbols = [];
var symbolLinks = [];
var nodeLinks = [];
@@ -9203,9 +9218,9 @@ var ts;
}
else if (location.kind === 228 ||
(location.kind === 206 && location.name.kind === 8)) {
result = getSymbol(getSymbolOfNode(location).exports, "default", meaning & 8914931);
result = getSymbolOfNode(location).exports["default"];
var localSymbol = ts.getLocalSymbolForExportDefault(result);
if (result && (result.flags & meaning) && localSymbol && localSymbol.name === name) {
if (result && localSymbol && (result.flags & meaning) && localSymbol.name === name) {
break loop;
}
result = undefined;
@@ -9534,7 +9549,8 @@ var ts;
}
var symbol;
if (name.kind === 65) {
symbol = resolveName(name, name.text, meaning, ts.Diagnostics.Cannot_find_name_0, name);
var message = meaning === 1536 ? ts.Diagnostics.Cannot_find_namespace_0 : ts.Diagnostics.Cannot_find_name_0;
symbol = resolveName(name, name.text, meaning, message, name);
if (!symbol) {
return undefined;
}
@@ -10505,6 +10521,26 @@ var ts;
});
}
}
function pushTypeResolution(target) {
var i = 0;
var count = resolutionTargets.length;
while (i < count && resolutionTargets[i] !== target) {
i++;
}
if (i < count) {
do {
resolutionResults[i++] = false;
} while (i < count);
return false;
}
resolutionTargets.push(target);
resolutionResults.push(true);
return true;
}
function popTypeResolution() {
resolutionTargets.pop();
return resolutionResults.pop();
}
function getRootDeclaration(node) {
while (node.kind === 153) {
node = node.parent.parent;
@@ -10682,20 +10718,23 @@ var ts;
if (declaration.kind === 215) {
return links.type = checkExpression(declaration.expression);
}
links.type = resolvingType;
if (!pushTypeResolution(symbol)) {
return unknownType;
}
var type = getWidenedTypeForVariableLikeDeclaration(declaration, true);
if (links.type === resolvingType) {
links.type = type;
}
}
else if (links.type === resolvingType) {
links.type = anyType;
if (compilerOptions.noImplicitAny) {
var diagnostic = symbol.valueDeclaration.type ?
ts.Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation :
ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer;
error(symbol.valueDeclaration, diagnostic, symbolToString(symbol));
if (!popTypeResolution()) {
if (symbol.valueDeclaration.type) {
type = unknownType;
error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));
}
else {
type = anyType;
if (compilerOptions.noImplicitAny) {
error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol));
}
}
}
links.type = type;
}
return links.type;
}
@@ -10716,13 +10755,10 @@ var ts;
}
function getTypeOfAccessors(symbol) {
var links = getSymbolLinks(symbol);
checkAndStoreTypeOfAccessors(symbol, links);
return links.type;
}
function checkAndStoreTypeOfAccessors(symbol, links) {
links = links || getSymbolLinks(symbol);
if (!links.type) {
links.type = resolvingType;
if (!pushTypeResolution(symbol)) {
return unknownType;
}
var getter = ts.getDeclarationOfKind(symbol, 137);
var setter = ts.getDeclarationOfKind(symbol, 138);
var type;
@@ -10747,17 +10783,16 @@ var ts;
}
}
}
if (links.type === resolvingType) {
links.type = type;
}
}
else if (links.type === resolvingType) {
links.type = anyType;
if (compilerOptions.noImplicitAny) {
var getter = ts.getDeclarationOfKind(symbol, 137);
error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol));
if (!popTypeResolution()) {
type = anyType;
if (compilerOptions.noImplicitAny) {
var getter_1 = ts.getDeclarationOfKind(symbol, 137);
error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol));
}
}
links.type = type;
}
return links.type;
}
function getTypeOfFuncClassEnumModule(symbol) {
var links = getSymbolLinks(symbol);
@@ -10919,17 +10954,16 @@ var ts;
function getDeclaredTypeOfTypeAlias(symbol) {
var links = getSymbolLinks(symbol);
if (!links.declaredType) {
links.declaredType = resolvingType;
if (!pushTypeResolution(links)) {
return unknownType;
}
var declaration = ts.getDeclarationOfKind(symbol, 204);
var type = getTypeFromTypeNode(declaration.type);
if (links.declaredType === resolvingType) {
links.declaredType = type;
if (!popTypeResolution()) {
type = unknownType;
error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
}
}
else if (links.declaredType === resolvingType) {
links.declaredType = unknownType;
var declaration = ts.getDeclarationOfKind(symbol, 204);
error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
links.declaredType = type;
}
return links.declaredType;
}
@@ -11468,7 +11502,9 @@ var ts;
}
function getReturnTypeOfSignature(signature) {
if (!signature.resolvedReturnType) {
signature.resolvedReturnType = resolvingType;
if (!pushTypeResolution(signature)) {
return unknownType;
}
var type;
if (signature.target) {
type = instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper);
@@ -11479,27 +11515,25 @@ var ts;
else {
type = getReturnTypeFromBody(signature.declaration);
}
if (signature.resolvedReturnType === resolvingType) {
signature.resolvedReturnType = type;
}
}
else if (signature.resolvedReturnType === resolvingType) {
signature.resolvedReturnType = anyType;
if (compilerOptions.noImplicitAny) {
var declaration = signature.declaration;
if (declaration.name) {
error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name));
}
else {
error(declaration, ts.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions);
if (!popTypeResolution()) {
type = anyType;
if (compilerOptions.noImplicitAny) {
var declaration = signature.declaration;
if (declaration.name) {
error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name));
}
else {
error(declaration, ts.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions);
}
}
}
signature.resolvedReturnType = type;
}
return signature.resolvedReturnType;
}
function getRestTypeOfSignature(signature) {
if (signature.hasRestParameter) {
var type = getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]);
var type = getTypeOfSymbol(ts.lastOrUndefined(signature.parameters));
if (type.flags & 4096 && type.target === globalArrayType) {
return type.typeArguments[0];
}
@@ -13355,15 +13389,30 @@ var ts;
return type;
}
var prototypeProperty = getPropertyOfType(rightType, "prototype");
if (!prototypeProperty) {
return type;
if (prototypeProperty) {
var targetType = getTypeOfSymbol(prototypeProperty);
if (targetType !== anyType) {
if (isTypeSubtypeOf(targetType, type)) {
return targetType;
}
if (type.flags & 16384) {
return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); }));
}
}
}
var targetType = getTypeOfSymbol(prototypeProperty);
if (isTypeSubtypeOf(targetType, type)) {
return targetType;
var constructSignatures;
if (rightType.flags & 2048) {
constructSignatures = resolveDeclaredMembers(rightType).declaredConstructSignatures;
}
if (type.flags & 16384) {
return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); }));
else if (rightType.flags & 32768) {
constructSignatures = getSignaturesOfType(rightType, 1);
}
if (constructSignatures && constructSignatures.length !== 0) {
var instanceType = getUnionType(ts.map(constructSignatures, function (signature) { return getReturnTypeOfSignature(getErasedSignature(signature)); }));
if (type.flags & 16384) {
return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, instanceType); }));
}
return instanceType;
}
return type;
}
@@ -13593,7 +13642,7 @@ var ts;
}
if (indexOfParameter === (func.parameters.length - 1) &&
funcHasRestParameters && contextualSignature.hasRestParameter && func.parameters.length >= contextualSignature.parameters.length) {
return getTypeOfSymbol(contextualSignature.parameters[contextualSignature.parameters.length - 1]);
return getTypeOfSymbol(ts.lastOrUndefined(contextualSignature.parameters));
}
}
}
@@ -14653,9 +14702,9 @@ var ts;
links.type = instantiateType(getTypeAtPosition(context, i), mapper);
}
if (signature.hasRestParameter && context.hasRestParameter && signature.parameters.length >= context.parameters.length) {
var parameter = signature.parameters[signature.parameters.length - 1];
var parameter = ts.lastOrUndefined(signature.parameters);
var links = getSymbolLinks(parameter);
links.type = instantiateType(getTypeOfSymbol(context.parameters[context.parameters.length - 1]), mapper);
links.type = instantiateType(getTypeOfSymbol(ts.lastOrUndefined(context.parameters)), mapper);
}
}
function getReturnTypeFromBody(func, contextualMapper) {
@@ -14743,10 +14792,9 @@ var ts;
if (isContextSensitive(node)) {
assignContextualParameterTypes(signature, contextualSignature, contextualMapper || identityMapper);
}
if (!node.type) {
signature.resolvedReturnType = resolvingType;
if (!node.type && !signature.resolvedReturnType) {
var returnType = getReturnTypeFromBody(node, contextualMapper);
if (signature.resolvedReturnType === resolvingType) {
if (!signature.resolvedReturnType) {
signature.resolvedReturnType = returnType;
}
}
@@ -15527,7 +15575,7 @@ var ts;
}
}
}
checkAndStoreTypeOfAccessors(getSymbolOfNode(node));
getTypeOfAccessors(getSymbolOfNode(node));
}
checkFunctionLikeDeclaration(node);
}
@@ -19034,7 +19082,7 @@ var ts;
function checkGrammarBindingElement(node) {
if (node.dotDotDotToken) {
var elements = node.parent.elements;
if (node !== elements[elements.length - 1]) {
if (node !== ts.lastOrUndefined(elements)) {
return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern);
}
if (node.name.kind === 152 || node.name.kind === 151) {
@@ -20820,7 +20868,7 @@ var ts;
var sourceMapNameIndexMap = {};
var sourceMapNameIndices = [];
function getSourceMapNameIndex() {
return sourceMapNameIndices.length ? sourceMapNameIndices[sourceMapNameIndices.length - 1] : -1;
return sourceMapNameIndices.length ? ts.lastOrUndefined(sourceMapNameIndices) : -1;
}
var lastRecordedSourceMapSpan;
var lastEncodedSourceMapSpan = {
@@ -23296,11 +23344,11 @@ var ts;
emitNodeWithoutSourceMap(memberName);
}
}
function getInitializedProperties(node, static) {
function getInitializedProperties(node, isStatic) {
var properties = [];
for (var _a = 0, _b = node.members; _a < _b.length; _a++) {
var member = _b[_a];
if (member.kind === 133 && static === ((member.flags & 128) !== 0) && member.initializer) {
if (member.kind === 133 && isStatic === ((member.flags & 128) !== 0) && member.initializer) {
properties.push(member);
}
}
@@ -23611,15 +23659,6 @@ var ts;
scopeEmitEnd();
if (thisNodeIsDecorated) {
write(";");
if (node.name) {
writeLine();
write("Object.defineProperty(");
emitDeclarationName(node);
write(", \"name\", { value: \"");
emitDeclarationName(node);
write("\", configurable: true });");
writeLine();
}
}
if (isClassExpressionWithStaticProperties) {
for (var _a = 0; _a < staticProperties.length; _a++) {
@@ -25208,10 +25247,10 @@ var ts;
}
}
function hasDetachedComments(pos) {
return detachedCommentsInfo !== undefined && detachedCommentsInfo[detachedCommentsInfo.length - 1].nodePos === pos;
return detachedCommentsInfo !== undefined && ts.lastOrUndefined(detachedCommentsInfo).nodePos === pos;
}
function getLeadingCommentsWithoutDetachedComments() {
var leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, detachedCommentsInfo[detachedCommentsInfo.length - 1].detachedCommentEndPos);
var leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, ts.lastOrUndefined(detachedCommentsInfo).detachedCommentEndPos);
if (detachedCommentsInfo.length - 1) {
detachedCommentsInfo.pop();
}
@@ -25292,12 +25331,12 @@ var ts;
lastComment = comment;
});
if (detachedComments.length) {
var lastCommentLine = ts.getLineOfLocalPosition(currentSourceFile, detachedComments[detachedComments.length - 1].end);
var lastCommentLine = ts.getLineOfLocalPosition(currentSourceFile, ts.lastOrUndefined(detachedComments).end);
var nodeLine = ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.pos));
if (nodeLine >= lastCommentLine + 2) {
ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments);
ts.emitComments(currentSourceFile, writer, detachedComments, true, newLine, writeComment);
var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: detachedComments[detachedComments.length - 1].end };
var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: ts.lastOrUndefined(detachedComments).end };
if (detachedCommentsInfo) {
detachedCommentsInfo.push(currentDetachedCommentInfo);
}
@@ -25338,6 +25377,8 @@ var ts;
ts.ioReadTime = 0;
ts.ioWriteTime = 0;
ts.version = "1.5.0";
var carriageReturnLineFeed = "\r\n";
var lineFeed = "\n";
function findConfigFile(searchPath) {
var fileName = "tsconfig.json";
while (true) {
@@ -25408,6 +25449,9 @@ var ts;
}
}
}
var newLine = options.newLine === 0 ? carriageReturnLineFeed :
options.newLine === 1 ? lineFeed :
ts.sys.newLine;
return {
getSourceFile: getSourceFile,
getDefaultLibFileName: function (options) { return ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())), ts.getDefaultLibFileName(options)); },
@@ -25415,7 +25459,7 @@ var ts;
getCurrentDirectory: function () { return currentDirectory || (currentDirectory = ts.sys.getCurrentDirectory()); },
useCaseSensitiveFileNames: function () { return ts.sys.useCaseSensitiveFileNames; },
getCanonicalFileName: getCanonicalFileName,
getNewLine: function () { return ts.sys.newLine; }
getNewLine: function () { return newLine; }
};
}
ts.createCompilerHost = createCompilerHost;
@@ -26136,13 +26180,13 @@ var ts;
return textSpan(node);
}
case 224:
return spanInNode(node.parent.statements[node.parent.statements.length - 1]);
return spanInNode(ts.lastOrUndefined(node.parent.statements));
;
case 208:
var caseBlock = node.parent;
var lastClause = caseBlock.clauses[caseBlock.clauses.length - 1];
var lastClause = ts.lastOrUndefined(caseBlock.clauses);
if (lastClause) {
return spanInNode(lastClause.statements[lastClause.statements.length - 1]);
return spanInNode(ts.lastOrUndefined(lastClause.statements));
}
return undefined;
default:
@@ -27786,7 +27830,7 @@ var ts;
function nodeEndsWith(n, expectedLastToken, sourceFile) {
var children = n.getChildren(sourceFile);
if (children.length) {
var last = children[children.length - 1];
var last = ts.lastOrUndefined(children);
if (last.kind === expectedLastToken) {
return true;
}
@@ -28226,7 +28270,7 @@ var ts;
if (isStarted) {
if (trailingTrivia) {
ts.Debug.assert(trailingTrivia.length !== 0);
wasNewLine = trailingTrivia[trailingTrivia.length - 1].kind === 4;
wasNewLine = ts.lastOrUndefined(trailingTrivia).kind === 4;
}
else {
wasNewLine = false;
@@ -29468,6 +29512,8 @@ var ts;
var previousRange;
var previousParent;
var previousRangeStartLine;
var lastIndentedLine;
var indentationOnLastIndentedLine;
var edits = [];
formattingScanner.advance();
if (formattingScanner.isOnToken()) {
@@ -29522,7 +29568,9 @@ var ts;
}
var delta = formatting.SmartIndenter.shouldIndentChildNode(node.kind, 0) ? options.IndentSize : 0;
if (effectiveParentStartLine === startLine) {
indentation = parentDynamicIndentation.getIndentation();
indentation = startLine === lastIndentedLine
? indentationOnLastIndentedLine
: parentDynamicIndentation.getIndentation();
delta = Math.min(options.IndentSize, parentDynamicIndentation.getDelta() + delta);
}
return {
@@ -29732,7 +29780,6 @@ var ts;
if (!ts.rangeContainsRange(originalRange, triviaItem)) {
continue;
}
var triviaStartLine = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos).line;
switch (triviaItem.kind) {
case 3:
var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind);
@@ -29755,6 +29802,8 @@ var ts;
if (isTokenInRange && !rangeContainsError(currentTokenInfo.token)) {
var tokenIndentation = dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind);
insertIndentation(currentTokenInfo.token.pos, tokenIndentation, lineAdded);
lastIndentedLine = tokenStart.line;
indentationOnLastIndentedLine = tokenIndentation;
}
}
formattingScanner.advance();
@@ -32554,22 +32603,6 @@ var ts;
}
return ScriptElementKind.unknown;
}
function getTypeKind(type) {
var flags = type.getFlags();
if (flags & 128)
return ScriptElementKind.enumElement;
if (flags & 1024)
return ScriptElementKind.classElement;
if (flags & 2048)
return ScriptElementKind.interfaceElement;
if (flags & 512)
return ScriptElementKind.typeParameterElement;
if (flags & 1048703)
return ScriptElementKind.primitiveType;
if (flags & 256)
return ScriptElementKind.primitiveType;
return ScriptElementKind.unknown;
}
function getSymbolModifiers(symbol) {
return symbol && symbol.declarations && symbol.declarations.length > 0
? ts.getNodeModifiers(symbol.declarations[0])
@@ -32933,6 +32966,59 @@ var ts;
containerName: containerName
};
}
function getDefinitionFromSymbol(symbol, node) {
var typeChecker = program.getTypeChecker();
var result = [];
var declarations = symbol.getDeclarations();
var symbolName = typeChecker.symbolToString(symbol);
var symbolKind = getSymbolKind(symbol, node);
var containerSymbol = symbol.parent;
var containerName = containerSymbol ? typeChecker.symbolToString(containerSymbol, node) : "";
if (!tryAddConstructSignature(symbol, node, symbolKind, symbolName, containerName, result) &&
!tryAddCallSignature(symbol, node, symbolKind, symbolName, containerName, result)) {
ts.forEach(declarations, function (declaration) {
result.push(createDefinitionInfo(declaration, symbolKind, symbolName, containerName));
});
}
return result;
function tryAddConstructSignature(symbol, location, symbolKind, symbolName, containerName, result) {
if (isNewExpressionTarget(location) || location.kind === 114) {
if (symbol.flags & 32) {
var classDeclaration = symbol.getDeclarations()[0];
ts.Debug.assert(classDeclaration && classDeclaration.kind === 202);
return tryAddSignature(classDeclaration.members, true, symbolKind, symbolName, containerName, result);
}
}
return false;
}
function tryAddCallSignature(symbol, location, symbolKind, symbolName, containerName, result) {
if (isCallExpressionTarget(location) || isNewExpressionTarget(location) || isNameOfFunctionDeclaration(location)) {
return tryAddSignature(symbol.declarations, false, symbolKind, symbolName, containerName, result);
}
return false;
}
function tryAddSignature(signatureDeclarations, selectConstructors, symbolKind, symbolName, containerName, result) {
var declarations = [];
var definition;
ts.forEach(signatureDeclarations, function (d) {
if ((selectConstructors && d.kind === 136) ||
(!selectConstructors && (d.kind === 201 || d.kind === 135 || d.kind === 134))) {
declarations.push(d);
if (d.body)
definition = d;
}
});
if (definition) {
result.push(createDefinitionInfo(definition, symbolKind, symbolName, containerName));
return true;
}
else if (declarations.length) {
result.push(createDefinitionInfo(ts.lastOrUndefined(declarations), symbolKind, symbolName, containerName));
return true;
}
return false;
}
}
function getDefinitionAtPosition(fileName, position) {
synchronizeHostData();
var sourceFile = getValidSourceFile(fileName);
@@ -32982,56 +33068,37 @@ var ts;
var shorthandContainerName = typeChecker.symbolToString(symbol.parent, node);
return ts.map(shorthandDeclarations, function (declaration) { return createDefinitionInfo(declaration, shorthandSymbolKind, shorthandSymbolName, shorthandContainerName); });
}
var result = [];
var declarations = symbol.getDeclarations();
var symbolName = typeChecker.symbolToString(symbol);
var symbolKind = getSymbolKind(symbol, node);
var containerSymbol = symbol.parent;
var containerName = containerSymbol ? typeChecker.symbolToString(containerSymbol, node) : "";
if (!tryAddConstructSignature(symbol, node, symbolKind, symbolName, containerName, result) &&
!tryAddCallSignature(symbol, node, symbolKind, symbolName, containerName, result)) {
ts.forEach(declarations, function (declaration) {
result.push(createDefinitionInfo(declaration, symbolKind, symbolName, containerName));
});
return getDefinitionFromSymbol(symbol, node);
}
function getTypeDefinitionAtPosition(fileName, position) {
synchronizeHostData();
var sourceFile = getValidSourceFile(fileName);
var node = ts.getTouchingPropertyName(sourceFile, position);
if (!node) {
return undefined;
}
return result;
function tryAddConstructSignature(symbol, location, symbolKind, symbolName, containerName, result) {
if (isNewExpressionTarget(location) || location.kind === 114) {
if (symbol.flags & 32) {
var classDeclaration = symbol.getDeclarations()[0];
ts.Debug.assert(classDeclaration && classDeclaration.kind === 202);
return tryAddSignature(classDeclaration.members, true, symbolKind, symbolName, containerName, result);
}
}
return false;
var typeChecker = program.getTypeChecker();
var symbol = typeChecker.getSymbolAtLocation(node);
if (!symbol) {
return undefined;
}
function tryAddCallSignature(symbol, location, symbolKind, symbolName, containerName, result) {
if (isCallExpressionTarget(location) || isNewExpressionTarget(location) || isNameOfFunctionDeclaration(location)) {
return tryAddSignature(symbol.declarations, false, symbolKind, symbolName, containerName, result);
}
return false;
var type = typeChecker.getTypeOfSymbolAtLocation(symbol, node);
if (!type) {
return undefined;
}
function tryAddSignature(signatureDeclarations, selectConstructors, symbolKind, symbolName, containerName, result) {
var declarations = [];
var definition;
ts.forEach(signatureDeclarations, function (d) {
if ((selectConstructors && d.kind === 136) ||
(!selectConstructors && (d.kind === 201 || d.kind === 135 || d.kind === 134))) {
declarations.push(d);
if (d.body)
definition = d;
if (type.flags & 16384) {
var result = [];
ts.forEach(type.types, function (t) {
if (t.symbol) {
result.push.apply(result, getDefinitionFromSymbol(t.symbol, node));
}
});
if (definition) {
result.push(createDefinitionInfo(definition, symbolKind, symbolName, containerName));
return true;
}
else if (declarations.length) {
result.push(createDefinitionInfo(declarations[declarations.length - 1], symbolKind, symbolName, containerName));
return true;
}
return false;
return result;
}
if (!type.symbol) {
return undefined;
}
return getDefinitionFromSymbol(type.symbol, node);
}
function getOccurrencesAtPosition(fileName, position) {
var results = getOccurrencesAtPositionCore(fileName, position);
@@ -34797,6 +34864,7 @@ var ts;
getSignatureHelpItems: getSignatureHelpItems,
getQuickInfoAtPosition: getQuickInfoAtPosition,
getDefinitionAtPosition: getDefinitionAtPosition,
getTypeDefinitionAtPosition: getTypeDefinitionAtPosition,
getReferencesAtPosition: getReferencesAtPosition,
findReferences: findReferences,
getOccurrencesAtPosition: getOccurrencesAtPosition,
@@ -35300,6 +35368,7 @@ var ts;
CommandNames.Rename = "rename";
CommandNames.Saveto = "saveto";
CommandNames.SignatureHelp = "signatureHelp";
CommandNames.TypeDefinition = "typeDefinition";
CommandNames.Unknown = "unknown";
})(CommandNames = server.CommandNames || (server.CommandNames = {}));
var Errors;
@@ -35471,6 +35540,24 @@ var ts;
end: compilerService.host.positionToLineOffset(def.fileName, ts.textSpanEnd(def.textSpan))
}); });
};
Session.prototype.getTypeDefinition = function (line, offset, fileName) {
var file = ts.normalizePath(fileName);
var project = this.projectService.getProjectForFile(file);
if (!project) {
throw Errors.NoProject;
}
var compilerService = project.compilerService;
var position = compilerService.host.lineOffsetToPosition(file, line, offset);
var definitions = compilerService.languageService.getTypeDefinitionAtPosition(file, position);
if (!definitions) {
return undefined;
}
return definitions.map(function (def) { return ({
file: def.fileName,
start: compilerService.host.positionToLineOffset(def.fileName, def.textSpan.start),
end: compilerService.host.positionToLineOffset(def.fileName, ts.textSpanEnd(def.textSpan))
}); });
};
Session.prototype.getOccurrences = function (line, offset, fileName) {
fileName = ts.normalizePath(fileName);
var project = this.projectService.getProjectForFile(fileName);
@@ -35665,7 +35752,7 @@ var ts;
IndentSize: formatOptions.IndentSize,
TabSize: formatOptions.TabSize,
NewLineCharacter: "\n",
ConvertTabsToSpaces: true
ConvertTabsToSpaces: formatOptions.ConvertTabsToSpaces
};
var indentPosition = compilerService.languageService.getIndentationAtPosition(file, position, editorOptions);
for (var i = 0, len = lineText.length; i < len; i++) {
@@ -35927,6 +36014,11 @@ var ts;
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);
@@ -36654,6 +36746,7 @@ var ts;
if (content !== undefined) {
var indentSize;
info = new ScriptInfo(this.host, fileName, content, openedByClient);
info.setFormatOptions(this.getFormatCodeOptions());
this.filenameToScriptInfo[fileName] = info;
if (!info.isOpen) {
info.fileWatcher = this.host.watchFile(fileName, function (_) { _this.watchedFileChanged(fileName); });
@@ -36670,7 +36763,7 @@ var ts;
ProjectService.prototype.findConfigFile = function (searchPath) {
while (true) {
var fileName = ts.combinePaths(searchPath, "tsconfig.json");
if (ts.sys.fileExists(fileName)) {
if (this.host.fileExists(fileName)) {
return fileName;
}
var parentPath = ts.getDirectoryPath(searchPath);
@@ -36787,11 +36880,11 @@ var ts;
configFilename = ts.normalizePath(configFilename);
var dirPath = ts.getDirectoryPath(configFilename);
var rawConfig = ts.readConfigFile(configFilename);
if (!rawConfig) {
return { errorMsg: "tsconfig syntax error" };
if (rawConfig.error) {
return rawConfig.error;
}
else {
var parsedCommandLine = ts.parseConfigFile(rawConfig, ts.sys, dirPath);
var parsedCommandLine = ts.parseConfigFile(rawConfig.config, ts.sys, dirPath);
if (parsedCommandLine.errors && (parsedCommandLine.errors.length > 0)) {
return { errorMsg: "tsconfig option errors" };
}
@@ -36803,7 +36896,7 @@ var ts;
var proj = this.createProject(configFilename, projectOptions);
for (var i = 0, len = parsedCommandLine.fileNames.length; i < len; i++) {
var rootFilename = parsedCommandLine.fileNames[i];
if (ts.sys.fileExists(rootFilename)) {
if (this.host.fileExists(rootFilename)) {
var info = this.openFile(rootFilename, clientFileName == rootFilename);
proj.addRoot(info);
}
+34
View File
@@ -1094,6 +1094,7 @@ declare module "typescript" {
locale?: string;
mapRoot?: string;
module?: ModuleKind;
newLine?: NewLineKind;
noEmit?: boolean;
noEmitHelpers?: boolean;
noEmitOnError?: boolean;
@@ -1124,6 +1125,10 @@ declare module "typescript" {
UMD = 3,
System = 4,
}
const enum NewLineKind {
CarriageReturnLineFeed = 0,
LineFeed = 1,
}
interface LineAndCharacter {
line: number;
character: number;
@@ -1186,6 +1191,32 @@ declare module "typescript" {
var sys: System;
}
declare module "typescript" {
interface ErrorCallback {
(message: DiagnosticMessage, length: number): void;
}
interface Scanner {
getStartPos(): number;
getToken(): SyntaxKind;
getTextPos(): number;
getTokenPos(): number;
getTokenText(): string;
getTokenValue(): string;
hasExtendedUnicodeEscape(): boolean;
hasPrecedingLineBreak(): boolean;
isIdentifier(): boolean;
isReservedWord(): boolean;
isUnterminated(): boolean;
reScanGreaterToken(): SyntaxKind;
reScanSlashToken(): SyntaxKind;
reScanTemplateToken(): SyntaxKind;
scan(): SyntaxKind;
setText(text: string, start?: number, length?: number): void;
setOnError(onError: ErrorCallback): void;
setScriptTarget(scriptTarget: ScriptTarget): void;
setTextPos(textPos: number): void;
lookAhead<T>(callback: () => T): T;
tryScan<T>(callback: () => T): T;
}
function tokenToString(t: SyntaxKind): string;
function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number;
function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter;
@@ -1195,6 +1226,8 @@ declare module "typescript" {
function getTrailingCommentRanges(text: string, pos: number): CommentRange[];
function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean;
function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean;
/** Creates a scanner over a (possibly unspecified) range of a piece of text. */
function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, text?: string, onError?: ErrorCallback, start?: number, length?: number): Scanner;
}
declare module "typescript" {
function getDefaultLibFileName(options: CompilerOptions): string;
@@ -1381,6 +1414,7 @@ declare module "typescript" {
getRenameInfo(fileName: string, position: number): RenameInfo;
findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[];
getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[];
getTypeDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[];
getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[];
findReferences(fileName: string, position: number): ReferencedSymbol[];
getDocumentHighlights(fileName: string, position: number, filesToSearch: string[]): DocumentHighlights[];
+274 -172
View File
@@ -547,6 +547,11 @@ var ts;
ModuleKind[ModuleKind["System"] = 4] = "System";
})(ts.ModuleKind || (ts.ModuleKind = {}));
var ModuleKind = ts.ModuleKind;
(function (NewLineKind) {
NewLineKind[NewLineKind["CarriageReturnLineFeed"] = 0] = "CarriageReturnLineFeed";
NewLineKind[NewLineKind["LineFeed"] = 1] = "LineFeed";
})(ts.NewLineKind || (ts.NewLineKind = {}));
var NewLineKind = ts.NewLineKind;
(function (ScriptTarget) {
ScriptTarget[ScriptTarget["ES3"] = 0] = "ES3";
ScriptTarget[ScriptTarget["ES5"] = 1] = "ES5";
@@ -1137,7 +1142,7 @@ var ts;
for (var _i = 0; _i < parts.length; _i++) {
var part = parts[_i];
if (part !== ".") {
if (part === ".." && normalized.length > 0 && normalized[normalized.length - 1] !== "..") {
if (part === ".." && normalized.length > 0 && lastOrUndefined(normalized) !== "..") {
normalized.pop();
}
else {
@@ -1244,7 +1249,7 @@ var ts;
function getRelativePathToDirectoryOrUrl(directoryPathOrUrl, relativeOrAbsolutePath, currentDirectory, getCanonicalFileName, isAbsolutePathAnUrl) {
var pathComponents = getNormalizedPathOrUrlComponents(relativeOrAbsolutePath, currentDirectory);
var directoryComponents = getNormalizedPathOrUrlComponents(directoryPathOrUrl, currentDirectory);
if (directoryComponents.length > 1 && directoryComponents[directoryComponents.length - 1] === "") {
if (directoryComponents.length > 1 && lastOrUndefined(directoryComponents) === "") {
// If the directory path given was of type test/cases/ then we really need components of directory to be only till its name
// that is ["test", "cases", ""] needs to be actually ["test", "cases"]
directoryComponents.length--;
@@ -2015,6 +2020,8 @@ var ts;
An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2499, category: ts.DiagnosticCategory.Error, key: "An interface can only extend an identifier/qualified-name with optional type arguments." },
A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2500, category: ts.DiagnosticCategory.Error, key: "A class can only implement an identifier/qualified-name with optional type arguments." },
A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: ts.DiagnosticCategory.Error, key: "A rest element cannot contain a binding pattern." },
_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 2502, category: ts.DiagnosticCategory.Error, key: "'{0}' is referenced directly or indirectly in its own type annotation." },
Cannot_find_namespace_0: { code: 2503, category: ts.DiagnosticCategory.Error, key: "Cannot find namespace '{0}'." },
Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
@@ -2154,6 +2161,9 @@ var ts;
Preserve_new_lines_when_emitting_code: { code: 6057, category: ts.DiagnosticCategory.Message, key: "Preserve new-lines when emitting code." },
Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir: { code: 6058, category: ts.DiagnosticCategory.Message, key: "Specifies the root directory of input files. Use to control the output directory structure with --outDir." },
File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files: { code: 6059, category: ts.DiagnosticCategory.Error, key: "File '{0}' is not under 'rootDir' '{1}'. 'rootDir' is expected to contain all source files." },
Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { code: 6060, category: ts.DiagnosticCategory.Message, key: "Specifies the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)." },
NEWLINE: { code: 6061, category: ts.DiagnosticCategory.Message, key: "NEWLINE" },
Argument_for_newLine_option_must_be_CRLF_or_LF: { code: 6062, category: ts.DiagnosticCategory.Error, key: "Argument for '--newLine' option must be 'CRLF' or 'LF'." },
Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable '{0}' implicitly has an '{1}' type." },
Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter '{0}' implicitly has an '{1}' type." },
Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member '{0}' implicitly has an '{1}' type." },
@@ -2166,7 +2176,6 @@ var ts;
Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: ts.DiagnosticCategory.Error, key: "Object literal's property '{0}' implicitly has an '{1}' type." },
Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: ts.DiagnosticCategory.Error, key: "Rest parameter '{0}' implicitly has an 'any[]' type." },
Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: ts.DiagnosticCategory.Error, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." },
_0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 7021, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." },
_0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." },
_0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." },
Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: ts.DiagnosticCategory.Error, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." },
@@ -2652,7 +2661,7 @@ var ts;
}
collecting = true;
if (result && result.length) {
result[result.length - 1].hasTrailingNewLine = true;
ts.lastOrUndefined(result).hasTrailingNewLine = true;
}
continue;
case 9 /* tab */:
@@ -2698,7 +2707,7 @@ var ts;
default:
if (ch > 127 /* maxAsciiCharacter */ && (isWhiteSpace(ch) || isLineBreak(ch))) {
if (result && result.length && isLineBreak(ch)) {
result[result.length - 1].hasTrailingNewLine = true;
ts.lastOrUndefined(result).hasTrailingNewLine = true;
}
pos++;
continue;
@@ -2728,8 +2737,7 @@ var ts;
ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierPart(ch, languageVersion);
}
ts.isIdentifierPart = isIdentifierPart;
// Creates a scanner over a (possibly unspecified) range of a piece of text.
/* @internal */
/** Creates a scanner over a (possibly unspecified) range of a piece of text. */
function createScanner(languageVersion, skipTrivia, text, onError, start, length) {
var pos; // Current position (end position of text of current token)
var end; // end of text
@@ -4924,7 +4932,7 @@ var ts;
}
ts.hasQuestionToken = hasQuestionToken;
function hasRestParameters(s) {
return s.parameters.length > 0 && s.parameters[s.parameters.length - 1].dotDotDotToken !== undefined;
return s.parameters.length > 0 && ts.lastOrUndefined(s.parameters).dotDotDotToken !== undefined;
}
ts.hasRestParameters = hasRestParameters;
function isLiteralKind(kind) {
@@ -5388,7 +5396,7 @@ var ts;
var lineStartsOfS = ts.computeLineStarts(s);
if (lineStartsOfS.length > 1) {
lineCount = lineCount + lineStartsOfS.length - 1;
linePos = output.length - s.length + lineStartsOfS[lineStartsOfS.length - 1];
linePos = output.length - s.length + ts.lastOrUndefined(lineStartsOfS);
}
}
}
@@ -5457,8 +5465,10 @@ var ts;
ts.getFirstConstructorWithBody = getFirstConstructorWithBody;
function shouldEmitToOwnFile(sourceFile, compilerOptions) {
if (!isDeclarationFile(sourceFile)) {
if ((isExternalModule(sourceFile) || !compilerOptions.out) && !ts.fileExtensionIs(sourceFile.fileName, ".js")) {
return true;
if ((isExternalModule(sourceFile) || !compilerOptions.out)) {
// 1. in-browser single file compilation scenario
// 2. non .js file
return compilerOptions.separateCompilation || !ts.fileExtensionIs(sourceFile.fileName, ".js");
}
return false;
}
@@ -7465,7 +7475,7 @@ var ts;
templateSpans.pos = getNodePos();
do {
templateSpans.push(parseTemplateSpan());
} while (templateSpans[templateSpans.length - 1].literal.kind === 12 /* TemplateMiddle */);
} while (ts.lastOrUndefined(templateSpans).literal.kind === 12 /* TemplateMiddle */);
templateSpans.end = getNodeEnd();
template.templateSpans = templateSpans;
return finishNode(template);
@@ -10795,7 +10805,6 @@ var ts;
var undefinedType = createIntrinsicType(32 /* Undefined */ | 262144 /* ContainsUndefinedOrNull */, "undefined");
var nullType = createIntrinsicType(64 /* Null */ | 262144 /* ContainsUndefinedOrNull */, "null");
var unknownType = createIntrinsicType(1 /* Any */, "unknown");
var resolvingType = createIntrinsicType(1 /* Any */, "__resolving__");
var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
@@ -10825,6 +10834,8 @@ var ts;
var emitExtends = false;
var emitDecorate = false;
var emitParam = false;
var resolutionTargets = [];
var resolutionResults = [];
var mergedSymbols = [];
var symbolLinks = [];
var nodeLinks = [];
@@ -11054,9 +11065,9 @@ var ts;
}
else if (location.kind === 228 /* SourceFile */ ||
(location.kind === 206 /* ModuleDeclaration */ && location.name.kind === 8 /* StringLiteral */)) {
result = getSymbol(getSymbolOfNode(location).exports, "default", meaning & 8914931 /* ModuleMember */);
result = getSymbolOfNode(location).exports["default"];
var localSymbol = ts.getLocalSymbolForExportDefault(result);
if (result && (result.flags & meaning) && localSymbol && localSymbol.name === name) {
if (result && localSymbol && (result.flags & meaning) && localSymbol.name === name) {
break loop;
}
result = undefined;
@@ -11472,7 +11483,8 @@ var ts;
}
var symbol;
if (name.kind === 65 /* Identifier */) {
symbol = resolveName(name, name.text, meaning, ts.Diagnostics.Cannot_find_name_0, name);
var message = meaning === 1536 /* Namespace */ ? ts.Diagnostics.Cannot_find_namespace_0 : ts.Diagnostics.Cannot_find_name_0;
symbol = resolveName(name, name.text, meaning, message, name);
if (!symbol) {
return undefined;
}
@@ -12564,6 +12576,35 @@ var 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) {
var i = 0;
var count = resolutionTargets.length;
while (i < count && resolutionTargets[i] !== target) {
i++;
}
if (i < count) {
do {
resolutionResults[i++] = false;
} while (i < count);
return false;
}
resolutionTargets.push(target);
resolutionResults.push(true);
return true;
}
// 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() {
resolutionTargets.pop();
return resolutionResults.pop();
}
function getRootDeclaration(node) {
while (node.kind === 153 /* BindingElement */) {
node = node.parent.parent;
@@ -12806,20 +12847,25 @@ var ts;
return links.type = checkExpression(declaration.expression);
}
// Handle variable, parameter or property
links.type = resolvingType;
if (!pushTypeResolution(symbol)) {
return unknownType;
}
var type = getWidenedTypeForVariableLikeDeclaration(declaration, true);
if (links.type === resolvingType) {
links.type = type;
}
}
else if (links.type === resolvingType) {
links.type = anyType;
if (compilerOptions.noImplicitAny) {
var diagnostic = symbol.valueDeclaration.type ?
ts.Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation :
ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer;
error(symbol.valueDeclaration, diagnostic, symbolToString(symbol));
if (!popTypeResolution()) {
if (symbol.valueDeclaration.type) {
// Variable has type annotation that circularly references the variable itself
type = unknownType;
error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));
}
else {
// Variable has initializer that circularly references the variable itself
type = anyType;
if (compilerOptions.noImplicitAny) {
error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol));
}
}
}
links.type = type;
}
return links.type;
}
@@ -12840,13 +12886,10 @@ var ts;
}
function getTypeOfAccessors(symbol) {
var links = getSymbolLinks(symbol);
checkAndStoreTypeOfAccessors(symbol, links);
return links.type;
}
function checkAndStoreTypeOfAccessors(symbol, links) {
links = links || getSymbolLinks(symbol);
if (!links.type) {
links.type = resolvingType;
if (!pushTypeResolution(symbol)) {
return unknownType;
}
var getter = ts.getDeclarationOfKind(symbol, 137 /* GetAccessor */);
var setter = ts.getDeclarationOfKind(symbol, 138 /* SetAccessor */);
var type;
@@ -12874,17 +12917,16 @@ var ts;
}
}
}
if (links.type === resolvingType) {
links.type = type;
}
}
else if (links.type === resolvingType) {
links.type = anyType;
if (compilerOptions.noImplicitAny) {
var getter = ts.getDeclarationOfKind(symbol, 137 /* GetAccessor */);
error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol));
if (!popTypeResolution()) {
type = anyType;
if (compilerOptions.noImplicitAny) {
var getter_1 = ts.getDeclarationOfKind(symbol, 137 /* GetAccessor */);
error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol));
}
}
links.type = type;
}
return links.type;
}
function getTypeOfFuncClassEnumModule(symbol) {
var links = getSymbolLinks(symbol);
@@ -13049,17 +13091,18 @@ var ts;
function getDeclaredTypeOfTypeAlias(symbol) {
var links = getSymbolLinks(symbol);
if (!links.declaredType) {
links.declaredType = resolvingType;
// 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)) {
return unknownType;
}
var declaration = ts.getDeclarationOfKind(symbol, 204 /* TypeAliasDeclaration */);
var type = getTypeFromTypeNode(declaration.type);
if (links.declaredType === resolvingType) {
links.declaredType = type;
if (!popTypeResolution()) {
type = unknownType;
error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
}
}
else if (links.declaredType === resolvingType) {
links.declaredType = unknownType;
var declaration = ts.getDeclarationOfKind(symbol, 204 /* TypeAliasDeclaration */);
error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
links.declaredType = type;
}
return links.declaredType;
}
@@ -13625,7 +13668,9 @@ var ts;
}
function getReturnTypeOfSignature(signature) {
if (!signature.resolvedReturnType) {
signature.resolvedReturnType = resolvingType;
if (!pushTypeResolution(signature)) {
return unknownType;
}
var type;
if (signature.target) {
type = instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper);
@@ -13636,27 +13681,25 @@ var ts;
else {
type = getReturnTypeFromBody(signature.declaration);
}
if (signature.resolvedReturnType === resolvingType) {
signature.resolvedReturnType = type;
}
}
else if (signature.resolvedReturnType === resolvingType) {
signature.resolvedReturnType = anyType;
if (compilerOptions.noImplicitAny) {
var declaration = signature.declaration;
if (declaration.name) {
error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name));
}
else {
error(declaration, ts.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions);
if (!popTypeResolution()) {
type = anyType;
if (compilerOptions.noImplicitAny) {
var declaration = signature.declaration;
if (declaration.name) {
error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name));
}
else {
error(declaration, ts.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions);
}
}
}
signature.resolvedReturnType = type;
}
return signature.resolvedReturnType;
}
function getRestTypeOfSignature(signature) {
if (signature.hasRestParameter) {
var type = getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]);
var type = getTypeOfSymbol(ts.lastOrUndefined(signature.parameters));
if (type.flags & 4096 /* Reference */ && type.target === globalArrayType) {
return type.typeArguments[0];
}
@@ -15689,17 +15732,34 @@ var ts;
}
// Target type is type of prototype property
var prototypeProperty = getPropertyOfType(rightType, "prototype");
if (!prototypeProperty) {
return type;
if (prototypeProperty) {
var targetType = getTypeOfSymbol(prototypeProperty);
if (targetType !== anyType) {
// Narrow to the target type if it's a subtype of the current type
if (isTypeSubtypeOf(targetType, type)) {
return targetType;
}
// If the current type is a union type, remove all constituents that aren't subtypes of the target.
if (type.flags & 16384 /* Union */) {
return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); }));
}
}
}
var targetType = getTypeOfSymbol(prototypeProperty);
// Narrow to target type if it is a subtype of current type
if (isTypeSubtypeOf(targetType, type)) {
return targetType;
// Target type is type of construct signature
var constructSignatures;
if (rightType.flags & 2048 /* Interface */) {
constructSignatures = resolveDeclaredMembers(rightType).declaredConstructSignatures;
}
// If current type is a union type, remove all constituents that aren't subtypes of target type
if (type.flags & 16384 /* Union */) {
return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); }));
else if (rightType.flags & 32768 /* Anonymous */) {
constructSignatures = getSignaturesOfType(rightType, 1 /* Construct */);
}
if (constructSignatures && constructSignatures.length !== 0) {
var instanceType = getUnionType(ts.map(constructSignatures, function (signature) { return getReturnTypeOfSignature(getErasedSignature(signature)); }));
// Pickup type from union types
if (type.flags & 16384 /* Union */) {
return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, instanceType); }));
}
return instanceType;
}
return type;
}
@@ -15965,7 +16025,7 @@ var ts;
// If last parameter is contextually rest parameter get its type
if (indexOfParameter === (func.parameters.length - 1) &&
funcHasRestParameters && contextualSignature.hasRestParameter && func.parameters.length >= contextualSignature.parameters.length) {
return getTypeOfSymbol(contextualSignature.parameters[contextualSignature.parameters.length - 1]);
return getTypeOfSymbol(ts.lastOrUndefined(contextualSignature.parameters));
}
}
}
@@ -17366,9 +17426,9 @@ var ts;
links.type = instantiateType(getTypeAtPosition(context, i), mapper);
}
if (signature.hasRestParameter && context.hasRestParameter && signature.parameters.length >= context.parameters.length) {
var parameter = signature.parameters[signature.parameters.length - 1];
var parameter = ts.lastOrUndefined(signature.parameters);
var links = getSymbolLinks(parameter);
links.type = instantiateType(getTypeOfSymbol(context.parameters[context.parameters.length - 1]), mapper);
links.type = instantiateType(getTypeOfSymbol(ts.lastOrUndefined(context.parameters)), mapper);
}
}
function getReturnTypeFromBody(func, contextualMapper) {
@@ -17477,10 +17537,9 @@ var ts;
if (isContextSensitive(node)) {
assignContextualParameterTypes(signature, contextualSignature, contextualMapper || identityMapper);
}
if (!node.type) {
signature.resolvedReturnType = resolvingType;
if (!node.type && !signature.resolvedReturnType) {
var returnType = getReturnTypeFromBody(node, contextualMapper);
if (signature.resolvedReturnType === resolvingType) {
if (!signature.resolvedReturnType) {
signature.resolvedReturnType = returnType;
}
}
@@ -18396,7 +18455,7 @@ var ts;
}
}
}
checkAndStoreTypeOfAccessors(getSymbolOfNode(node));
getTypeOfAccessors(getSymbolOfNode(node));
}
checkFunctionLikeDeclaration(node);
}
@@ -22381,7 +22440,7 @@ var ts;
function checkGrammarBindingElement(node) {
if (node.dotDotDotToken) {
var elements = node.parent.elements;
if (node !== elements[elements.length - 1]) {
if (node !== ts.lastOrUndefined(elements)) {
return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern);
}
if (node.name.kind === 152 /* ArrayBindingPattern */ || node.name.kind === 151 /* ObjectBindingPattern */) {
@@ -24373,7 +24432,7 @@ var ts;
var sourceMapNameIndexMap = {};
var sourceMapNameIndices = [];
function getSourceMapNameIndex() {
return sourceMapNameIndices.length ? sourceMapNameIndices[sourceMapNameIndices.length - 1] : -1;
return sourceMapNameIndices.length ? ts.lastOrUndefined(sourceMapNameIndices) : -1;
}
// Last recorded and encoded spans
var lastRecordedSourceMapSpan;
@@ -27145,11 +27204,11 @@ var ts;
emitNodeWithoutSourceMap(memberName);
}
}
function getInitializedProperties(node, static) {
function getInitializedProperties(node, isStatic) {
var properties = [];
for (var _a = 0, _b = node.members; _a < _b.length; _a++) {
var member = _b[_a];
if (member.kind === 133 /* PropertyDeclaration */ && static === ((member.flags & 128 /* Static */) !== 0) && member.initializer) {
if (member.kind === 133 /* PropertyDeclaration */ && isStatic === ((member.flags & 128 /* Static */) !== 0) && member.initializer) {
properties.push(member);
}
}
@@ -27535,6 +27594,7 @@ var ts;
writeLine();
emitToken(15 /* CloseBraceToken */, node.members.end);
scopeEmitEnd();
// TODO(rbuckton): Need to go back to `let _a = class C {}` approach, removing the defineProperty call for now.
// For a decorated class, we need to assign its name (if it has one). This is because we emit
// the class as a class expression to avoid the double-binding of the identifier:
//
@@ -27544,15 +27604,6 @@ var ts;
//
if (thisNodeIsDecorated) {
write(";");
if (node.name) {
writeLine();
write("Object.defineProperty(");
emitDeclarationName(node);
write(", \"name\", { value: \"");
emitDeclarationName(node);
write("\", configurable: true });");
writeLine();
}
}
// Emit static property assignment. Because classDeclaration is lexically evaluated,
// it is safe to emit static property assignment after classDeclaration
@@ -29368,11 +29419,11 @@ var ts;
}
}
function hasDetachedComments(pos) {
return detachedCommentsInfo !== undefined && detachedCommentsInfo[detachedCommentsInfo.length - 1].nodePos === pos;
return detachedCommentsInfo !== undefined && ts.lastOrUndefined(detachedCommentsInfo).nodePos === pos;
}
function getLeadingCommentsWithoutDetachedComments() {
// get the leading comments from detachedPos
var leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, detachedCommentsInfo[detachedCommentsInfo.length - 1].detachedCommentEndPos);
var leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, ts.lastOrUndefined(detachedCommentsInfo).detachedCommentEndPos);
if (detachedCommentsInfo.length - 1) {
detachedCommentsInfo.pop();
}
@@ -29473,13 +29524,13 @@ var ts;
// All comments look like they could have been part of the copyright header. Make
// sure there is at least one blank line between it and the node. If not, it's not
// a copyright header.
var lastCommentLine = ts.getLineOfLocalPosition(currentSourceFile, detachedComments[detachedComments.length - 1].end);
var lastCommentLine = ts.getLineOfLocalPosition(currentSourceFile, ts.lastOrUndefined(detachedComments).end);
var nodeLine = ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.pos));
if (nodeLine >= lastCommentLine + 2) {
// Valid detachedComments
ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments);
ts.emitComments(currentSourceFile, writer, detachedComments, true, newLine, writeComment);
var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: detachedComments[detachedComments.length - 1].end };
var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: ts.lastOrUndefined(detachedComments).end };
if (detachedCommentsInfo) {
detachedCommentsInfo.push(currentDetachedCommentInfo);
}
@@ -29521,6 +29572,8 @@ var ts;
/* @internal */ ts.ioWriteTime = 0;
/** The version of the TypeScript compiler release */
ts.version = "1.5.0";
var carriageReturnLineFeed = "\r\n";
var lineFeed = "\n";
function findConfigFile(searchPath) {
var fileName = "tsconfig.json";
while (true) {
@@ -29594,6 +29647,9 @@ var ts;
}
}
}
var newLine = options.newLine === 0 /* CarriageReturnLineFeed */ ? carriageReturnLineFeed :
options.newLine === 1 /* LineFeed */ ? lineFeed :
ts.sys.newLine;
return {
getSourceFile: getSourceFile,
getDefaultLibFileName: function (options) { return ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())), ts.getDefaultLibFileName(options)); },
@@ -29601,7 +29657,7 @@ var ts;
getCurrentDirectory: function () { return currentDirectory || (currentDirectory = ts.sys.getCurrentDirectory()); },
useCaseSensitiveFileNames: function () { return ts.sys.useCaseSensitiveFileNames; },
getCanonicalFileName: getCanonicalFileName,
getNewLine: function () { return ts.sys.newLine; }
getNewLine: function () { return newLine; }
};
}
ts.createCompilerHost = createCompilerHost;
@@ -30119,6 +30175,16 @@ var ts;
paramType: ts.Diagnostics.KIND,
error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_amd_system_or_umd
},
{
name: "newLine",
type: {
"crlf": 0 /* CarriageReturnLineFeed */,
"lf": 1 /* LineFeed */
},
description: ts.Diagnostics.Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix,
paramType: ts.Diagnostics.NEWLINE,
error: ts.Diagnostics.Argument_for_newLine_option_must_be_CRLF_or_LF
},
{
name: "noEmit",
type: "boolean",
@@ -32529,7 +32595,7 @@ var ts;
function nodeEndsWith(n, expectedLastToken, sourceFile) {
var children = n.getChildren(sourceFile);
if (children.length) {
var last = children[children.length - 1];
var last = ts.lastOrUndefined(children);
if (last.kind === expectedLastToken) {
return true;
}
@@ -33023,7 +33089,7 @@ var ts;
if (isStarted) {
if (trailingTrivia) {
ts.Debug.assert(trailingTrivia.length !== 0);
wasNewLine = trailingTrivia[trailingTrivia.length - 1].kind === 4 /* NewLineTrivia */;
wasNewLine = ts.lastOrUndefined(trailingTrivia).kind === 4 /* NewLineTrivia */;
}
else {
wasNewLine = false;
@@ -34482,6 +34548,8 @@ var ts;
var previousRange;
var previousParent;
var previousRangeStartLine;
var lastIndentedLine;
var indentationOnLastIndentedLine;
var edits = [];
formattingScanner.advance();
if (formattingScanner.isOnToken()) {
@@ -34551,7 +34619,9 @@ var ts;
// if node is located on the same line with the parent
// - inherit indentation from the parent
// - push children if either parent of node itself has non-zero delta
indentation = parentDynamicIndentation.getIndentation();
indentation = startLine === lastIndentedLine
? indentationOnLastIndentedLine
: parentDynamicIndentation.getIndentation();
delta = Math.min(options.IndentSize, parentDynamicIndentation.getDelta() + delta);
}
return {
@@ -34799,7 +34869,6 @@ var ts;
if (!ts.rangeContainsRange(originalRange, triviaItem)) {
continue;
}
var triviaStartLine = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos).line;
switch (triviaItem.kind) {
case 3 /* MultiLineCommentTrivia */:
var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind);
@@ -34823,6 +34892,8 @@ var ts;
if (isTokenInRange && !rangeContainsError(currentTokenInfo.token)) {
var tokenIndentation = dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind);
insertIndentation(currentTokenInfo.token.pos, tokenIndentation, lineAdded);
lastIndentedLine = tokenStart.line;
indentationOnLastIndentedLine = tokenIndentation;
}
}
formattingScanner.advance();
@@ -38055,22 +38126,6 @@ var ts;
}
return ScriptElementKind.unknown;
}
function getTypeKind(type) {
var flags = type.getFlags();
if (flags & 128 /* Enum */)
return ScriptElementKind.enumElement;
if (flags & 1024 /* Class */)
return ScriptElementKind.classElement;
if (flags & 2048 /* Interface */)
return ScriptElementKind.interfaceElement;
if (flags & 512 /* TypeParameter */)
return ScriptElementKind.typeParameterElement;
if (flags & 1048703 /* Intrinsic */)
return ScriptElementKind.primitiveType;
if (flags & 256 /* StringLiteral */)
return ScriptElementKind.primitiveType;
return ScriptElementKind.unknown;
}
function getSymbolModifiers(symbol) {
return symbol && symbol.declarations && symbol.declarations.length > 0
? ts.getNodeModifiers(symbol.declarations[0])
@@ -38453,6 +38508,62 @@ var ts;
containerName: containerName
};
}
function getDefinitionFromSymbol(symbol, node) {
var typeChecker = program.getTypeChecker();
var result = [];
var declarations = symbol.getDeclarations();
var symbolName = typeChecker.symbolToString(symbol); // Do not get scoped name, just the name of the symbol
var symbolKind = getSymbolKind(symbol, node);
var containerSymbol = symbol.parent;
var containerName = containerSymbol ? typeChecker.symbolToString(containerSymbol, node) : "";
if (!tryAddConstructSignature(symbol, node, symbolKind, symbolName, containerName, result) &&
!tryAddCallSignature(symbol, node, symbolKind, symbolName, containerName, result)) {
// Just add all the declarations.
ts.forEach(declarations, function (declaration) {
result.push(createDefinitionInfo(declaration, symbolKind, symbolName, containerName));
});
}
return result;
function tryAddConstructSignature(symbol, location, symbolKind, symbolName, containerName, result) {
// Applicable only if we are in a new expression, or we are on a constructor declaration
// and in either case the symbol has a construct signature definition, i.e. class
if (isNewExpressionTarget(location) || location.kind === 114 /* ConstructorKeyword */) {
if (symbol.flags & 32 /* Class */) {
var classDeclaration = symbol.getDeclarations()[0];
ts.Debug.assert(classDeclaration && classDeclaration.kind === 202 /* ClassDeclaration */);
return tryAddSignature(classDeclaration.members, true, symbolKind, symbolName, containerName, result);
}
}
return false;
}
function tryAddCallSignature(symbol, location, symbolKind, symbolName, containerName, result) {
if (isCallExpressionTarget(location) || isNewExpressionTarget(location) || isNameOfFunctionDeclaration(location)) {
return tryAddSignature(symbol.declarations, false, symbolKind, symbolName, containerName, result);
}
return false;
}
function tryAddSignature(signatureDeclarations, selectConstructors, symbolKind, symbolName, containerName, result) {
var declarations = [];
var definition;
ts.forEach(signatureDeclarations, function (d) {
if ((selectConstructors && d.kind === 136 /* Constructor */) ||
(!selectConstructors && (d.kind === 201 /* FunctionDeclaration */ || d.kind === 135 /* MethodDeclaration */ || d.kind === 134 /* MethodSignature */))) {
declarations.push(d);
if (d.body)
definition = d;
}
});
if (definition) {
result.push(createDefinitionInfo(definition, symbolKind, symbolName, containerName));
return true;
}
else if (declarations.length) {
result.push(createDefinitionInfo(ts.lastOrUndefined(declarations), symbolKind, symbolName, containerName));
return true;
}
return false;
}
}
/// Goto definition
function getDefinitionAtPosition(fileName, position) {
synchronizeHostData();
@@ -38516,59 +38627,38 @@ var ts;
var shorthandContainerName = typeChecker.symbolToString(symbol.parent, node);
return ts.map(shorthandDeclarations, function (declaration) { return createDefinitionInfo(declaration, shorthandSymbolKind, shorthandSymbolName, shorthandContainerName); });
}
var result = [];
var declarations = symbol.getDeclarations();
var symbolName = typeChecker.symbolToString(symbol); // Do not get scoped name, just the name of the symbol
var symbolKind = getSymbolKind(symbol, node);
var containerSymbol = symbol.parent;
var containerName = containerSymbol ? typeChecker.symbolToString(containerSymbol, node) : "";
if (!tryAddConstructSignature(symbol, node, symbolKind, symbolName, containerName, result) &&
!tryAddCallSignature(symbol, node, symbolKind, symbolName, containerName, result)) {
// Just add all the declarations.
ts.forEach(declarations, function (declaration) {
result.push(createDefinitionInfo(declaration, symbolKind, symbolName, containerName));
});
return getDefinitionFromSymbol(symbol, node);
}
/// Goto type
function getTypeDefinitionAtPosition(fileName, position) {
synchronizeHostData();
var sourceFile = getValidSourceFile(fileName);
var node = ts.getTouchingPropertyName(sourceFile, position);
if (!node) {
return undefined;
}
return result;
function tryAddConstructSignature(symbol, location, symbolKind, symbolName, containerName, result) {
// Applicable only if we are in a new expression, or we are on a constructor declaration
// and in either case the symbol has a construct signature definition, i.e. class
if (isNewExpressionTarget(location) || location.kind === 114 /* ConstructorKeyword */) {
if (symbol.flags & 32 /* Class */) {
var classDeclaration = symbol.getDeclarations()[0];
ts.Debug.assert(classDeclaration && classDeclaration.kind === 202 /* ClassDeclaration */);
return tryAddSignature(classDeclaration.members, true, symbolKind, symbolName, containerName, result);
}
}
return false;
var typeChecker = program.getTypeChecker();
var symbol = typeChecker.getSymbolAtLocation(node);
if (!symbol) {
return undefined;
}
function tryAddCallSignature(symbol, location, symbolKind, symbolName, containerName, result) {
if (isCallExpressionTarget(location) || isNewExpressionTarget(location) || isNameOfFunctionDeclaration(location)) {
return tryAddSignature(symbol.declarations, false, symbolKind, symbolName, containerName, result);
}
return false;
var type = typeChecker.getTypeOfSymbolAtLocation(symbol, node);
if (!type) {
return undefined;
}
function tryAddSignature(signatureDeclarations, selectConstructors, symbolKind, symbolName, containerName, result) {
var declarations = [];
var definition;
ts.forEach(signatureDeclarations, function (d) {
if ((selectConstructors && d.kind === 136 /* Constructor */) ||
(!selectConstructors && (d.kind === 201 /* FunctionDeclaration */ || d.kind === 135 /* MethodDeclaration */ || d.kind === 134 /* MethodSignature */))) {
declarations.push(d);
if (d.body)
definition = d;
if (type.flags & 16384 /* Union */) {
var result = [];
ts.forEach(type.types, function (t) {
if (t.symbol) {
result.push.apply(result, getDefinitionFromSymbol(t.symbol, node));
}
});
if (definition) {
result.push(createDefinitionInfo(definition, symbolKind, symbolName, containerName));
return true;
}
else if (declarations.length) {
result.push(createDefinitionInfo(declarations[declarations.length - 1], symbolKind, symbolName, containerName));
return true;
}
return false;
return result;
}
if (!type.symbol) {
return undefined;
}
return getDefinitionFromSymbol(type.symbol, node);
}
function getOccurrencesAtPosition(fileName, position) {
var results = getOccurrencesAtPositionCore(fileName, position);
@@ -40613,6 +40703,7 @@ var ts;
getSignatureHelpItems: getSignatureHelpItems,
getQuickInfoAtPosition: getQuickInfoAtPosition,
getDefinitionAtPosition: getDefinitionAtPosition,
getTypeDefinitionAtPosition: getTypeDefinitionAtPosition,
getReferencesAtPosition: getReferencesAtPosition,
findReferences: findReferences,
getOccurrencesAtPosition: getOccurrencesAtPosition,
@@ -41498,14 +41589,14 @@ var ts;
}
// fall through.
case 224 /* CatchClause */:
return spanInNode(node.parent.statements[node.parent.statements.length - 1]);
return spanInNode(ts.lastOrUndefined(node.parent.statements));
;
case 208 /* CaseBlock */:
// breakpoint in last statement of the last clause
var caseBlock = node.parent;
var lastClause = caseBlock.clauses[caseBlock.clauses.length - 1];
var lastClause = ts.lastOrUndefined(caseBlock.clauses);
if (lastClause) {
return spanInNode(lastClause.statements[lastClause.statements.length - 1]);
return spanInNode(ts.lastOrUndefined(lastClause.statements));
}
return undefined;
// Default to parent node
@@ -41571,7 +41662,7 @@ var ts;
})(ts || (ts = {}));
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
@@ -41909,6 +42000,17 @@ var ts;
return _this.languageService.getDefinitionAtPosition(fileName, position);
});
};
/// GOTO Type
/**
* Computes the definition location of the type of the symbol
* at the requested position.
*/
LanguageServiceShimObject.prototype.getTypeDefinitionAtPosition = function (fileName, position) {
var _this = this;
return this.forwardJSONCall("getTypeDefinitionAtPosition('" + fileName + "', " + position + ")", function () {
return _this.languageService.getTypeDefinitionAtPosition(fileName, position);
});
};
LanguageServiceShimObject.prototype.getRenameInfo = function (fileName, position) {
var _this = this;
return this.forwardJSONCall("getRenameInfo('" + fileName + "', " + position + ")", function () {
@@ -42130,7 +42232,7 @@ var ts;
return {
options: configFile.options,
files: configFile.fileNames,
errors: realizeDiagnostics(configFile.errors, '\r\n')
errors: [realizeDiagnostics(configFile.errors, '\r\n')]
};
});
};
+34
View File
@@ -1094,6 +1094,7 @@ declare module ts {
locale?: string;
mapRoot?: string;
module?: ModuleKind;
newLine?: NewLineKind;
noEmit?: boolean;
noEmitHelpers?: boolean;
noEmitOnError?: boolean;
@@ -1124,6 +1125,10 @@ declare module ts {
UMD = 3,
System = 4,
}
const enum NewLineKind {
CarriageReturnLineFeed = 0,
LineFeed = 1,
}
interface LineAndCharacter {
line: number;
character: number;
@@ -1186,6 +1191,32 @@ declare module ts {
var sys: System;
}
declare module ts {
interface ErrorCallback {
(message: DiagnosticMessage, length: number): void;
}
interface Scanner {
getStartPos(): number;
getToken(): SyntaxKind;
getTextPos(): number;
getTokenPos(): number;
getTokenText(): string;
getTokenValue(): string;
hasExtendedUnicodeEscape(): boolean;
hasPrecedingLineBreak(): boolean;
isIdentifier(): boolean;
isReservedWord(): boolean;
isUnterminated(): boolean;
reScanGreaterToken(): SyntaxKind;
reScanSlashToken(): SyntaxKind;
reScanTemplateToken(): SyntaxKind;
scan(): SyntaxKind;
setText(text: string, start?: number, length?: number): void;
setOnError(onError: ErrorCallback): void;
setScriptTarget(scriptTarget: ScriptTarget): void;
setTextPos(textPos: number): void;
lookAhead<T>(callback: () => T): T;
tryScan<T>(callback: () => T): T;
}
function tokenToString(t: SyntaxKind): string;
function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number;
function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter;
@@ -1195,6 +1226,8 @@ declare module ts {
function getTrailingCommentRanges(text: string, pos: number): CommentRange[];
function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean;
function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean;
/** Creates a scanner over a (possibly unspecified) range of a piece of text. */
function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, text?: string, onError?: ErrorCallback, start?: number, length?: number): Scanner;
}
declare module ts {
function getDefaultLibFileName(options: CompilerOptions): string;
@@ -1381,6 +1414,7 @@ declare module ts {
getRenameInfo(fileName: string, position: number): RenameInfo;
findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[];
getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[];
getTypeDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[];
getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[];
findReferences(fileName: string, position: number): ReferencedSymbol[];
getDocumentHighlights(fileName: string, position: number, filesToSearch: string[]): DocumentHighlights[];
+274 -172
View File
@@ -547,6 +547,11 @@ var ts;
ModuleKind[ModuleKind["System"] = 4] = "System";
})(ts.ModuleKind || (ts.ModuleKind = {}));
var ModuleKind = ts.ModuleKind;
(function (NewLineKind) {
NewLineKind[NewLineKind["CarriageReturnLineFeed"] = 0] = "CarriageReturnLineFeed";
NewLineKind[NewLineKind["LineFeed"] = 1] = "LineFeed";
})(ts.NewLineKind || (ts.NewLineKind = {}));
var NewLineKind = ts.NewLineKind;
(function (ScriptTarget) {
ScriptTarget[ScriptTarget["ES3"] = 0] = "ES3";
ScriptTarget[ScriptTarget["ES5"] = 1] = "ES5";
@@ -1137,7 +1142,7 @@ var ts;
for (var _i = 0; _i < parts.length; _i++) {
var part = parts[_i];
if (part !== ".") {
if (part === ".." && normalized.length > 0 && normalized[normalized.length - 1] !== "..") {
if (part === ".." && normalized.length > 0 && lastOrUndefined(normalized) !== "..") {
normalized.pop();
}
else {
@@ -1244,7 +1249,7 @@ var ts;
function getRelativePathToDirectoryOrUrl(directoryPathOrUrl, relativeOrAbsolutePath, currentDirectory, getCanonicalFileName, isAbsolutePathAnUrl) {
var pathComponents = getNormalizedPathOrUrlComponents(relativeOrAbsolutePath, currentDirectory);
var directoryComponents = getNormalizedPathOrUrlComponents(directoryPathOrUrl, currentDirectory);
if (directoryComponents.length > 1 && directoryComponents[directoryComponents.length - 1] === "") {
if (directoryComponents.length > 1 && lastOrUndefined(directoryComponents) === "") {
// If the directory path given was of type test/cases/ then we really need components of directory to be only till its name
// that is ["test", "cases", ""] needs to be actually ["test", "cases"]
directoryComponents.length--;
@@ -2015,6 +2020,8 @@ var ts;
An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2499, category: ts.DiagnosticCategory.Error, key: "An interface can only extend an identifier/qualified-name with optional type arguments." },
A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2500, category: ts.DiagnosticCategory.Error, key: "A class can only implement an identifier/qualified-name with optional type arguments." },
A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: ts.DiagnosticCategory.Error, key: "A rest element cannot contain a binding pattern." },
_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 2502, category: ts.DiagnosticCategory.Error, key: "'{0}' is referenced directly or indirectly in its own type annotation." },
Cannot_find_namespace_0: { code: 2503, category: ts.DiagnosticCategory.Error, key: "Cannot find namespace '{0}'." },
Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
@@ -2154,6 +2161,9 @@ var ts;
Preserve_new_lines_when_emitting_code: { code: 6057, category: ts.DiagnosticCategory.Message, key: "Preserve new-lines when emitting code." },
Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir: { code: 6058, category: ts.DiagnosticCategory.Message, key: "Specifies the root directory of input files. Use to control the output directory structure with --outDir." },
File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files: { code: 6059, category: ts.DiagnosticCategory.Error, key: "File '{0}' is not under 'rootDir' '{1}'. 'rootDir' is expected to contain all source files." },
Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { code: 6060, category: ts.DiagnosticCategory.Message, key: "Specifies the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)." },
NEWLINE: { code: 6061, category: ts.DiagnosticCategory.Message, key: "NEWLINE" },
Argument_for_newLine_option_must_be_CRLF_or_LF: { code: 6062, category: ts.DiagnosticCategory.Error, key: "Argument for '--newLine' option must be 'CRLF' or 'LF'." },
Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable '{0}' implicitly has an '{1}' type." },
Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter '{0}' implicitly has an '{1}' type." },
Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member '{0}' implicitly has an '{1}' type." },
@@ -2166,7 +2176,6 @@ var ts;
Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: ts.DiagnosticCategory.Error, key: "Object literal's property '{0}' implicitly has an '{1}' type." },
Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: ts.DiagnosticCategory.Error, key: "Rest parameter '{0}' implicitly has an 'any[]' type." },
Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: ts.DiagnosticCategory.Error, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." },
_0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 7021, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." },
_0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." },
_0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." },
Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: ts.DiagnosticCategory.Error, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." },
@@ -2652,7 +2661,7 @@ var ts;
}
collecting = true;
if (result && result.length) {
result[result.length - 1].hasTrailingNewLine = true;
ts.lastOrUndefined(result).hasTrailingNewLine = true;
}
continue;
case 9 /* tab */:
@@ -2698,7 +2707,7 @@ var ts;
default:
if (ch > 127 /* maxAsciiCharacter */ && (isWhiteSpace(ch) || isLineBreak(ch))) {
if (result && result.length && isLineBreak(ch)) {
result[result.length - 1].hasTrailingNewLine = true;
ts.lastOrUndefined(result).hasTrailingNewLine = true;
}
pos++;
continue;
@@ -2728,8 +2737,7 @@ var ts;
ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierPart(ch, languageVersion);
}
ts.isIdentifierPart = isIdentifierPart;
// Creates a scanner over a (possibly unspecified) range of a piece of text.
/* @internal */
/** Creates a scanner over a (possibly unspecified) range of a piece of text. */
function createScanner(languageVersion, skipTrivia, text, onError, start, length) {
var pos; // Current position (end position of text of current token)
var end; // end of text
@@ -4924,7 +4932,7 @@ var ts;
}
ts.hasQuestionToken = hasQuestionToken;
function hasRestParameters(s) {
return s.parameters.length > 0 && s.parameters[s.parameters.length - 1].dotDotDotToken !== undefined;
return s.parameters.length > 0 && ts.lastOrUndefined(s.parameters).dotDotDotToken !== undefined;
}
ts.hasRestParameters = hasRestParameters;
function isLiteralKind(kind) {
@@ -5388,7 +5396,7 @@ var ts;
var lineStartsOfS = ts.computeLineStarts(s);
if (lineStartsOfS.length > 1) {
lineCount = lineCount + lineStartsOfS.length - 1;
linePos = output.length - s.length + lineStartsOfS[lineStartsOfS.length - 1];
linePos = output.length - s.length + ts.lastOrUndefined(lineStartsOfS);
}
}
}
@@ -5457,8 +5465,10 @@ var ts;
ts.getFirstConstructorWithBody = getFirstConstructorWithBody;
function shouldEmitToOwnFile(sourceFile, compilerOptions) {
if (!isDeclarationFile(sourceFile)) {
if ((isExternalModule(sourceFile) || !compilerOptions.out) && !ts.fileExtensionIs(sourceFile.fileName, ".js")) {
return true;
if ((isExternalModule(sourceFile) || !compilerOptions.out)) {
// 1. in-browser single file compilation scenario
// 2. non .js file
return compilerOptions.separateCompilation || !ts.fileExtensionIs(sourceFile.fileName, ".js");
}
return false;
}
@@ -7465,7 +7475,7 @@ var ts;
templateSpans.pos = getNodePos();
do {
templateSpans.push(parseTemplateSpan());
} while (templateSpans[templateSpans.length - 1].literal.kind === 12 /* TemplateMiddle */);
} while (ts.lastOrUndefined(templateSpans).literal.kind === 12 /* TemplateMiddle */);
templateSpans.end = getNodeEnd();
template.templateSpans = templateSpans;
return finishNode(template);
@@ -10795,7 +10805,6 @@ var ts;
var undefinedType = createIntrinsicType(32 /* Undefined */ | 262144 /* ContainsUndefinedOrNull */, "undefined");
var nullType = createIntrinsicType(64 /* Null */ | 262144 /* ContainsUndefinedOrNull */, "null");
var unknownType = createIntrinsicType(1 /* Any */, "unknown");
var resolvingType = createIntrinsicType(1 /* Any */, "__resolving__");
var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
@@ -10825,6 +10834,8 @@ var ts;
var emitExtends = false;
var emitDecorate = false;
var emitParam = false;
var resolutionTargets = [];
var resolutionResults = [];
var mergedSymbols = [];
var symbolLinks = [];
var nodeLinks = [];
@@ -11054,9 +11065,9 @@ var ts;
}
else if (location.kind === 228 /* SourceFile */ ||
(location.kind === 206 /* ModuleDeclaration */ && location.name.kind === 8 /* StringLiteral */)) {
result = getSymbol(getSymbolOfNode(location).exports, "default", meaning & 8914931 /* ModuleMember */);
result = getSymbolOfNode(location).exports["default"];
var localSymbol = ts.getLocalSymbolForExportDefault(result);
if (result && (result.flags & meaning) && localSymbol && localSymbol.name === name) {
if (result && localSymbol && (result.flags & meaning) && localSymbol.name === name) {
break loop;
}
result = undefined;
@@ -11472,7 +11483,8 @@ var ts;
}
var symbol;
if (name.kind === 65 /* Identifier */) {
symbol = resolveName(name, name.text, meaning, ts.Diagnostics.Cannot_find_name_0, name);
var message = meaning === 1536 /* Namespace */ ? ts.Diagnostics.Cannot_find_namespace_0 : ts.Diagnostics.Cannot_find_name_0;
symbol = resolveName(name, name.text, meaning, message, name);
if (!symbol) {
return undefined;
}
@@ -12564,6 +12576,35 @@ var 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) {
var i = 0;
var count = resolutionTargets.length;
while (i < count && resolutionTargets[i] !== target) {
i++;
}
if (i < count) {
do {
resolutionResults[i++] = false;
} while (i < count);
return false;
}
resolutionTargets.push(target);
resolutionResults.push(true);
return true;
}
// 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() {
resolutionTargets.pop();
return resolutionResults.pop();
}
function getRootDeclaration(node) {
while (node.kind === 153 /* BindingElement */) {
node = node.parent.parent;
@@ -12806,20 +12847,25 @@ var ts;
return links.type = checkExpression(declaration.expression);
}
// Handle variable, parameter or property
links.type = resolvingType;
if (!pushTypeResolution(symbol)) {
return unknownType;
}
var type = getWidenedTypeForVariableLikeDeclaration(declaration, true);
if (links.type === resolvingType) {
links.type = type;
}
}
else if (links.type === resolvingType) {
links.type = anyType;
if (compilerOptions.noImplicitAny) {
var diagnostic = symbol.valueDeclaration.type ?
ts.Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation :
ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer;
error(symbol.valueDeclaration, diagnostic, symbolToString(symbol));
if (!popTypeResolution()) {
if (symbol.valueDeclaration.type) {
// Variable has type annotation that circularly references the variable itself
type = unknownType;
error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));
}
else {
// Variable has initializer that circularly references the variable itself
type = anyType;
if (compilerOptions.noImplicitAny) {
error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol));
}
}
}
links.type = type;
}
return links.type;
}
@@ -12840,13 +12886,10 @@ var ts;
}
function getTypeOfAccessors(symbol) {
var links = getSymbolLinks(symbol);
checkAndStoreTypeOfAccessors(symbol, links);
return links.type;
}
function checkAndStoreTypeOfAccessors(symbol, links) {
links = links || getSymbolLinks(symbol);
if (!links.type) {
links.type = resolvingType;
if (!pushTypeResolution(symbol)) {
return unknownType;
}
var getter = ts.getDeclarationOfKind(symbol, 137 /* GetAccessor */);
var setter = ts.getDeclarationOfKind(symbol, 138 /* SetAccessor */);
var type;
@@ -12874,17 +12917,16 @@ var ts;
}
}
}
if (links.type === resolvingType) {
links.type = type;
}
}
else if (links.type === resolvingType) {
links.type = anyType;
if (compilerOptions.noImplicitAny) {
var getter = ts.getDeclarationOfKind(symbol, 137 /* GetAccessor */);
error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol));
if (!popTypeResolution()) {
type = anyType;
if (compilerOptions.noImplicitAny) {
var getter_1 = ts.getDeclarationOfKind(symbol, 137 /* GetAccessor */);
error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol));
}
}
links.type = type;
}
return links.type;
}
function getTypeOfFuncClassEnumModule(symbol) {
var links = getSymbolLinks(symbol);
@@ -13049,17 +13091,18 @@ var ts;
function getDeclaredTypeOfTypeAlias(symbol) {
var links = getSymbolLinks(symbol);
if (!links.declaredType) {
links.declaredType = resolvingType;
// 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)) {
return unknownType;
}
var declaration = ts.getDeclarationOfKind(symbol, 204 /* TypeAliasDeclaration */);
var type = getTypeFromTypeNode(declaration.type);
if (links.declaredType === resolvingType) {
links.declaredType = type;
if (!popTypeResolution()) {
type = unknownType;
error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
}
}
else if (links.declaredType === resolvingType) {
links.declaredType = unknownType;
var declaration = ts.getDeclarationOfKind(symbol, 204 /* TypeAliasDeclaration */);
error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
links.declaredType = type;
}
return links.declaredType;
}
@@ -13625,7 +13668,9 @@ var ts;
}
function getReturnTypeOfSignature(signature) {
if (!signature.resolvedReturnType) {
signature.resolvedReturnType = resolvingType;
if (!pushTypeResolution(signature)) {
return unknownType;
}
var type;
if (signature.target) {
type = instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper);
@@ -13636,27 +13681,25 @@ var ts;
else {
type = getReturnTypeFromBody(signature.declaration);
}
if (signature.resolvedReturnType === resolvingType) {
signature.resolvedReturnType = type;
}
}
else if (signature.resolvedReturnType === resolvingType) {
signature.resolvedReturnType = anyType;
if (compilerOptions.noImplicitAny) {
var declaration = signature.declaration;
if (declaration.name) {
error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name));
}
else {
error(declaration, ts.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions);
if (!popTypeResolution()) {
type = anyType;
if (compilerOptions.noImplicitAny) {
var declaration = signature.declaration;
if (declaration.name) {
error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name));
}
else {
error(declaration, ts.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions);
}
}
}
signature.resolvedReturnType = type;
}
return signature.resolvedReturnType;
}
function getRestTypeOfSignature(signature) {
if (signature.hasRestParameter) {
var type = getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]);
var type = getTypeOfSymbol(ts.lastOrUndefined(signature.parameters));
if (type.flags & 4096 /* Reference */ && type.target === globalArrayType) {
return type.typeArguments[0];
}
@@ -15689,17 +15732,34 @@ var ts;
}
// Target type is type of prototype property
var prototypeProperty = getPropertyOfType(rightType, "prototype");
if (!prototypeProperty) {
return type;
if (prototypeProperty) {
var targetType = getTypeOfSymbol(prototypeProperty);
if (targetType !== anyType) {
// Narrow to the target type if it's a subtype of the current type
if (isTypeSubtypeOf(targetType, type)) {
return targetType;
}
// If the current type is a union type, remove all constituents that aren't subtypes of the target.
if (type.flags & 16384 /* Union */) {
return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); }));
}
}
}
var targetType = getTypeOfSymbol(prototypeProperty);
// Narrow to target type if it is a subtype of current type
if (isTypeSubtypeOf(targetType, type)) {
return targetType;
// Target type is type of construct signature
var constructSignatures;
if (rightType.flags & 2048 /* Interface */) {
constructSignatures = resolveDeclaredMembers(rightType).declaredConstructSignatures;
}
// If current type is a union type, remove all constituents that aren't subtypes of target type
if (type.flags & 16384 /* Union */) {
return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); }));
else if (rightType.flags & 32768 /* Anonymous */) {
constructSignatures = getSignaturesOfType(rightType, 1 /* Construct */);
}
if (constructSignatures && constructSignatures.length !== 0) {
var instanceType = getUnionType(ts.map(constructSignatures, function (signature) { return getReturnTypeOfSignature(getErasedSignature(signature)); }));
// Pickup type from union types
if (type.flags & 16384 /* Union */) {
return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, instanceType); }));
}
return instanceType;
}
return type;
}
@@ -15965,7 +16025,7 @@ var ts;
// If last parameter is contextually rest parameter get its type
if (indexOfParameter === (func.parameters.length - 1) &&
funcHasRestParameters && contextualSignature.hasRestParameter && func.parameters.length >= contextualSignature.parameters.length) {
return getTypeOfSymbol(contextualSignature.parameters[contextualSignature.parameters.length - 1]);
return getTypeOfSymbol(ts.lastOrUndefined(contextualSignature.parameters));
}
}
}
@@ -17366,9 +17426,9 @@ var ts;
links.type = instantiateType(getTypeAtPosition(context, i), mapper);
}
if (signature.hasRestParameter && context.hasRestParameter && signature.parameters.length >= context.parameters.length) {
var parameter = signature.parameters[signature.parameters.length - 1];
var parameter = ts.lastOrUndefined(signature.parameters);
var links = getSymbolLinks(parameter);
links.type = instantiateType(getTypeOfSymbol(context.parameters[context.parameters.length - 1]), mapper);
links.type = instantiateType(getTypeOfSymbol(ts.lastOrUndefined(context.parameters)), mapper);
}
}
function getReturnTypeFromBody(func, contextualMapper) {
@@ -17477,10 +17537,9 @@ var ts;
if (isContextSensitive(node)) {
assignContextualParameterTypes(signature, contextualSignature, contextualMapper || identityMapper);
}
if (!node.type) {
signature.resolvedReturnType = resolvingType;
if (!node.type && !signature.resolvedReturnType) {
var returnType = getReturnTypeFromBody(node, contextualMapper);
if (signature.resolvedReturnType === resolvingType) {
if (!signature.resolvedReturnType) {
signature.resolvedReturnType = returnType;
}
}
@@ -18396,7 +18455,7 @@ var ts;
}
}
}
checkAndStoreTypeOfAccessors(getSymbolOfNode(node));
getTypeOfAccessors(getSymbolOfNode(node));
}
checkFunctionLikeDeclaration(node);
}
@@ -22381,7 +22440,7 @@ var ts;
function checkGrammarBindingElement(node) {
if (node.dotDotDotToken) {
var elements = node.parent.elements;
if (node !== elements[elements.length - 1]) {
if (node !== ts.lastOrUndefined(elements)) {
return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern);
}
if (node.name.kind === 152 /* ArrayBindingPattern */ || node.name.kind === 151 /* ObjectBindingPattern */) {
@@ -24373,7 +24432,7 @@ var ts;
var sourceMapNameIndexMap = {};
var sourceMapNameIndices = [];
function getSourceMapNameIndex() {
return sourceMapNameIndices.length ? sourceMapNameIndices[sourceMapNameIndices.length - 1] : -1;
return sourceMapNameIndices.length ? ts.lastOrUndefined(sourceMapNameIndices) : -1;
}
// Last recorded and encoded spans
var lastRecordedSourceMapSpan;
@@ -27145,11 +27204,11 @@ var ts;
emitNodeWithoutSourceMap(memberName);
}
}
function getInitializedProperties(node, static) {
function getInitializedProperties(node, isStatic) {
var properties = [];
for (var _a = 0, _b = node.members; _a < _b.length; _a++) {
var member = _b[_a];
if (member.kind === 133 /* PropertyDeclaration */ && static === ((member.flags & 128 /* Static */) !== 0) && member.initializer) {
if (member.kind === 133 /* PropertyDeclaration */ && isStatic === ((member.flags & 128 /* Static */) !== 0) && member.initializer) {
properties.push(member);
}
}
@@ -27535,6 +27594,7 @@ var ts;
writeLine();
emitToken(15 /* CloseBraceToken */, node.members.end);
scopeEmitEnd();
// TODO(rbuckton): Need to go back to `let _a = class C {}` approach, removing the defineProperty call for now.
// For a decorated class, we need to assign its name (if it has one). This is because we emit
// the class as a class expression to avoid the double-binding of the identifier:
//
@@ -27544,15 +27604,6 @@ var ts;
//
if (thisNodeIsDecorated) {
write(";");
if (node.name) {
writeLine();
write("Object.defineProperty(");
emitDeclarationName(node);
write(", \"name\", { value: \"");
emitDeclarationName(node);
write("\", configurable: true });");
writeLine();
}
}
// Emit static property assignment. Because classDeclaration is lexically evaluated,
// it is safe to emit static property assignment after classDeclaration
@@ -29368,11 +29419,11 @@ var ts;
}
}
function hasDetachedComments(pos) {
return detachedCommentsInfo !== undefined && detachedCommentsInfo[detachedCommentsInfo.length - 1].nodePos === pos;
return detachedCommentsInfo !== undefined && ts.lastOrUndefined(detachedCommentsInfo).nodePos === pos;
}
function getLeadingCommentsWithoutDetachedComments() {
// get the leading comments from detachedPos
var leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, detachedCommentsInfo[detachedCommentsInfo.length - 1].detachedCommentEndPos);
var leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, ts.lastOrUndefined(detachedCommentsInfo).detachedCommentEndPos);
if (detachedCommentsInfo.length - 1) {
detachedCommentsInfo.pop();
}
@@ -29473,13 +29524,13 @@ var ts;
// All comments look like they could have been part of the copyright header. Make
// sure there is at least one blank line between it and the node. If not, it's not
// a copyright header.
var lastCommentLine = ts.getLineOfLocalPosition(currentSourceFile, detachedComments[detachedComments.length - 1].end);
var lastCommentLine = ts.getLineOfLocalPosition(currentSourceFile, ts.lastOrUndefined(detachedComments).end);
var nodeLine = ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.pos));
if (nodeLine >= lastCommentLine + 2) {
// Valid detachedComments
ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments);
ts.emitComments(currentSourceFile, writer, detachedComments, true, newLine, writeComment);
var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: detachedComments[detachedComments.length - 1].end };
var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: ts.lastOrUndefined(detachedComments).end };
if (detachedCommentsInfo) {
detachedCommentsInfo.push(currentDetachedCommentInfo);
}
@@ -29521,6 +29572,8 @@ var ts;
/* @internal */ ts.ioWriteTime = 0;
/** The version of the TypeScript compiler release */
ts.version = "1.5.0";
var carriageReturnLineFeed = "\r\n";
var lineFeed = "\n";
function findConfigFile(searchPath) {
var fileName = "tsconfig.json";
while (true) {
@@ -29594,6 +29647,9 @@ var ts;
}
}
}
var newLine = options.newLine === 0 /* CarriageReturnLineFeed */ ? carriageReturnLineFeed :
options.newLine === 1 /* LineFeed */ ? lineFeed :
ts.sys.newLine;
return {
getSourceFile: getSourceFile,
getDefaultLibFileName: function (options) { return ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())), ts.getDefaultLibFileName(options)); },
@@ -29601,7 +29657,7 @@ var ts;
getCurrentDirectory: function () { return currentDirectory || (currentDirectory = ts.sys.getCurrentDirectory()); },
useCaseSensitiveFileNames: function () { return ts.sys.useCaseSensitiveFileNames; },
getCanonicalFileName: getCanonicalFileName,
getNewLine: function () { return ts.sys.newLine; }
getNewLine: function () { return newLine; }
};
}
ts.createCompilerHost = createCompilerHost;
@@ -30119,6 +30175,16 @@ var ts;
paramType: ts.Diagnostics.KIND,
error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_amd_system_or_umd
},
{
name: "newLine",
type: {
"crlf": 0 /* CarriageReturnLineFeed */,
"lf": 1 /* LineFeed */
},
description: ts.Diagnostics.Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix,
paramType: ts.Diagnostics.NEWLINE,
error: ts.Diagnostics.Argument_for_newLine_option_must_be_CRLF_or_LF
},
{
name: "noEmit",
type: "boolean",
@@ -32529,7 +32595,7 @@ var ts;
function nodeEndsWith(n, expectedLastToken, sourceFile) {
var children = n.getChildren(sourceFile);
if (children.length) {
var last = children[children.length - 1];
var last = ts.lastOrUndefined(children);
if (last.kind === expectedLastToken) {
return true;
}
@@ -33023,7 +33089,7 @@ var ts;
if (isStarted) {
if (trailingTrivia) {
ts.Debug.assert(trailingTrivia.length !== 0);
wasNewLine = trailingTrivia[trailingTrivia.length - 1].kind === 4 /* NewLineTrivia */;
wasNewLine = ts.lastOrUndefined(trailingTrivia).kind === 4 /* NewLineTrivia */;
}
else {
wasNewLine = false;
@@ -34482,6 +34548,8 @@ var ts;
var previousRange;
var previousParent;
var previousRangeStartLine;
var lastIndentedLine;
var indentationOnLastIndentedLine;
var edits = [];
formattingScanner.advance();
if (formattingScanner.isOnToken()) {
@@ -34551,7 +34619,9 @@ var ts;
// if node is located on the same line with the parent
// - inherit indentation from the parent
// - push children if either parent of node itself has non-zero delta
indentation = parentDynamicIndentation.getIndentation();
indentation = startLine === lastIndentedLine
? indentationOnLastIndentedLine
: parentDynamicIndentation.getIndentation();
delta = Math.min(options.IndentSize, parentDynamicIndentation.getDelta() + delta);
}
return {
@@ -34799,7 +34869,6 @@ var ts;
if (!ts.rangeContainsRange(originalRange, triviaItem)) {
continue;
}
var triviaStartLine = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos).line;
switch (triviaItem.kind) {
case 3 /* MultiLineCommentTrivia */:
var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind);
@@ -34823,6 +34892,8 @@ var ts;
if (isTokenInRange && !rangeContainsError(currentTokenInfo.token)) {
var tokenIndentation = dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind);
insertIndentation(currentTokenInfo.token.pos, tokenIndentation, lineAdded);
lastIndentedLine = tokenStart.line;
indentationOnLastIndentedLine = tokenIndentation;
}
}
formattingScanner.advance();
@@ -38055,22 +38126,6 @@ var ts;
}
return ScriptElementKind.unknown;
}
function getTypeKind(type) {
var flags = type.getFlags();
if (flags & 128 /* Enum */)
return ScriptElementKind.enumElement;
if (flags & 1024 /* Class */)
return ScriptElementKind.classElement;
if (flags & 2048 /* Interface */)
return ScriptElementKind.interfaceElement;
if (flags & 512 /* TypeParameter */)
return ScriptElementKind.typeParameterElement;
if (flags & 1048703 /* Intrinsic */)
return ScriptElementKind.primitiveType;
if (flags & 256 /* StringLiteral */)
return ScriptElementKind.primitiveType;
return ScriptElementKind.unknown;
}
function getSymbolModifiers(symbol) {
return symbol && symbol.declarations && symbol.declarations.length > 0
? ts.getNodeModifiers(symbol.declarations[0])
@@ -38453,6 +38508,62 @@ var ts;
containerName: containerName
};
}
function getDefinitionFromSymbol(symbol, node) {
var typeChecker = program.getTypeChecker();
var result = [];
var declarations = symbol.getDeclarations();
var symbolName = typeChecker.symbolToString(symbol); // Do not get scoped name, just the name of the symbol
var symbolKind = getSymbolKind(symbol, node);
var containerSymbol = symbol.parent;
var containerName = containerSymbol ? typeChecker.symbolToString(containerSymbol, node) : "";
if (!tryAddConstructSignature(symbol, node, symbolKind, symbolName, containerName, result) &&
!tryAddCallSignature(symbol, node, symbolKind, symbolName, containerName, result)) {
// Just add all the declarations.
ts.forEach(declarations, function (declaration) {
result.push(createDefinitionInfo(declaration, symbolKind, symbolName, containerName));
});
}
return result;
function tryAddConstructSignature(symbol, location, symbolKind, symbolName, containerName, result) {
// Applicable only if we are in a new expression, or we are on a constructor declaration
// and in either case the symbol has a construct signature definition, i.e. class
if (isNewExpressionTarget(location) || location.kind === 114 /* ConstructorKeyword */) {
if (symbol.flags & 32 /* Class */) {
var classDeclaration = symbol.getDeclarations()[0];
ts.Debug.assert(classDeclaration && classDeclaration.kind === 202 /* ClassDeclaration */);
return tryAddSignature(classDeclaration.members, true, symbolKind, symbolName, containerName, result);
}
}
return false;
}
function tryAddCallSignature(symbol, location, symbolKind, symbolName, containerName, result) {
if (isCallExpressionTarget(location) || isNewExpressionTarget(location) || isNameOfFunctionDeclaration(location)) {
return tryAddSignature(symbol.declarations, false, symbolKind, symbolName, containerName, result);
}
return false;
}
function tryAddSignature(signatureDeclarations, selectConstructors, symbolKind, symbolName, containerName, result) {
var declarations = [];
var definition;
ts.forEach(signatureDeclarations, function (d) {
if ((selectConstructors && d.kind === 136 /* Constructor */) ||
(!selectConstructors && (d.kind === 201 /* FunctionDeclaration */ || d.kind === 135 /* MethodDeclaration */ || d.kind === 134 /* MethodSignature */))) {
declarations.push(d);
if (d.body)
definition = d;
}
});
if (definition) {
result.push(createDefinitionInfo(definition, symbolKind, symbolName, containerName));
return true;
}
else if (declarations.length) {
result.push(createDefinitionInfo(ts.lastOrUndefined(declarations), symbolKind, symbolName, containerName));
return true;
}
return false;
}
}
/// Goto definition
function getDefinitionAtPosition(fileName, position) {
synchronizeHostData();
@@ -38516,59 +38627,38 @@ var ts;
var shorthandContainerName = typeChecker.symbolToString(symbol.parent, node);
return ts.map(shorthandDeclarations, function (declaration) { return createDefinitionInfo(declaration, shorthandSymbolKind, shorthandSymbolName, shorthandContainerName); });
}
var result = [];
var declarations = symbol.getDeclarations();
var symbolName = typeChecker.symbolToString(symbol); // Do not get scoped name, just the name of the symbol
var symbolKind = getSymbolKind(symbol, node);
var containerSymbol = symbol.parent;
var containerName = containerSymbol ? typeChecker.symbolToString(containerSymbol, node) : "";
if (!tryAddConstructSignature(symbol, node, symbolKind, symbolName, containerName, result) &&
!tryAddCallSignature(symbol, node, symbolKind, symbolName, containerName, result)) {
// Just add all the declarations.
ts.forEach(declarations, function (declaration) {
result.push(createDefinitionInfo(declaration, symbolKind, symbolName, containerName));
});
return getDefinitionFromSymbol(symbol, node);
}
/// Goto type
function getTypeDefinitionAtPosition(fileName, position) {
synchronizeHostData();
var sourceFile = getValidSourceFile(fileName);
var node = ts.getTouchingPropertyName(sourceFile, position);
if (!node) {
return undefined;
}
return result;
function tryAddConstructSignature(symbol, location, symbolKind, symbolName, containerName, result) {
// Applicable only if we are in a new expression, or we are on a constructor declaration
// and in either case the symbol has a construct signature definition, i.e. class
if (isNewExpressionTarget(location) || location.kind === 114 /* ConstructorKeyword */) {
if (symbol.flags & 32 /* Class */) {
var classDeclaration = symbol.getDeclarations()[0];
ts.Debug.assert(classDeclaration && classDeclaration.kind === 202 /* ClassDeclaration */);
return tryAddSignature(classDeclaration.members, true, symbolKind, symbolName, containerName, result);
}
}
return false;
var typeChecker = program.getTypeChecker();
var symbol = typeChecker.getSymbolAtLocation(node);
if (!symbol) {
return undefined;
}
function tryAddCallSignature(symbol, location, symbolKind, symbolName, containerName, result) {
if (isCallExpressionTarget(location) || isNewExpressionTarget(location) || isNameOfFunctionDeclaration(location)) {
return tryAddSignature(symbol.declarations, false, symbolKind, symbolName, containerName, result);
}
return false;
var type = typeChecker.getTypeOfSymbolAtLocation(symbol, node);
if (!type) {
return undefined;
}
function tryAddSignature(signatureDeclarations, selectConstructors, symbolKind, symbolName, containerName, result) {
var declarations = [];
var definition;
ts.forEach(signatureDeclarations, function (d) {
if ((selectConstructors && d.kind === 136 /* Constructor */) ||
(!selectConstructors && (d.kind === 201 /* FunctionDeclaration */ || d.kind === 135 /* MethodDeclaration */ || d.kind === 134 /* MethodSignature */))) {
declarations.push(d);
if (d.body)
definition = d;
if (type.flags & 16384 /* Union */) {
var result = [];
ts.forEach(type.types, function (t) {
if (t.symbol) {
result.push.apply(result, getDefinitionFromSymbol(t.symbol, node));
}
});
if (definition) {
result.push(createDefinitionInfo(definition, symbolKind, symbolName, containerName));
return true;
}
else if (declarations.length) {
result.push(createDefinitionInfo(declarations[declarations.length - 1], symbolKind, symbolName, containerName));
return true;
}
return false;
return result;
}
if (!type.symbol) {
return undefined;
}
return getDefinitionFromSymbol(type.symbol, node);
}
function getOccurrencesAtPosition(fileName, position) {
var results = getOccurrencesAtPositionCore(fileName, position);
@@ -40613,6 +40703,7 @@ var ts;
getSignatureHelpItems: getSignatureHelpItems,
getQuickInfoAtPosition: getQuickInfoAtPosition,
getDefinitionAtPosition: getDefinitionAtPosition,
getTypeDefinitionAtPosition: getTypeDefinitionAtPosition,
getReferencesAtPosition: getReferencesAtPosition,
findReferences: findReferences,
getOccurrencesAtPosition: getOccurrencesAtPosition,
@@ -41498,14 +41589,14 @@ var ts;
}
// fall through.
case 224 /* CatchClause */:
return spanInNode(node.parent.statements[node.parent.statements.length - 1]);
return spanInNode(ts.lastOrUndefined(node.parent.statements));
;
case 208 /* CaseBlock */:
// breakpoint in last statement of the last clause
var caseBlock = node.parent;
var lastClause = caseBlock.clauses[caseBlock.clauses.length - 1];
var lastClause = ts.lastOrUndefined(caseBlock.clauses);
if (lastClause) {
return spanInNode(lastClause.statements[lastClause.statements.length - 1]);
return spanInNode(ts.lastOrUndefined(lastClause.statements));
}
return undefined;
// Default to parent node
@@ -41571,7 +41662,7 @@ var ts;
})(ts || (ts = {}));
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
@@ -41909,6 +42000,17 @@ var ts;
return _this.languageService.getDefinitionAtPosition(fileName, position);
});
};
/// GOTO Type
/**
* Computes the definition location of the type of the symbol
* at the requested position.
*/
LanguageServiceShimObject.prototype.getTypeDefinitionAtPosition = function (fileName, position) {
var _this = this;
return this.forwardJSONCall("getTypeDefinitionAtPosition('" + fileName + "', " + position + ")", function () {
return _this.languageService.getTypeDefinitionAtPosition(fileName, position);
});
};
LanguageServiceShimObject.prototype.getRenameInfo = function (fileName, position) {
var _this = this;
return this.forwardJSONCall("getRenameInfo('" + fileName + "', " + position + ")", function () {
@@ -42130,7 +42232,7 @@ var ts;
return {
options: configFile.options,
files: configFile.fileNames,
errors: realizeDiagnostics(configFile.errors, '\r\n')
errors: [realizeDiagnostics(configFile.errors, '\r\n')]
};
});
};
+274 -144
View File
@@ -88,12 +88,11 @@ module ts {
let undefinedType = createIntrinsicType(TypeFlags.Undefined | TypeFlags.ContainsUndefinedOrNull, "undefined");
let nullType = createIntrinsicType(TypeFlags.Null | TypeFlags.ContainsUndefinedOrNull, "null");
let unknownType = createIntrinsicType(TypeFlags.Any, "unknown");
let resolvingType = createIntrinsicType(TypeFlags.Any, "__resolving__");
let emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
let anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
let noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
let anySignature = createSignature(undefined, undefined, emptyArray, anyType, 0, false, false);
let unknownSignature = createSignature(undefined, undefined, emptyArray, unknownType, 0, false, false);
@@ -135,6 +134,9 @@ module ts {
let emitAwaiter = false;
let emitGenerator = false;
let resolutionTargets: Object[] = [];
let resolutionResults: boolean[] = [];
let mergedSymbols: Symbol[] = [];
let symbolLinks: SymbolLinks[] = [];
let nodeLinks: NodeLinks[] = [];
@@ -359,9 +361,9 @@ module ts {
}
else if (location.kind === SyntaxKind.SourceFile ||
(location.kind === SyntaxKind.ModuleDeclaration && (<ModuleDeclaration>location).name.kind === SyntaxKind.StringLiteral)) {
result = getSymbol(getSymbolOfNode(location).exports, "default", meaning & SymbolFlags.ModuleMember);
result = getSymbolOfNode(location).exports["default"];
let localSymbol = getLocalSymbolForExportDefault(result);
if (result && (result.flags & meaning) && localSymbol && localSymbol.name === name) {
if (result && localSymbol && (result.flags & meaning) && localSymbol.name === name) {
break loop;
}
result = undefined;
@@ -810,7 +812,9 @@ module ts {
let symbol: Symbol;
if (name.kind === SyntaxKind.Identifier) {
symbol = resolveName(name, (<Identifier>name).text, meaning, Diagnostics.Cannot_find_name_0, <Identifier>name);
let message = meaning === SymbolFlags.Namespace ? Diagnostics.Cannot_find_namespace_0 : Diagnostics.Cannot_find_name_0;
symbol = resolveName(name, (<Identifier>name).text, meaning, message, <Identifier>name);
if (!symbol) {
return undefined;
}
@@ -1989,7 +1993,7 @@ module ts {
}
}
function collectLinkedAliases(node: Identifier): Node[]{
function collectLinkedAliases(node: Identifier): Node[] {
var exportSymbol: Symbol;
if (node.parent && node.parent.kind === SyntaxKind.ExportAssignment) {
exportSymbol = resolveName(node.parent, node.text, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace, Diagnostics.Cannot_find_name_0, node);
@@ -2023,6 +2027,38 @@ module 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;
}
while (i < count);
return false;
}
resolutionTargets.push(target);
resolutionResults.push(true);
return true;
}
// 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();
return resolutionResults.pop();
}
function getRootDeclaration(node: Node): Node {
while (node.kind === SyntaxKind.BindingElement) {
node = node.parent.parent;
@@ -2280,20 +2316,27 @@ module ts {
return links.type = checkExpression((<ExportAssignment>declaration).expression);
}
// Handle variable, parameter or property
links.type = resolvingType;
if (!pushTypeResolution(symbol)) {
return unknownType;
}
let type = getWidenedTypeForVariableLikeDeclaration(<VariableLikeDeclaration>declaration, /*reportErrors*/ true);
if (links.type === resolvingType) {
links.type = type;
}
}
else if (links.type === resolvingType) {
links.type = anyType;
if (compilerOptions.noImplicitAny) {
let diagnostic = (<VariableLikeDeclaration>symbol.valueDeclaration).type ?
Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation :
Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer;
error(symbol.valueDeclaration, diagnostic, symbolToString(symbol));
if (!popTypeResolution()) {
if ((<VariableLikeDeclaration>symbol.valueDeclaration).type) {
// Variable has type annotation that circularly references the variable itself
type = unknownType;
error(symbol.valueDeclaration, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation,
symbolToString(symbol));
}
else {
// Variable has initializer that circularly references the variable itself
type = anyType;
if (compilerOptions.noImplicitAny) {
error(symbol.valueDeclaration, Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer,
symbolToString(symbol));
}
}
}
links.type = type;
}
return links.type;
}
@@ -2317,19 +2360,13 @@ module ts {
function getTypeOfAccessors(symbol: Symbol): Type {
let links = getSymbolLinks(symbol);
checkAndStoreTypeOfAccessors(symbol, links);
return links.type;
}
function checkAndStoreTypeOfAccessors(symbol: Symbol, links?: SymbolLinks) {
links = links || getSymbolLinks(symbol);
if (!links.type) {
links.type = resolvingType;
if (!pushTypeResolution(symbol)) {
return unknownType;
}
let getter = <AccessorDeclaration>getDeclarationOfKind(symbol, SyntaxKind.GetAccessor);
let setter = <AccessorDeclaration>getDeclarationOfKind(symbol, SyntaxKind.SetAccessor);
let type: Type;
// First try to see if the user specified a return type on the get-accessor.
let getterReturnType = getAnnotatedAccessorType(getter);
if (getterReturnType) {
@@ -2351,23 +2388,20 @@ module ts {
if (compilerOptions.noImplicitAny) {
error(setter, Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation, symbolToString(symbol));
}
type = anyType;
}
}
}
if (links.type === resolvingType) {
links.type = type;
}
}
else if (links.type === resolvingType) {
links.type = anyType;
if (compilerOptions.noImplicitAny) {
let getter = <AccessorDeclaration>getDeclarationOfKind(symbol, SyntaxKind.GetAccessor);
error(getter, Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol));
if (!popTypeResolution()) {
type = anyType;
if (compilerOptions.noImplicitAny) {
let getter = <AccessorDeclaration>getDeclarationOfKind(symbol, SyntaxKind.GetAccessor);
error(getter, Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol));
}
}
links.type = type;
}
return links.type;
}
function getTypeOfFuncClassEnumModule(symbol: Symbol): Type {
@@ -2460,7 +2494,7 @@ module ts {
return result;
}
function getBaseTypes(type: InterfaceType): ObjectType[]{
function getBaseTypes(type: InterfaceType): ObjectType[] {
let typeWithBaseTypes = <InterfaceTypeWithBaseTypes>type;
if (!typeWithBaseTypes.baseTypes) {
if (type.symbol.flags & SymbolFlags.Class) {
@@ -2545,17 +2579,18 @@ module ts {
function getDeclaredTypeOfTypeAlias(symbol: Symbol): Type {
let links = getSymbolLinks(symbol);
if (!links.declaredType) {
links.declaredType = resolvingType;
// 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)) {
return unknownType;
}
let declaration = <TypeAliasDeclaration>getDeclarationOfKind(symbol, SyntaxKind.TypeAliasDeclaration);
let type = getTypeFromTypeNode(declaration.type);
if (links.declaredType === resolvingType) {
links.declaredType = type;
if (!popTypeResolution()) {
type = unknownType;
error(declaration.name, Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
}
}
else if (links.declaredType === resolvingType) {
links.declaredType = unknownType;
let declaration = <TypeAliasDeclaration>getDeclarationOfKind(symbol, SyntaxKind.TypeAliasDeclaration);
error(declaration.name, Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
links.declaredType = type;
}
return links.declaredType;
}
@@ -3159,7 +3194,9 @@ module ts {
function getReturnTypeOfSignature(signature: Signature): Type {
if (!signature.resolvedReturnType) {
signature.resolvedReturnType = resolvingType;
if (!pushTypeResolution(signature)) {
return unknownType;
}
let type: Type;
if (signature.target) {
type = instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper);
@@ -3170,21 +3207,19 @@ module ts {
else {
type = getReturnTypeFromBody(<FunctionLikeDeclaration>signature.declaration);
}
if (signature.resolvedReturnType === resolvingType) {
signature.resolvedReturnType = type;
}
}
else if (signature.resolvedReturnType === resolvingType) {
signature.resolvedReturnType = anyType;
if (compilerOptions.noImplicitAny) {
let declaration = <Declaration>signature.declaration;
if (declaration.name) {
error(declaration.name, Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, declarationNameToString(declaration.name));
}
else {
error(declaration, Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions);
if (!popTypeResolution()) {
type = anyType;
if (compilerOptions.noImplicitAny) {
let declaration = <Declaration>signature.declaration;
if (declaration.name) {
error(declaration.name, Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, declarationNameToString(declaration.name));
}
else {
error(declaration, Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions);
}
}
}
signature.resolvedReturnType = type;
}
return signature.resolvedReturnType;
}
@@ -5362,17 +5397,35 @@ module ts {
}
// Target type is type of prototype property
let prototypeProperty = getPropertyOfType(rightType, "prototype");
if (!prototypeProperty) {
return type;
if (prototypeProperty) {
let targetType = getTypeOfSymbol(prototypeProperty);
if (targetType !== anyType) {
// Narrow to the target type if it's a subtype of the current type
if (isTypeSubtypeOf(targetType, type)) {
return targetType;
}
// If the current type is a union type, remove all constituents that aren't subtypes of the target.
if (type.flags & TypeFlags.Union) {
return getUnionType(filter((<UnionType>type).types, t => isTypeSubtypeOf(t, targetType)));
}
}
}
let targetType = getTypeOfSymbol(prototypeProperty);
// Narrow to target type if it is a subtype of current type
if (isTypeSubtypeOf(targetType, type)) {
return targetType;
// Target type is type of construct signature
let constructSignatures: Signature[];
if (rightType.flags & TypeFlags.Interface) {
constructSignatures = resolveDeclaredMembers(<InterfaceType>rightType).declaredConstructSignatures;
}
// If current type is a union type, remove all constituents that aren't subtypes of target type
if (type.flags & TypeFlags.Union) {
return getUnionType(filter((<UnionType>type).types, t => isTypeSubtypeOf(t, targetType)));
else if (rightType.flags & TypeFlags.Anonymous) {
constructSignatures = getSignaturesOfType(rightType, SignatureKind.Construct);
}
if (constructSignatures && constructSignatures.length !== 0) {
let instanceType = getUnionType(map(constructSignatures, signature => getReturnTypeOfSignature(getErasedSignature(signature))));
// Pickup type from union types
if (type.flags & TypeFlags.Union) {
return getUnionType(filter((<UnionType>type).types, t => isTypeSubtypeOf(t, instanceType)));
}
return instanceType;
}
return type;
}
@@ -7250,7 +7303,9 @@ module ts {
if (globalPromiseType !== emptyObjectType) {
// if the promised type is itself a promise, get the underlying type; otherwise, fallback to the promised type
promisedType = getAwaitedType(promisedType);
return createTypeReference(<GenericType>globalPromiseType, [promisedType]);
if (promisedType !== unknownType) {
return createTypeReference(<GenericType>globalPromiseType, [promisedType]);
}
}
error(location, Diagnostics.An_async_function_or_method_must_have_a_valid_awaitable_return_type);
@@ -7266,17 +7321,23 @@ module ts {
let isAsync = isAsyncFunctionLike(func);
let type: Type;
if (func.body.kind !== SyntaxKind.Block) {
type = isAsync
? checkAwaitedExpressionCached(<Expression>func.body, contextualMapper)
: checkExpressionCached(<Expression>func.body, contextualMapper);
if (isAsync) {
type = checkAwaitedExpressionCached(<Expression>func.body, contextualMapper);
}
else {
type = checkExpressionCached(<Expression>func.body, contextualMapper);
}
}
else {
// Aggregate the types of expressions within all the return statements.
let types = checkAndAggregateReturnExpressionTypes(<Block>func.body, contextualMapper);
if (types.length === 0) {
return isAsync
? createPromiseType(voidType, func)
: voidType;
if (isAsync) {
return createPromiseType(voidType, func);
}
else {
return voidType;
}
}
// When return statements are contextually typed we allow the return type to be a union type. Otherwise we require the
@@ -7287,14 +7348,18 @@ module ts {
return unknownType;
}
}
if (!contextualSignature) {
reportErrorsFromWidening(func, type);
}
let widenedType = getWidenedType(type);
return isAsync
? createPromiseType(widenedType, func)
: widenedType;
if (isAsync) {
return createPromiseType(widenedType, func);
}
else {
return widenedType;
}
}
/// Returns a set of types relating to every return expression relating to a function block.
@@ -7304,9 +7369,14 @@ module ts {
forEachReturnStatement(body, returnStatement => {
let expr = returnStatement.expression;
if (expr) {
let type = isAsync
? checkAwaitedExpressionCached(expr, contextualMapper)
: checkExpressionCached(expr, contextualMapper);
let type: Type;
if (isAsync) {
type = checkAwaitedExpressionCached(expr, contextualMapper);
}
else {
type = checkExpressionCached(expr, contextualMapper);
}
if (!contains(aggregatedTypes, type)) {
aggregatedTypes.push(type);
}
@@ -7397,10 +7467,9 @@ module ts {
if (isContextSensitive(node)) {
assignContextualParameterTypes(signature, contextualSignature, contextualMapper || identityMapper);
}
if (!node.type) {
signature.resolvedReturnType = resolvingType;
if (!node.type && !signature.resolvedReturnType) {
let returnType = getReturnTypeFromBody(node, contextualMapper);
if (signature.resolvedReturnType === resolvingType) {
if (!signature.resolvedReturnType) {
signature.resolvedReturnType = returnType;
}
}
@@ -7443,10 +7512,12 @@ module ts {
else {
let exprType = checkExpression(<Expression>node.body);
if (returnType) {
checkTypeAssignableTo(
isAsync ? getAwaitedType(exprType) : exprType,
isAsync ? promisedType : returnType,
node.body);
if (isAsync) {
checkTypeAssignableTo(getAwaitedType(exprType, node.body), promisedType, node.body);
}
else {
checkTypeAssignableTo(exprType, returnType, node.body);
}
}
checkFunctionExpressionBodies(node.body);
}
@@ -7564,11 +7635,11 @@ module ts {
function checkAwaitExpression(node: AwaitExpression): Type {
// Grammar checking
if (!(node.parserContextFlags & ParserContextFlags.Await)) {
grammarErrorOnFirstToken(node, Diagnostics.await_expression_must_be_contained_within_an_async_function);
grammarErrorOnFirstToken(node, Diagnostics.await_expression_is_only_allowed_within_an_async_function);
}
var operandType = checkExpression(node.expression);
return getAwaitedType(operandType);
let operandType = checkExpression(node.expression);
return getAwaitedType(operandType, node);
}
function checkPrefixUnaryExpression(node: PrefixUnaryExpression): Type {
@@ -8270,13 +8341,14 @@ module ts {
break;
}
}
if (isAsyncFunctionLike(node)) {
var promiseConstructor = getPromiseConstructor(node);
if (promiseConstructor) {
var promiseIdentifier = getFirstIdentifier(promiseConstructor);
var promiseName = promiseIdentifier.text;
var typeSymbol = resolveName(node, promiseName, SymbolFlags.Type | SymbolFlags.Module, undefined, undefined);
var valueSymbol = resolveName(node, promiseName, SymbolFlags.Value, undefined, undefined);
var typeSymbol = resolveName(node, promiseName, SymbolFlags.Type | SymbolFlags.Module, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined);
var valueSymbol = resolveName(node, promiseName, SymbolFlags.Value, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined);
if (typeSymbol !== valueSymbol) {
var valueLinks = getNodeLinks(valueSymbol.valueDeclaration);
if (!(valueLinks.flags & NodeCheckFlags.PromiseCollision)) {
@@ -8468,8 +8540,7 @@ module ts {
}
}
}
checkAndStoreTypeOfAccessors(getSymbolOfNode(node));
getTypeOfAccessors(getSymbolOfNode(node));
}
checkFunctionLikeDeclaration(node);
@@ -8881,8 +8952,28 @@ module ts {
}
}
function checkNonThenableType(type: Type, location?: Node, message?: DiagnosticMessage) {
if (!(type.flags & TypeFlags.Any) && isTypeAssignableTo(type, getGlobalThenableType())) {
if (location) {
if (!message) {
message = Diagnostics.Operand_for_await_does_not_have_a_valid_callable_then_member;
}
error(location, message);
}
return false;
}
return true;
}
/**
* Gets the "promised type" of a promise.
* @param type The type of the promise.
* @remarks The "promised type" of a type is the type of the "value" argument of the "onfulfilled" callback.
*/
function getPromisedType(type: Type): Type {
// the "promised type" of a type is the type of the "value" argument of the "onfulfilled" callback.
let globalPromiseLikeType = getInstantiatedGlobalPromiseLikeType();
if (globalPromiseLikeType !== emptyObjectType && isTypeAssignableTo(type, globalPromiseLikeType)) {
let thenProp = getPropertyOfType(type, "then");
@@ -8903,67 +8994,100 @@ module ts {
}
return getUnionType(awaitedTypes);
}
}
}
return emptyObjectType;
return unknownType;
}
function getAwaitedType(type: Type): Type {
// The "awaited type" of an expression is its "promised type" if the expression is a `Promise`; otherwise, it is the type of the expression.
/**
* Gets the "awaited type" of a type.
* @param type The type to await.
* @remarks The "awaited type" of an expression is its "promised type" if the expression is a
* Promise-like type; otherwise, it is the type of the expression. This is used to reflect
* The runtime behavior of the `await` keyword.
*/
function getAwaitedType(type: Type, location?: Node): Type {
let promisedType = getPromisedType(type);
if (promisedType === emptyObjectType) {
return type;
if (promisedType === unknownType) {
// if we got the unknown type, the type wasn't a promise. We need to check to
// ensure it is not a thenable.
if (checkNonThenableType(type, location)) {
return type;
}
return unknownType;
}
else if (promisedType === type) {
// if we have a bad actor in the form of a promise whose promised type is the same
// promise, return the unknown type as we cannot guess the shape.
// if this were the actual case in the JavaScript, this Promise would never resolve.
if (location) {
error(location, Diagnostics.Operand_for_await_does_not_have_a_valid_callable_then_member);
}
return unknownType;
}
// if we have a bad actor in the form of a promise whose promised type is the same promise, return the empty type.
// if this were the actual case in the JavaScript, this Promise would never resolve.
if (promisedType === type) {
return emptyObjectType;
}
// `seen` keeps track of types we've tried to await to avoid cycles.
// This is to protect against a bad actor with a mutually recursive promised type:
//
// declare class PromiseA {
// then(onfulfilled: (value: PromiseB) => any, onrejected?);
// }
// declare class PromiseB {
// then(onfulfilled: (value: PromiseA) => any, onrejected?);
// }
//
let seen: boolean[];
// unwrap any nested promises
let seen: boolean[];
while (true) {
let nestedPromisedType = getPromisedType(promisedType);
if (nestedPromisedType === emptyObjectType) {
// if this could not be unwrapped further, return the promised type
return promisedType;
if (nestedPromisedType === unknownType) {
// this type could not be unwrapped further. We need to check to
// ensure it is not a thenable
if (checkNonThenableType(promisedType, location)) {
return promisedType;
}
return unknownType;
}
if (!seen) {
// `seen` keeps track of types we've tried to await to avoid cycles
seen = [];
seen[type.id] = true;
seen[promisedType.id] = true;
}
else if (seen[nestedPromisedType.id]) {
// if we've already seen this type, this is a promise that would never resolve. As above, we return the empty type.
return emptyObjectType;
// if we've already seen this type, this is a promise that
// would never resolve. As above, we return the unknown type.
if (location) {
error(location, Diagnostics.Operand_for_await_does_not_have_a_valid_callable_then_member);
}
return unknownType;
}
seen[nestedPromisedType.id] = true;
promisedType = nestedPromisedType;
}
return promisedType;
// if we didn't get a promised type, check the type does not have a callable then member.
if (isTypeAssignableTo(type, getGlobalThenableType())) {
error(null, Diagnostics.Type_for_await_does_not_have_a_valid_callable_then_member);
return emptyObjectType;
}
// if the type was not a "promise" or a "thenable", return the type.
return type;
}
function checkAsyncFunctionReturnType(node: SignatureDeclaration, returnType: Type): Type {
// This checks that an async function has a valid Promise-compatible return type, and returns the *awaited type* of the promise.
// An async function has a valid Promise-compatible return type if the resolved value of the return type has a construct
// signature that takes in an `initializer` function that in turn supplies a `resolve` function as one of its arguments
// and results in an object with a callable `then` signature.
/**
* Checks the return type of an async function to ensure it is a compatible
* Promise implementation.
* @param node The signature to check
* @param returnType The return type for the function
* @remarks
* This checks that an async function has a valid Promise-compatible return type,
* and returns the *awaited type* of the promise. An async function has a valid
* Promise-compatible return type if the resolved value of the return type has a
* construct signature that takes in an `initializer` function that in turn supplies
* a `resolve` function as one of its arguments and results in an object with a
* callable `then` signature.
*/
function checkAsyncFunctionReturnType(node: SignatureDeclaration, returnType: Type): Type {
let globalPromiseConstructorLikeType = getGlobalPromiseConstructorLikeType();
if (globalPromiseConstructorLikeType !== emptyObjectType) {
if (!returnType) {
@@ -8971,23 +9095,24 @@ module ts {
}
// get the constructor type of the return type
var declaredType = returnType.symbol ? getTypeOfSymbol(returnType.symbol) : emptyObjectType;
let declaredType = returnType.symbol ? getTypeOfSymbol(returnType.symbol) : emptyObjectType;
if (isTypeAssignableTo(declaredType, globalPromiseConstructorLikeType)) {
var promisedType = getPromisedType(returnType);
if (promisedType !== emptyObjectType) {
let promisedType = getPromisedType(returnType);
if (promisedType !== unknownType) {
// unwrap the promised type
var promiseConstructor = getPromiseConstructor(node);
let promiseConstructor = getPromiseConstructor(node);
if (promiseConstructor) {
emitAwaiter = true;
checkExpressionOrQualifiedName(promiseConstructor);
return getAwaitedType(promisedType);
}
emitAwaiter = true;
return getAwaitedType(promisedType, node);
}
}
}
error(node, ts.Diagnostics.An_async_function_or_method_must_have_a_valid_awaitable_return_type);
return emptyObjectType;
return unknownType;
}
/** Check a decorator */
@@ -9944,6 +10069,9 @@ module ts {
if (node.parserContextFlags & ParserContextFlags.StrictMode) {
grammarErrorOnFirstToken(node, Diagnostics.with_statements_are_not_allowed_in_strict_mode);
}
else if (node.parserContextFlags & ParserContextFlags.Await) {
grammarErrorOnFirstToken(node, Diagnostics.with_statements_are_not_allowed_in_an_async_function_block);
}
}
checkExpression(node.expression);
@@ -12300,9 +12428,11 @@ module ts {
let thenPropertySymbol = createSymbol(SymbolFlags.Transient | SymbolFlags.Property, "then");
getSymbolLinks(thenPropertySymbol).type = globalFunctionType;
let thenableType = <ResolvedType>createObjectType(TypeFlags.ObjectType);
let thenableType = <ResolvedType>createObjectType(TypeFlags.Anonymous);
thenableType.properties = [thenPropertySymbol];
thenableType.members = createSymbolTable(thenableType.properties);
thenableType.callSignatures = [];
thenableType.constructSignatures = [];
return thenableType;
}
@@ -50,7 +50,7 @@ module ts {
A_get_accessor_cannot_have_parameters: { code: 1054, category: DiagnosticCategory.Error, key: "A 'get' accessor cannot have parameters." },
Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: DiagnosticCategory.Error, key: "Accessors are only available when targeting ECMAScript 5 and higher." },
An_async_function_or_method_must_have_a_valid_awaitable_return_type: { code: 1057, category: DiagnosticCategory.Error, key: "An async function or method must have a valid awaitable return type." },
Type_for_await_does_not_have_a_valid_callable_then_member: { code: 1058, category: DiagnosticCategory.Error, key: "Type for 'await' does not have a valid callable 'then' member." },
Operand_for_await_does_not_have_a_valid_callable_then_member: { code: 1058, category: DiagnosticCategory.Error, key: "Operand for 'await' does not have a valid callable 'then' member." },
Enum_member_must_have_initializer: { code: 1061, category: DiagnosticCategory.Error, key: "Enum member must have initializer." },
An_export_assignment_cannot_be_used_in_a_namespace: { code: 1063, category: DiagnosticCategory.Error, key: "An export assignment cannot be used in a namespace." },
Ambient_enum_elements_can_only_have_integer_literal_initializers: { code: 1066, category: DiagnosticCategory.Error, key: "Ambient enum elements can only have integer literal initializers." },
@@ -181,16 +181,7 @@ module ts {
Type_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: { code: 1216, category: DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode." },
Export_assignment_is_not_supported_when_module_flag_is_system: { code: 1218, category: DiagnosticCategory.Error, key: "Export assignment is not supported when '--module' flag is 'system'." },
with_statements_are_not_allowed_in_an_async_function_block: { code: 1300, category: DiagnosticCategory.Error, key: "'with' statements are not allowed in an async function block." },
_0_modifier_cannot_be_used_with_a_generator: { code: 1301, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot be used with a generator." },
_0_modifier_cannot_be_used_with_a_module_declaration: { code: 1302, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot be used with a module declaration." },
_0_modifier_cannot_be_used_with_an_enum_declaration: { code: 1303, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot be used with an enum declaration." },
_0_modifier_cannot_be_used_with_an_export_assignment_declaration: { code: 1304, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot be used with an export assignment declaration." },
_0_modifier_cannot_be_used_on_a_variable_statement: { code: 1305, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot be used on a variable statement." },
_0_modifier_cannot_be_used_with_a_type_declaration: { code: 1306, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot be used with a type declaration." },
_0_modifier_cannot_be_used_with_a_parameter_declaration: { code: 1307, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot be used with a parameter declaration." },
await_expression_must_be_contained_within_an_async_function: { code: 1308, category: DiagnosticCategory.Error, key: "'await' expression must be contained within an async function." },
_0_modifier_cannot_be_used_on_an_object_literal_element: { code: 1309, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot be used on an object literal element." },
_0_expression_is_not_allowed_in_an_initializer: { code: 1310, category: DiagnosticCategory.Error, key: "'{0}' expression is not allowed in an initializer." },
await_expression_is_only_allowed_within_an_async_function: { code: 1308, category: DiagnosticCategory.Error, key: "'await' expression is only allowed within an async function." },
Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1311, category: DiagnosticCategory.Error, key: "Async functions are only available when targeting ECMAScript 6 and higher." },
Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." },
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." },
@@ -381,6 +372,8 @@ module ts {
An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2499, category: DiagnosticCategory.Error, key: "An interface can only extend an identifier/qualified-name with optional type arguments." },
A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2500, category: DiagnosticCategory.Error, key: "A class can only implement an identifier/qualified-name with optional type arguments." },
A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: DiagnosticCategory.Error, key: "A rest element cannot contain a binding pattern." },
_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 2502, category: DiagnosticCategory.Error, key: "'{0}' is referenced directly or indirectly in its own type annotation." },
Cannot_find_namespace_0: { code: 2503, category: DiagnosticCategory.Error, key: "Cannot find namespace '{0}'." },
Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions: { code: 2520, category: 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: DiagnosticCategory.Error, key: "Expression resolves to variable declaration '{0}' that compiler uses to support async functions." },
The_arguments_object_cannot_be_referenced_in_an_async_arrow_function_Consider_using_a_standard_async_function_expression: { code: 2522, category: DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an async arrow function Consider using a standard async function expression." },
@@ -526,7 +519,6 @@ module ts {
Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { code: 6060, category: DiagnosticCategory.Message, key: "Specifies the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)." },
NEWLINE: { code: 6061, category: DiagnosticCategory.Message, key: "NEWLINE" },
Argument_for_newLine_option_must_be_CRLF_or_LF: { code: 6062, category: DiagnosticCategory.Error, key: "Argument for '--newLine' option must be 'CRLF' or 'LF'." },
Emit_async_functions_when_ECMAScript_target_version_is_lower_than_ES6: { code: 6063, category: DiagnosticCategory.Message, key: "Emit async functions when ECMAScript target version is lower than 'ES6'." },
Variable_0_implicitly_has_an_1_type: { code: 7005, category: DiagnosticCategory.Error, key: "Variable '{0}' implicitly has an '{1}' type." },
Parameter_0_implicitly_has_an_1_type: { code: 7006, category: DiagnosticCategory.Error, key: "Parameter '{0}' implicitly has an '{1}' type." },
Member_0_implicitly_has_an_1_type: { code: 7008, category: DiagnosticCategory.Error, key: "Member '{0}' implicitly has an '{1}' type." },
@@ -539,7 +531,6 @@ module ts {
Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: DiagnosticCategory.Error, key: "Object literal's property '{0}' implicitly has an '{1}' type." },
Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: DiagnosticCategory.Error, key: "Rest parameter '{0}' implicitly has an 'any[]' type." },
Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: DiagnosticCategory.Error, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." },
_0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 7021, category: DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." },
_0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." },
_0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: DiagnosticCategory.Error, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." },
Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: DiagnosticCategory.Error, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." },
+10 -46
View File
@@ -187,7 +187,7 @@
"category": "Error",
"code": 1057
},
"Type for 'await' does not have a valid callable 'then' member.": {
"Operand for 'await' does not have a valid callable 'then' member.": {
"category": "Error",
"code": 1058
},
@@ -712,46 +712,10 @@
"category": "Error",
"code": 1300
},
"'{0}' modifier cannot be used with a generator.": {
"category": "Error",
"code": 1301
},
"'{0}' modifier cannot be used with a module declaration.": {
"category": "Error",
"code": 1302
},
"'{0}' modifier cannot be used with an enum declaration.": {
"category": "Error",
"code": 1303
},
"'{0}' modifier cannot be used with an export assignment declaration.": {
"category": "Error",
"code": 1304
},
"'{0}' modifier cannot be used on a variable statement.": {
"category": "Error",
"code": 1305
},
"'{0}' modifier cannot be used with a type declaration.": {
"category": "Error",
"code": 1306
},
"'{0}' modifier cannot be used with a parameter declaration.": {
"category": "Error",
"code": 1307
},
"'await' expression must be contained within an async function.": {
"'await' expression is only allowed within an async function.": {
"category": "Error",
"code": 1308
},
"'{0}' modifier cannot be used on an object literal element.": {
"category": "Error",
"code": 1309
},
"'{0}' expression is not allowed in an initializer.": {
"category": "Error",
"code": 1310
},
"Async functions are only available when targeting ECMAScript 6 and higher.": {
"category": "Error",
"code": 1311
@@ -1513,6 +1477,14 @@
"category": "Error",
"code": 2501
},
"'{0}' is referenced directly or indirectly in its own type annotation.": {
"category": "Error",
"code": 2502
},
"Cannot find namespace '{0}'.": {
"category": "Error",
"code": 2503
},
"Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions.": {
"category": "Error",
@@ -2096,10 +2068,6 @@
"category": "Error",
"code": 6062
},
"Emit async functions when ECMAScript target version is lower than 'ES6'.": {
"category": "Message",
"code": 6063
},
"Variable '{0}' implicitly has an '{1}' type.": {
"category": "Error",
@@ -2149,10 +2117,6 @@
"category": "Error",
"code": 7020
},
"'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation.": {
"category": "Error",
"code": 7021
},
"'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer.": {
"category": "Error",
"code": 7022
File diff suppressed because it is too large Load Diff
+2 -9
View File
@@ -4053,6 +4053,8 @@ var __awaiter = (this && this.__awaiter) || function (generator, ctor) {
emitToken(SyntaxKind.CloseBraceToken, node.members.end);
scopeEmitEnd();
// TODO(rbuckton): Need to go back to `let _a = class C {}` approach, removing the defineProperty call for now.
// For a decorated class, we need to assign its name (if it has one). This is because we emit
// the class as a class expression to avoid the double-binding of the identifier:
//
@@ -4062,15 +4064,6 @@ var __awaiter = (this && this.__awaiter) || function (generator, ctor) {
//
if (thisNodeIsDecorated) {
write(";");
if (node.name) {
writeLine();
write("Object.defineProperty(");
emitDeclarationName(node);
write(", \"name\", { value: \"");
emitDeclarationName(node);
write("\", configurable: true });");
writeLine();
}
}
// Emit static property assignment. Because classDeclaration is lexically evaluated,
+50 -37
View File
@@ -568,11 +568,15 @@ module ts {
}
function doOutsideOfContext<T>(context: ParserContextFlags, func: () => T): T {
let setContextFlags = context & contextFlags;
if (setContextFlags) {
setContextFlag(false, setContextFlags);
// contextFlagsToClear will contain only the context flags that are
// currently set that we need to temporarily clear
let contextFlagsToClear = context & contextFlags;
if (contextFlagsToClear) {
// clear the requested context flags
setContextFlag(false, contextFlagsToClear);
let result = func();
setContextFlag(true, setContextFlags);
// restore the context flags we just cleared
setContextFlag(true, contextFlagsToClear);
return result;
}
@@ -581,11 +585,15 @@ module ts {
}
function doInsideOfContext<T>(context: ParserContextFlags, func: () => T): T {
let unsetContextFlags = context & ~contextFlags;
if (unsetContextFlags) {
setContextFlag(true, unsetContextFlags);
// contextFlagsToSet will contain only the context flags that
// are not currently set that we need to temporarily enable
let contextFlagsToSet = context & ~contextFlags;
if (contextFlagsToSet) {
// set the requested context flags
setContextFlag(true, contextFlagsToSet);
let result = func();
setContextFlag(false, unsetContextFlags);
// reset the context flags we just set
setContextFlag(false, contextFlagsToSet);
return result;
}
@@ -975,25 +983,22 @@ module ts {
}
function nextTokenCanFollowModifierForArrowFunction() {
return nextTokenCanFollowModifier(/*isArrowFunction*/ true);
nextToken();
return canFollowModifierForArrowFunction();
}
function nextTokenCanFollowModifier(isArrowFunction?: boolean) {
function nextTokenCanFollowModifier() {
nextToken();
return canFollowModifier(isArrowFunction);
return canFollowModifier();
}
function parseAnyContextualModifier(isArrowFunction?: boolean): boolean {
return isModifier(token) && tryParse(isArrowFunction
? nextTokenCanFollowContextualModifierForArrowFunction
? nextTokenCanFollowModifierForArrowFunction
: nextTokenCanFollowContextualModifier);
}
function nextTokenCanFollowContextualModifierForArrowFunction() {
return nextTokenCanFollowContextualModifier(/*isArrowFunction*/ true);
}
function nextTokenCanFollowContextualModifier(isArrowFunction?: boolean) {
function nextTokenCanFollowContextualModifier() {
if (token === SyntaxKind.ConstKeyword) {
// 'const' is only a modifier if followed by 'enum'.
return nextToken() === SyntaxKind.EnumKeyword;
@@ -1009,19 +1014,24 @@ module ts {
return nextTokenIsClassOrFunction();
}
nextToken();
return canFollowModifier(isArrowFunction);
return canFollowModifier();
}
function canFollowModifierForArrowFunction(): boolean {
// Arrow functions can have an `async` modifier, but the rules for what can follow that modifier
// differ from the rules for any other declaration.
// The `async` modifier on an async function can only be followed by an open parenthesis,
// or a less than token (in the case of a generic arrow function).
// In addition, the `async` modifier must appear on the same line as the following token.
if (scanner.hasPrecedingLineBreak()) {
return false;
}
return token === SyntaxKind.OpenParenToken
|| token === SyntaxKind.LessThanToken;
}
function canFollowModifier(isArrowFunction?: boolean): boolean {
if (isArrowFunction) {
if (scanner.hasPrecedingLineBreak()) {
return false;
}
return token === SyntaxKind.OpenParenToken
|| token === SyntaxKind.LessThanToken;
}
function canFollowModifier(): boolean {
return token === SyntaxKind.OpenBracketToken
|| token === SyntaxKind.OpenBraceToken
|| token === SyntaxKind.AsteriskToken
@@ -1898,12 +1908,12 @@ module ts {
function parseBindingElementInitializer(inParameter: boolean) {
// BindingElement[Yield,GeneratorParameter,Await,AsyncParameter] :
// [+GeneratorParameter] BindingPattern[?Yield,?Await,GeneratorParameter] Initializer[In]opt
// [+AsyncParameter] BindingPattern[?Yield,?Await,AsyncParameter] Initializer[In]opt
// [+GeneratorParameter] BindingPattern[?Yield,?Await,?AsyncParameter,GeneratorParameter] Initializer[In]opt
// [+AsyncParameter] BindingPattern[?Yield,?GeneratorParameter,?Await,AsyncParameter] Initializer[In]opt
// [~GeneratorParameter,~AsyncParameter] BindingPattern[?Yield,?Await] Initializer[In,?Yield,?Await]opt
// SingleNameBinding[Yield,GeneratorParameter,Await,AsyncParameter] :
// [+GeneratorParameter] BindingIdentifier[Yield] Initializer[In]opt
// [+AsyncParameter] BindingIdentifier[Await] Initializer[In]opt
// [+GeneratorParameter] BindingIdentifier[Yield, ?Await] Initializer[In]opt
// [+AsyncParameter] BindingIdentifier[Await, ?Yield] Initializer[In]opt
// [~GeneratorParameter,~AsyncParameter] BindingIdentifier[?Yield,?Await] Initializer[In,?Yield,?Await]opt
let parseInitializer = inParameter ? parseParameterInitializer : parseNonParameterInitializer;
return inGeneratorParameterOrAsyncParameterContext()
@@ -2425,9 +2435,9 @@ module ts {
case SyntaxKind.LessThanToken:
case SyntaxKind.AwaitKeyword:
case SyntaxKind.YieldKeyword:
// Yield always starts an expression. Either it is an identifier (in which case
// Yield/await always starts an expression. Either it is an identifier (in which case
// it is definitely an expression). Or it's a keyword (either because we're in
// a generator, or in strict mode (or both)) and it started a yield expression.
// a generator or async function, or in strict mode (or both)) and it started a yield or await expression.
return true;
default:
// Error tolerance. If we see the start of some binary operator, we consider
@@ -3317,6 +3327,9 @@ module ts {
case SyntaxKind.OpenBraceToken:
return parseObjectLiteralExpression();
case SyntaxKind.AsyncKeyword:
// Async arrow functions are parsed earlier in parseAssignmentExpressionOrHigher.
// If we encounter `async [no LineTerminator here] function` then this is an async
// function; otherwise, its an identifier.
if (!lookAhead(nextTokenIsFunctionKeywordOnSameLine)) {
break;
}
@@ -3450,7 +3463,7 @@ module ts {
parseExpected(SyntaxKind.FunctionKeyword);
node.asteriskToken = parseOptionalToken(SyntaxKind.AsteriskToken);
let isGenerator = node.asteriskToken != undefined;
let isGenerator = !!node.asteriskToken;
let isAsync = isAsyncFunctionLike(node);
node.name =
isGenerator && isAsync ? doInYieldAndAwaitContext(parseOptionalIdentifier) :
@@ -4092,7 +4105,7 @@ module ts {
parseExpected(SyntaxKind.FunctionKeyword);
node.asteriskToken = parseOptionalToken(SyntaxKind.AsteriskToken);
node.name = node.flags & NodeFlags.Default ? parseOptionalIdentifier() : parseIdentifier();
let isGenerator = node.asteriskToken != undefined;
let isGenerator = !!node.asteriskToken;
let isAsync = isAsyncFunctionLike(node);
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext*/ isGenerator, /*awaitAndAsyncParameterContext*/ isAsync, /*requireCompleteParameterList:*/ false, node);
node.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, Diagnostics.or_expected);
@@ -4116,7 +4129,7 @@ module ts {
method.asteriskToken = asteriskToken;
method.name = name;
method.questionToken = questionToken;
let isGenerator = asteriskToken != undefined;
let isGenerator = !!asteriskToken;
let isAsync = isAsyncFunctionLike(method);
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext:*/ isGenerator, /*awaitAndAsyncParameterContext*/ isAsync, /*requireCompleteParameterList:*/ false, method);
method.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, diagnosticMessage);
+7 -7
View File
@@ -344,19 +344,19 @@ module ts {
// If this node was parsed as part of a decorator
Decorator = 1 << 4,
// If the parser encountered an error when parsing the code that created this node. Note
// the parser only sets this directly on the node it creates right after encountering the
// error.
ThisNodeHasError = 1 << 5,
// If this node was parsed in the 'await' context created when parsing an async function.
Await = 1 << 5,
// If this node was parsed in the parameters of an async function.
AsyncParameter = 1 << 6,
// If this node was parsed in the 'await' context created when parsing an async function.
Await = 1 << 7,
// If the parser encountered an error when parsing the code that created this node. Note
// the parser only sets this directly on the node it creates right after encountering the
// error.
ThisNodeHasError = 1 << 7,
// Context flags set directly by the parser.
ParserGeneratedFlags = StrictMode | DisallowIn | Yield | GeneratorParameter | Decorator | ThisNodeHasError | AsyncParameter | Await,
ParserGeneratedFlags = StrictMode | DisallowIn | Yield | GeneratorParameter | Decorator | ThisNodeHasError | Await | AsyncParameter,
// Context flags passed as part of the modified ES6 grammar.
YieldAndGeneratorParameterFlags = Yield | GeneratorParameter,
+6 -4
View File
@@ -1101,7 +1101,7 @@ module ts {
}
export function isAsyncFunctionLike(node: Node): boolean {
return isFunctionLike(node) && !isAccessor(node) && (node.flags & NodeFlags.Async) === NodeFlags.Async;
return isFunctionLike(node) && (node.flags & NodeFlags.Async) !== 0 && !isAccessor(node);
}
/**
@@ -1453,8 +1453,10 @@ module ts {
export function shouldEmitToOwnFile(sourceFile: SourceFile, compilerOptions: CompilerOptions): boolean {
if (!isDeclarationFile(sourceFile)) {
if ((isExternalModule(sourceFile) || !compilerOptions.out) && !fileExtensionIs(sourceFile.fileName, ".js")) {
return true;
if ((isExternalModule(sourceFile) || !compilerOptions.out)) {
// 1. in-browser single file compilation scenario
// 2. non .js file
return compilerOptions.separateCompilation || !fileExtensionIs(sourceFile.fileName, ".js");
}
return false;
}
@@ -1712,7 +1714,7 @@ module ts {
}
export function getLocalSymbolForExportDefault(symbol: Symbol) {
return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & NodeFlags.Default) ? symbol.valueDeclaration.localSymbol : undefined;
return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & NodeFlags.Default) ? symbol.valueDeclaration.localSymbol : undefined;
}
/**
+3 -11
View File
@@ -45,10 +45,10 @@ module Utils {
export function getExecutionEnvironment() {
if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") {
return ExecutionEnvironment.CScript;
} else if (process && process.execPath && process.execPath.indexOf("node") !== -1) {
return ExecutionEnvironment.Node;
} else {
} else if (typeof window !== "undefined") {
return ExecutionEnvironment.Browser;
} else {
return ExecutionEnvironment.Node;
}
}
@@ -1610,7 +1610,6 @@ module Harness {
export module Baseline {
export interface BaselineOptions {
LineEndingSensitive?: boolean;
Subfolder?: string;
Baselinefolder?: string;
}
@@ -1702,13 +1701,6 @@ module Harness {
expected = IO.readFile(refFileName);
}
var lineEndingSensitive = opts && opts.LineEndingSensitive;
if (!lineEndingSensitive) {
expected = expected.replace(/\r\n?/g, '\n');
actual = actual.replace(/\r\n?/g, '\n');
}
return { expected, actual };
}
+1
View File
@@ -1180,4 +1180,5 @@ interface PromiseLike<T> {
* @returns A Promise for the completion of which ever callback is executed.
*/
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): PromiseLike<TResult>;
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): PromiseLike<TResult>;
}
+1
View File
@@ -12180,6 +12180,7 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
overrideMimeType(mime: string): void;
send(data?: Document): void;
send(data?: string): void;
send(data?: any): void;
setRequestHeader(header: string, value: string): void;
DONE: number;
HEADERS_RECEIVED: number;
+2
View File
@@ -3583,6 +3583,7 @@ interface Promise<T> {
* @returns A Promise for the completion of which ever callback is executed.
*/
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>;
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): Promise<TResult>;
/**
* Attaches a callback for only the rejection of the Promise.
@@ -3590,6 +3591,7 @@ interface Promise<T> {
* @returns A Promise for the completion of the callback.
*/
catch(onrejected?: (reason: any) => T | PromiseLike<T>): Promise<T>;
catch(onrejected?: (reason: any) => void): Promise<T>;
[Symbol.toStringTag]: string;
}
+26 -26
View File
@@ -398,7 +398,7 @@ module ts.server {
export class ProjectService {
filenameToScriptInfo: ts.Map<ScriptInfo> = {};
// open, non-configured root files
// open, non-configured root files
openFileRoots: ScriptInfo[] = [];
// projects built from openFileRoots
inferredProjects: Project[] = [];
@@ -421,7 +421,7 @@ module ts.server {
hostInfo: "Unknown host"
}
}
getFormatCodeOptions(file?: string) {
if (file) {
var info = this.filenameToScriptInfo[file];
@@ -448,7 +448,7 @@ module ts.server {
}
}
}
log(msg: string, type = "Err") {
this.psLogger.msg(msg, type);
}
@@ -457,17 +457,17 @@ module ts.server {
if (args.file) {
var info = this.filenameToScriptInfo[args.file];
if (info) {
info.setFormatOptions(args.formatOptions);
info.setFormatOptions(args.formatOptions);
this.log("Host configuration update for file " + args.file, "Info");
}
}
else {
if (args.hostInfo !== undefined) {
this.hostConfiguration.hostInfo = args.hostInfo;
this.log("Host information " + args.hostInfo, "Info");
this.log("Host information " + args.hostInfo, "Info");
}
if (args.formatOptions) {
mergeFormatOptions(this.hostConfiguration.formatCodeOptions, args.formatOptions);
mergeFormatOptions(this.hostConfiguration.formatCodeOptions, args.formatOptions);
this.log("Format host information updated", "Info");
}
}
@@ -487,7 +487,7 @@ module ts.server {
fileDeletedInFilesystem(info: ScriptInfo) {
this.psLogger.info(info.fileName + " deleted");
if (info.fileWatcher) {
info.fileWatcher.close();
info.fileWatcher = undefined;
@@ -537,7 +537,7 @@ module ts.server {
}
return false;
}
addOpenFile(info: ScriptInfo) {
if (this.setConfiguredProjectRoot(info)) {
this.openFileRootsConfigured.push(info);
@@ -561,7 +561,7 @@ module ts.server {
copyListRemovingItem(r.defaultProject, this.inferredProjects);
// put r in referenced open file list
this.openFilesReferenced.push(r);
// set default project of r to the new project
// set default project of r to the new project
r.defaultProject = info.defaultProject;
}
else {
@@ -694,7 +694,7 @@ module ts.server {
this.openFilesReferenced = openFilesReferenced;
// Then, loop through all of the open files that are project roots.
// For each root file, note the project that it roots. Then see if
// For each root file, note the project that it roots. Then see if
// any other projects newly reference the file. If zero projects
// newly reference the file, keep it as a root. If one or more
// projects newly references the file, remove its project from the
@@ -719,7 +719,7 @@ module ts.server {
// Finally, if we found any open, referenced files that are no longer
// referenced by their default project, treat them as newly opened
// by the editor.
// by the editor.
for (var i = 0, len = unattachedOpenFiles.length; i < len; i++) {
this.addOpenFile(unattachedOpenFiles[i]);
}
@@ -809,7 +809,7 @@ module ts.server {
}
else {
this.log("Opened configuration file " + configFileName,"Info");
this.configuredProjects.push(configResult.project);
this.configuredProjects.push(configResult.project);
}
}
var info = this.openFile(fileName, true);
@@ -901,22 +901,22 @@ module ts.server {
}
return false;
}
openConfigFile(configFilename: string, clientFileName?: string): ProjectOpenResult {
configFilename = ts.normalizePath(configFilename);
// file references will be relative to dirPath (or absolute)
var dirPath = ts.getDirectoryPath(configFilename);
var rawConfig = <ProjectOptions>ts.readConfigFile(configFilename);
if (!rawConfig) {
return { errorMsg: "tsconfig syntax error" };
var rawConfig: { config?: ProjectOptions; error?: Diagnostic; } = ts.readConfigFile(configFilename);
if (rawConfig.error) {
return rawConfig.error;
}
else {
var parsedCommandLine = ts.parseConfigFile(rawConfig, ts.sys, dirPath);
var parsedCommandLine = ts.parseConfigFile(rawConfig.config, ts.sys, dirPath);
if (parsedCommandLine.errors && (parsedCommandLine.errors.length > 0)) {
return { errorMsg: "tsconfig option errors" };
}
else if (parsedCommandLine.fileNames) {
var projectOptions: ProjectOptions = {
var projectOptions: ProjectOptions = {
files: parsedCommandLine.fileNames,
compilerOptions: parsedCommandLine.options
};
@@ -1040,7 +1040,7 @@ module ts.server {
startPath: LineCollection[];
endBranch: LineCollection[] = [];
branchNode: LineNode;
// path to current node
// path to current node
stack: LineNode[];
state = CharRangeSection.Entire;
lineCollectionAtBranch: LineCollection;
@@ -1242,7 +1242,7 @@ module ts.server {
}
}
// text change information
// text change information
class TextChange {
constructor(public pos: number, public deleteLen: number, public insertedText?: string) {
}
@@ -1290,7 +1290,7 @@ module ts.server {
if (cb)
cb();
}
// reload whole script, leaving no change history behind reload
reload(script: string) {
this.currentVersion++;
@@ -1300,7 +1300,7 @@ module ts.server {
snap.index = new LineIndex();
var lm = LineIndex.linesFromText(script);
snap.index.load(lm.lines);
// REVIEW: could use linked list
// REVIEW: could use linked list
for (var i = this.minVersion; i < this.currentVersion; i++) {
this.versions[i] = undefined;
}
@@ -1381,7 +1381,7 @@ module ts.server {
return this.index.root.charCount();
}
// this requires linear space so don't hold on to these
// this requires linear space so don't hold on to these
getLineStartPositions(): number[] {
var starts: number[] = [-1];
var count = 1;
@@ -1643,7 +1643,7 @@ module ts.server {
}
walk(rangeStart: number, rangeLength: number, walkFns: ILineIndexWalker) {
// assume (rangeStart < this.totalChars) && (rangeLength <= this.totalChars)
// assume (rangeStart < this.totalChars) && (rangeLength <= this.totalChars)
var childIndex = 0;
var child = this.children[0];
var childCharCount = child.charCount();
@@ -1729,7 +1729,7 @@ module ts.server {
line: lineNumber,
offset: charOffset
}
}
}
else if (childInfo.child.isLeaf()) {
return {
line: lineNumber,
@@ -1917,4 +1917,4 @@ module ts.server {
return 1;
}
}
}
}
+16 -10
View File
@@ -1632,7 +1632,7 @@ module ts {
private fileNameToEntry: Map<HostFileInformation>;
private _compilationSettings: CompilerOptions;
constructor(private host: LanguageServiceHost) {
constructor(private host: LanguageServiceHost, private getCanonicalFileName: (fileName: string) => string) {
// script id => script index
this.fileNameToEntry = {};
@@ -1650,6 +1650,10 @@ module ts {
return this._compilationSettings;
}
private normalizeFileName(fileName: string): string {
return this.getCanonicalFileName(normalizeSlashes(fileName));
}
private createEntry(fileName: string) {
let entry: HostFileInformation;
let scriptSnapshot = this.host.getScriptSnapshot(fileName);
@@ -1661,15 +1665,15 @@ module ts {
};
}
return this.fileNameToEntry[normalizeSlashes(fileName)] = entry;
return this.fileNameToEntry[this.normalizeFileName(fileName)] = entry;
}
public getEntry(fileName: string): HostFileInformation {
return lookUp(this.fileNameToEntry, normalizeSlashes(fileName));
private getEntry(fileName: string): HostFileInformation {
return lookUp(this.fileNameToEntry, this.normalizeFileName(fileName));
}
public contains(fileName: string): boolean {
return hasProperty(this.fileNameToEntry, normalizeSlashes(fileName));
private contains(fileName: string): boolean {
return hasProperty(this.fileNameToEntry, this.normalizeFileName(fileName));
}
public getOrCreateEntry(fileName: string): HostFileInformation {
@@ -1684,8 +1688,10 @@ module ts {
let fileNames: string[] = [];
forEachKey(this.fileNameToEntry, key => {
if (hasProperty(this.fileNameToEntry, key) && this.fileNameToEntry[key])
fileNames.push(key);
let entry = this.getEntry(key);
if (entry) {
fileNames.push(entry.hostFileName);
}
});
return fileNames;
@@ -2387,7 +2393,7 @@ module ts {
function synchronizeHostData(): void {
// Get a fresh cache of the host information
let hostCache = new HostCache(host);
let hostCache = new HostCache(host, getCanonicalFileName);
// If the program is already up-to-date, we can reuse it
if (programUpToDate()) {
@@ -2408,7 +2414,7 @@ module ts {
let newProgram = createProgram(hostCache.getRootFileNames(), newSettings, {
getSourceFile: getOrCreateSourceFile,
getCancellationToken: () => cancellationToken,
getCanonicalFileName: (fileName) => useCaseSensitivefileNames ? fileName : fileName.toLowerCase(),
getCanonicalFileName,
useCaseSensitiveFileNames: () => useCaseSensitivefileNames,
getNewLine: () => host.getNewLine ? host.getNewLine() : "\r\n",
getDefaultLibFileName: (options) => host.getDefaultLibFileName(options),
+13 -13
View File
@@ -1,6 +1,6 @@
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
@@ -83,7 +83,7 @@ module ts {
export interface Shim {
dispose(dummy: any): void;
}
export interface LanguageServiceShim extends Shim {
languageService: LanguageService;
@@ -145,7 +145,7 @@ module ts {
* { fileName: string; textSpan: { start: number; length: number}; isWriteAccess: boolean }[]
*/
getReferencesAtPosition(fileName: string, position: number): string;
/**
* Returns a JSON-encoded value of the type:
* { definition: <encoded>; references: <encoded>[] }[]
@@ -162,8 +162,8 @@ module ts {
/**
* Returns a JSON-encoded value of the type:
* { fileName: string; highlights: { start: number; length: number, isDefinition: boolean }[] }[]
*
* @param fileToSearch A JSON encoded string[] containing the file names that should be
*
* @param fileToSearch A JSON encoded string[] containing the file names that should be
* considered when searching.
*/
getDocumentHighlights(fileName: string, position: number, filesToSearch: string): string;
@@ -244,7 +244,7 @@ module ts {
export class LanguageServiceShimHostAdapter implements LanguageServiceHost {
private files: string[];
constructor(private shimHost: LanguageServiceShimHost) {
}
@@ -255,7 +255,7 @@ module ts {
public trace(s: string): void {
this.shimHost.trace(s);
}
public error(s: string): void {
this.shimHost.error(s);
}
@@ -322,7 +322,7 @@ module ts {
}
}
}
export class CoreServicesShimHostAdapter implements ParseConfigHost {
constructor(private shimHost: CoreServicesShimHost) {
@@ -587,7 +587,7 @@ module ts {
/**
* Computes the definition location and file for the symbol
* at the requested position.
* at the requested position.
*/
public getDefinitionAtPosition(fileName: string, position: number): string {
return this.forwardJSONCall(
@@ -601,7 +601,7 @@ module ts {
/**
* Computes the definition location of the type of the symbol
* at the requested position.
* at the requested position.
*/
public getTypeDefinitionAtPosition(fileName: string, position: number): string {
return this.forwardJSONCall(
@@ -684,8 +684,8 @@ module ts {
/// COMPLETION LISTS
/**
* Get a string based representation of the completions
* to provide at the given source position and providing a member completion
* Get a string based representation of the completions
* to provide at the given source position and providing a member completion
* list if requested.
*/
public getCompletionsAtPosition(fileName: string, position: number) {
@@ -883,7 +883,7 @@ module ts {
return {
options: configFile.options,
files: configFile.fileNames,
errors: realizeDiagnostics(configFile.errors, '\r\n')
errors: [realizeDiagnostics(configFile.errors, '\r\n')]
};
});
}
@@ -1,9 +1,9 @@
tests/cases/compiler/aliasErrors.ts(11,12): error TS2304: Cannot find name 'no'.
tests/cases/compiler/aliasErrors.ts(12,13): error TS2304: Cannot find name 'no'.
tests/cases/compiler/aliasErrors.ts(11,12): error TS2503: Cannot find namespace 'no'.
tests/cases/compiler/aliasErrors.ts(12,13): error TS2503: Cannot find namespace 'no'.
tests/cases/compiler/aliasErrors.ts(13,12): error TS1003: Identifier expected.
tests/cases/compiler/aliasErrors.ts(14,12): error TS1003: Identifier expected.
tests/cases/compiler/aliasErrors.ts(15,12): error TS1003: Identifier expected.
tests/cases/compiler/aliasErrors.ts(16,12): error TS2304: Cannot find name 'undefined'.
tests/cases/compiler/aliasErrors.ts(16,12): error TS2503: Cannot find namespace 'undefined'.
tests/cases/compiler/aliasErrors.ts(26,15): error TS2305: Module 'foo.bar.baz' has no exported member 'bar'.
@@ -20,10 +20,10 @@ tests/cases/compiler/aliasErrors.ts(26,15): error TS2305: Module 'foo.bar.baz' h
import m = no;
~~
!!! error TS2304: Cannot find name 'no'.
!!! error TS2503: Cannot find namespace 'no'.
import m2 = no.mod;
~~
!!! error TS2304: Cannot find name 'no'.
!!! error TS2503: Cannot find namespace 'no'.
import n = 5;
~
!!! error TS1003: Identifier expected.
@@ -35,7 +35,7 @@ tests/cases/compiler/aliasErrors.ts(26,15): error TS2305: Module 'foo.bar.baz' h
!!! error TS1003: Identifier expected.
import r = undefined;
~~~~~~~~~
!!! error TS2304: Cannot find name 'undefined'.
!!! error TS2503: Cannot find namespace 'undefined'.
var p = new provide.Provide();
@@ -72,14 +72,14 @@ var temp2: [number[], string[]] = [[1, 2, 3], ["hello", "string"]];
interface myArray extends Array<Number> { }
>myArray : Symbol(myArray, Decl(arrayLiterals2ES6.ts, 40, 67))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1450, 1))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1451, 1))
>Number : Symbol(Number, Decl(lib.d.ts, 456, 40), Decl(lib.d.ts, 518, 11))
interface myArray2 extends Array<Number|String> { }
>myArray2 : Symbol(myArray2, Decl(arrayLiterals2ES6.ts, 42, 43))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1450, 1))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1451, 1))
>Number : Symbol(Number, Decl(lib.d.ts, 456, 40), Decl(lib.d.ts, 518, 11))
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1549, 1))
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1550, 1))
var d0 = [1, true, ...temp, ]; // has type (string|number|boolean)[]
>d0 : Symbol(d0, Decl(arrayLiterals2ES6.ts, 44, 3))
@@ -2,6 +2,6 @@
var foo = async (): Promise<void> => {
>foo : Symbol(foo, Decl(asyncArrowFunction1_es6.ts, 1, 3))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
};
@@ -4,5 +4,5 @@ var foo = async (a = await => await): Promise<void> => {
>a : Symbol(a, Decl(asyncArrowFunction9_es6.ts, 0, 17))
>await : Symbol(await, Decl(asyncArrowFunction9_es6.ts, 0, 20))
>await : Symbol(await, Decl(asyncArrowFunction9_es6.ts, 0, 20))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
}
@@ -4,5 +4,5 @@ async function foo(a = await => await): Promise<void> {
>a : Symbol(a, Decl(asyncFunctionDeclaration10_es6.ts, 0, 19))
>await : Symbol(await, Decl(asyncFunctionDeclaration10_es6.ts, 0, 22))
>await : Symbol(await, Decl(asyncFunctionDeclaration10_es6.ts, 0, 22))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
}
@@ -1,5 +1,5 @@
=== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration11_es6.ts ===
async function await(): Promise<void> {
>await : Symbol(await, Decl(asyncFunctionDeclaration11_es6.ts, 0, 0))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
}
@@ -1,7 +1,7 @@
=== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration14_es6.ts ===
async function foo(): Promise<void> {
>foo : Symbol(foo, Decl(asyncFunctionDeclaration14_es6.ts, 0, 0))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
return;
}
@@ -1,5 +1,5 @@
=== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration1_es6.ts ===
async function foo(): Promise<void> {
>foo : Symbol(foo, Decl(asyncFunctionDeclaration1_es6.ts, 0, 0))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
}
@@ -4,11 +4,11 @@ declare var a: boolean;
declare var p: Promise<boolean>;
>p : Symbol(p, Decl(awaitBinaryExpression1_es6.ts, 1, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
async function func(): Promise<void> {
>func : Symbol(func, Decl(awaitBinaryExpression1_es6.ts, 1, 32))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
"before";
var b = await p || a;
@@ -4,11 +4,11 @@ declare var a: boolean;
declare var p: Promise<boolean>;
>p : Symbol(p, Decl(awaitBinaryExpression2_es6.ts, 1, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
async function func(): Promise<void> {
>func : Symbol(func, Decl(awaitBinaryExpression2_es6.ts, 1, 32))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
"before";
var b = await p && a;
@@ -4,11 +4,11 @@ declare var a: number;
declare var p: Promise<number>;
>p : Symbol(p, Decl(awaitBinaryExpression3_es6.ts, 1, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
async function func(): Promise<void> {
>func : Symbol(func, Decl(awaitBinaryExpression3_es6.ts, 1, 31))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
"before";
var b = await p + a;
@@ -4,11 +4,11 @@ declare var a: boolean;
declare var p: Promise<boolean>;
>p : Symbol(p, Decl(awaitBinaryExpression4_es6.ts, 1, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
async function func(): Promise<void> {
>func : Symbol(func, Decl(awaitBinaryExpression4_es6.ts, 1, 32))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
"before";
var b = await p, a;
@@ -4,11 +4,11 @@ declare var a: boolean;
declare var p: Promise<boolean>;
>p : Symbol(p, Decl(awaitBinaryExpression5_es6.ts, 1, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
async function func(): Promise<void> {
>func : Symbol(func, Decl(awaitBinaryExpression5_es6.ts, 1, 32))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
"before";
var o: { a: boolean; };
@@ -4,7 +4,7 @@ declare var a: boolean;
declare var p: Promise<boolean>;
>p : Symbol(p, Decl(awaitCallExpression1_es6.ts, 1, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
>fn : Symbol(fn, Decl(awaitCallExpression1_es6.ts, 1, 32))
@@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; };
declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
>pfn : Symbol(pfn, Decl(awaitCallExpression1_es6.ts, 4, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
>arg0 : Symbol(arg0, Decl(awaitCallExpression1_es6.ts, 4, 28))
>arg1 : Symbol(arg1, Decl(awaitCallExpression1_es6.ts, 4, 42))
>arg2 : Symbol(arg2, Decl(awaitCallExpression1_es6.ts, 4, 57))
declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
>po : Symbol(po, Decl(awaitCallExpression1_es6.ts, 5, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
>fn : Symbol(fn, Decl(awaitCallExpression1_es6.ts, 5, 25))
>arg0 : Symbol(arg0, Decl(awaitCallExpression1_es6.ts, 5, 29))
>arg1 : Symbol(arg1, Decl(awaitCallExpression1_es6.ts, 5, 43))
@@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
async function func(): Promise<void> {
>func : Symbol(func, Decl(awaitCallExpression1_es6.ts, 5, 84))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
"before";
var b = fn(a, a, a);
@@ -4,7 +4,7 @@ declare var a: boolean;
declare var p: Promise<boolean>;
>p : Symbol(p, Decl(awaitCallExpression2_es6.ts, 1, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
>fn : Symbol(fn, Decl(awaitCallExpression2_es6.ts, 1, 32))
@@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; };
declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
>pfn : Symbol(pfn, Decl(awaitCallExpression2_es6.ts, 4, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
>arg0 : Symbol(arg0, Decl(awaitCallExpression2_es6.ts, 4, 28))
>arg1 : Symbol(arg1, Decl(awaitCallExpression2_es6.ts, 4, 42))
>arg2 : Symbol(arg2, Decl(awaitCallExpression2_es6.ts, 4, 57))
declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
>po : Symbol(po, Decl(awaitCallExpression2_es6.ts, 5, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
>fn : Symbol(fn, Decl(awaitCallExpression2_es6.ts, 5, 25))
>arg0 : Symbol(arg0, Decl(awaitCallExpression2_es6.ts, 5, 29))
>arg1 : Symbol(arg1, Decl(awaitCallExpression2_es6.ts, 5, 43))
@@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
async function func(): Promise<void> {
>func : Symbol(func, Decl(awaitCallExpression2_es6.ts, 5, 84))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
"before";
var b = fn(await p, a, a);
@@ -4,7 +4,7 @@ declare var a: boolean;
declare var p: Promise<boolean>;
>p : Symbol(p, Decl(awaitCallExpression3_es6.ts, 1, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
>fn : Symbol(fn, Decl(awaitCallExpression3_es6.ts, 1, 32))
@@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; };
declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
>pfn : Symbol(pfn, Decl(awaitCallExpression3_es6.ts, 4, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
>arg0 : Symbol(arg0, Decl(awaitCallExpression3_es6.ts, 4, 28))
>arg1 : Symbol(arg1, Decl(awaitCallExpression3_es6.ts, 4, 42))
>arg2 : Symbol(arg2, Decl(awaitCallExpression3_es6.ts, 4, 57))
declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
>po : Symbol(po, Decl(awaitCallExpression3_es6.ts, 5, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
>fn : Symbol(fn, Decl(awaitCallExpression3_es6.ts, 5, 25))
>arg0 : Symbol(arg0, Decl(awaitCallExpression3_es6.ts, 5, 29))
>arg1 : Symbol(arg1, Decl(awaitCallExpression3_es6.ts, 5, 43))
@@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
async function func(): Promise<void> {
>func : Symbol(func, Decl(awaitCallExpression3_es6.ts, 5, 84))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
"before";
var b = fn(a, await p, a);
@@ -4,7 +4,7 @@ declare var a: boolean;
declare var p: Promise<boolean>;
>p : Symbol(p, Decl(awaitCallExpression4_es6.ts, 1, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
>fn : Symbol(fn, Decl(awaitCallExpression4_es6.ts, 1, 32))
@@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; };
declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
>pfn : Symbol(pfn, Decl(awaitCallExpression4_es6.ts, 4, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
>arg0 : Symbol(arg0, Decl(awaitCallExpression4_es6.ts, 4, 28))
>arg1 : Symbol(arg1, Decl(awaitCallExpression4_es6.ts, 4, 42))
>arg2 : Symbol(arg2, Decl(awaitCallExpression4_es6.ts, 4, 57))
declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
>po : Symbol(po, Decl(awaitCallExpression4_es6.ts, 5, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
>fn : Symbol(fn, Decl(awaitCallExpression4_es6.ts, 5, 25))
>arg0 : Symbol(arg0, Decl(awaitCallExpression4_es6.ts, 5, 29))
>arg1 : Symbol(arg1, Decl(awaitCallExpression4_es6.ts, 5, 43))
@@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
async function func(): Promise<void> {
>func : Symbol(func, Decl(awaitCallExpression4_es6.ts, 5, 84))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
"before";
var b = (await pfn)(a, a, a);
@@ -4,7 +4,7 @@ declare var a: boolean;
declare var p: Promise<boolean>;
>p : Symbol(p, Decl(awaitCallExpression5_es6.ts, 1, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
>fn : Symbol(fn, Decl(awaitCallExpression5_es6.ts, 1, 32))
@@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; };
declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
>pfn : Symbol(pfn, Decl(awaitCallExpression5_es6.ts, 4, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
>arg0 : Symbol(arg0, Decl(awaitCallExpression5_es6.ts, 4, 28))
>arg1 : Symbol(arg1, Decl(awaitCallExpression5_es6.ts, 4, 42))
>arg2 : Symbol(arg2, Decl(awaitCallExpression5_es6.ts, 4, 57))
declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
>po : Symbol(po, Decl(awaitCallExpression5_es6.ts, 5, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
>fn : Symbol(fn, Decl(awaitCallExpression5_es6.ts, 5, 25))
>arg0 : Symbol(arg0, Decl(awaitCallExpression5_es6.ts, 5, 29))
>arg1 : Symbol(arg1, Decl(awaitCallExpression5_es6.ts, 5, 43))
@@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
async function func(): Promise<void> {
>func : Symbol(func, Decl(awaitCallExpression5_es6.ts, 5, 84))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
"before";
var b = o.fn(a, a, a);
@@ -4,7 +4,7 @@ declare var a: boolean;
declare var p: Promise<boolean>;
>p : Symbol(p, Decl(awaitCallExpression6_es6.ts, 1, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
>fn : Symbol(fn, Decl(awaitCallExpression6_es6.ts, 1, 32))
@@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; };
declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
>pfn : Symbol(pfn, Decl(awaitCallExpression6_es6.ts, 4, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
>arg0 : Symbol(arg0, Decl(awaitCallExpression6_es6.ts, 4, 28))
>arg1 : Symbol(arg1, Decl(awaitCallExpression6_es6.ts, 4, 42))
>arg2 : Symbol(arg2, Decl(awaitCallExpression6_es6.ts, 4, 57))
declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
>po : Symbol(po, Decl(awaitCallExpression6_es6.ts, 5, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
>fn : Symbol(fn, Decl(awaitCallExpression6_es6.ts, 5, 25))
>arg0 : Symbol(arg0, Decl(awaitCallExpression6_es6.ts, 5, 29))
>arg1 : Symbol(arg1, Decl(awaitCallExpression6_es6.ts, 5, 43))
@@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
async function func(): Promise<void> {
>func : Symbol(func, Decl(awaitCallExpression6_es6.ts, 5, 84))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
"before";
var b = o.fn(await p, a, a);
@@ -4,7 +4,7 @@ declare var a: boolean;
declare var p: Promise<boolean>;
>p : Symbol(p, Decl(awaitCallExpression7_es6.ts, 1, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
>fn : Symbol(fn, Decl(awaitCallExpression7_es6.ts, 1, 32))
@@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; };
declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
>pfn : Symbol(pfn, Decl(awaitCallExpression7_es6.ts, 4, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
>arg0 : Symbol(arg0, Decl(awaitCallExpression7_es6.ts, 4, 28))
>arg1 : Symbol(arg1, Decl(awaitCallExpression7_es6.ts, 4, 42))
>arg2 : Symbol(arg2, Decl(awaitCallExpression7_es6.ts, 4, 57))
declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
>po : Symbol(po, Decl(awaitCallExpression7_es6.ts, 5, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
>fn : Symbol(fn, Decl(awaitCallExpression7_es6.ts, 5, 25))
>arg0 : Symbol(arg0, Decl(awaitCallExpression7_es6.ts, 5, 29))
>arg1 : Symbol(arg1, Decl(awaitCallExpression7_es6.ts, 5, 43))
@@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
async function func(): Promise<void> {
>func : Symbol(func, Decl(awaitCallExpression7_es6.ts, 5, 84))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
"before";
var b = o.fn(a, await p, a);
@@ -4,7 +4,7 @@ declare var a: boolean;
declare var p: Promise<boolean>;
>p : Symbol(p, Decl(awaitCallExpression8_es6.ts, 1, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
>fn : Symbol(fn, Decl(awaitCallExpression8_es6.ts, 1, 32))
@@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; };
declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
>pfn : Symbol(pfn, Decl(awaitCallExpression8_es6.ts, 4, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
>arg0 : Symbol(arg0, Decl(awaitCallExpression8_es6.ts, 4, 28))
>arg1 : Symbol(arg1, Decl(awaitCallExpression8_es6.ts, 4, 42))
>arg2 : Symbol(arg2, Decl(awaitCallExpression8_es6.ts, 4, 57))
declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
>po : Symbol(po, Decl(awaitCallExpression8_es6.ts, 5, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
>fn : Symbol(fn, Decl(awaitCallExpression8_es6.ts, 5, 25))
>arg0 : Symbol(arg0, Decl(awaitCallExpression8_es6.ts, 5, 29))
>arg1 : Symbol(arg1, Decl(awaitCallExpression8_es6.ts, 5, 43))
@@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
async function func(): Promise<void> {
>func : Symbol(func, Decl(awaitCallExpression8_es6.ts, 5, 84))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 4770, 1), Decl(lib.d.ts, 4856, 11))
"before";
var b = (await po).fn(a, a, a);
@@ -94,7 +94,7 @@ xa[1].foo(1, 2, ...a, "abc");
>a : Symbol(a, Decl(callWithSpreadES6.ts, 8, 3))
(<Function>xa[1].foo)(...[1, 2, "abc"]);
>Function : Symbol(Function, Decl(lib.d.ts, 223, 38), Decl(lib.d.ts, 269, 11), Decl(lib.d.ts, 1366, 1))
>Function : Symbol(Function, Decl(lib.d.ts, 223, 38), Decl(lib.d.ts, 269, 11), Decl(lib.d.ts, 1367, 1))
>xa[1].foo : Symbol(X.foo, Decl(callWithSpreadES6.ts, 1, 13))
>xa : Symbol(xa, Decl(callWithSpreadES6.ts, 11, 3))
>foo : Symbol(X.foo, Decl(callWithSpreadES6.ts, 1, 13))
@@ -0,0 +1,28 @@
tests/cases/conformance/types/specifyingTypes/typeQueries/circularTypeofWithVarOrFunc.ts(1,6): error TS2456: Type alias 'typeAlias1' circularly references itself.
tests/cases/conformance/types/specifyingTypes/typeQueries/circularTypeofWithVarOrFunc.ts(2,5): error TS2502: 'varOfAliasedType1' is referenced directly or indirectly in its own type annotation.
tests/cases/conformance/types/specifyingTypes/typeQueries/circularTypeofWithVarOrFunc.ts(4,5): error TS2502: 'varOfAliasedType2' is referenced directly or indirectly in its own type annotation.
tests/cases/conformance/types/specifyingTypes/typeQueries/circularTypeofWithVarOrFunc.ts(5,6): error TS2456: Type alias 'typeAlias2' circularly references itself.
tests/cases/conformance/types/specifyingTypes/typeQueries/circularTypeofWithVarOrFunc.ts(9,6): error TS2456: Type alias 'typeAlias3' circularly references itself.
==== tests/cases/conformance/types/specifyingTypes/typeQueries/circularTypeofWithVarOrFunc.ts (5 errors) ====
type typeAlias1 = typeof varOfAliasedType1;
~~~~~~~~~~
!!! error TS2456: Type alias 'typeAlias1' circularly references itself.
var varOfAliasedType1: typeAlias1;
~~~~~~~~~~~~~~~~~
!!! error TS2502: 'varOfAliasedType1' is referenced directly or indirectly in its own type annotation.
var varOfAliasedType2: typeAlias2;
~~~~~~~~~~~~~~~~~
!!! error TS2502: 'varOfAliasedType2' is referenced directly or indirectly in its own type annotation.
type typeAlias2 = typeof varOfAliasedType2;
~~~~~~~~~~
!!! error TS2456: Type alias 'typeAlias2' circularly references itself.
function func(): typeAlias3 { return null; }
var varOfAliasedType3 = func();
type typeAlias3 = typeof varOfAliasedType3;
~~~~~~~~~~
!!! error TS2456: Type alias 'typeAlias3' circularly references itself.
@@ -0,0 +1,17 @@
//// [circularTypeofWithVarOrFunc.ts]
type typeAlias1 = typeof varOfAliasedType1;
var varOfAliasedType1: typeAlias1;
var varOfAliasedType2: typeAlias2;
type typeAlias2 = typeof varOfAliasedType2;
function func(): typeAlias3 { return null; }
var varOfAliasedType3 = func();
type typeAlias3 = typeof varOfAliasedType3;
//// [circularTypeofWithVarOrFunc.js]
var varOfAliasedType1;
var varOfAliasedType2;
function func() { return null; }
var varOfAliasedType3 = func();
@@ -1,4 +1,5 @@
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(11,13): error TS2304: Cannot find name 'module'.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(11,13): error TS2503: Cannot find namespace 'module'.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(11,19): error TS1005: ';' expected.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(22,35): error TS1005: ')' expected.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(22,39): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
@@ -82,7 +83,7 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,55): error T
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS1128: Declaration or statement expected.
==== tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts (82 errors) ====
==== tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts (83 errors) ====
declare module "fs" {
export class File {
constructor(filename: string);
@@ -96,6 +97,8 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS
import fs = module("fs");
~~~~~~
!!! error TS2304: Cannot find name 'module'.
~~~~~~
!!! error TS2503: Cannot find namespace 'module'.
~
!!! error TS1005: ';' expected.
@@ -1,5 +1,5 @@
tests/cases/compiler/declareModifierOnImport1.ts(1,1): error TS1079: A 'declare' modifier cannot be used with an import declaration.
tests/cases/compiler/declareModifierOnImport1.ts(1,20): error TS2304: Cannot find name 'b'.
tests/cases/compiler/declareModifierOnImport1.ts(1,20): error TS2503: Cannot find namespace 'b'.
==== tests/cases/compiler/declareModifierOnImport1.ts (2 errors) ====
@@ -7,4 +7,4 @@ tests/cases/compiler/declareModifierOnImport1.ts(1,20): error TS2304: Cannot fin
~~~~~~~
!!! error TS1079: A 'declare' modifier cannot be used with an import declaration.
~
!!! error TS2304: Cannot find name 'b'.
!!! error TS2503: Cannot find namespace 'b'.
@@ -21,7 +21,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
function decorate() { }
let Decorated = class {
};
Object.defineProperty(Decorated, "name", { value: "Decorated", configurable: true });
Decorated = __decorate([
decorate
], Decorated);
@@ -8,18 +8,18 @@
type arrayString = Array<String>
>arrayString : Symbol(arrayString, Decl(destructuringParameterDeclaration3ES5.ts, 0, 0))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1450, 1))
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1549, 1))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1451, 1))
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1550, 1))
type someArray = Array<String> | number[];
>someArray : Symbol(someArray, Decl(destructuringParameterDeclaration3ES5.ts, 7, 32))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1450, 1))
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1549, 1))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1451, 1))
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1550, 1))
type stringOrNumArray = Array<String|Number>;
>stringOrNumArray : Symbol(stringOrNumArray, Decl(destructuringParameterDeclaration3ES5.ts, 8, 42))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1450, 1))
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1549, 1))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1451, 1))
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1550, 1))
>Number : Symbol(Number, Decl(lib.d.ts, 456, 40), Decl(lib.d.ts, 518, 11))
function a1(...x: (number|string)[]) { }
@@ -33,8 +33,8 @@ function a2(...a) { }
function a3(...a: Array<String>) { }
>a3 : Symbol(a3, Decl(destructuringParameterDeclaration3ES5.ts, 12, 21))
>a : Symbol(a, Decl(destructuringParameterDeclaration3ES5.ts, 13, 12))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1450, 1))
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1549, 1))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1451, 1))
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1550, 1))
function a4(...a: arrayString) { }
>a4 : Symbol(a4, Decl(destructuringParameterDeclaration3ES5.ts, 13, 36))
@@ -8,18 +8,18 @@
type arrayString = Array<String>
>arrayString : Symbol(arrayString, Decl(destructuringParameterDeclaration3ES6.ts, 0, 0))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1450, 1))
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1549, 1))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1451, 1))
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1550, 1))
type someArray = Array<String> | number[];
>someArray : Symbol(someArray, Decl(destructuringParameterDeclaration3ES6.ts, 7, 32))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1450, 1))
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1549, 1))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1451, 1))
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1550, 1))
type stringOrNumArray = Array<String|Number>;
>stringOrNumArray : Symbol(stringOrNumArray, Decl(destructuringParameterDeclaration3ES6.ts, 8, 42))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1450, 1))
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1549, 1))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1451, 1))
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1550, 1))
>Number : Symbol(Number, Decl(lib.d.ts, 456, 40), Decl(lib.d.ts, 518, 11))
function a1(...x: (number|string)[]) { }
@@ -33,8 +33,8 @@ function a2(...a) { }
function a3(...a: Array<String>) { }
>a3 : Symbol(a3, Decl(destructuringParameterDeclaration3ES6.ts, 12, 21))
>a : Symbol(a, Decl(destructuringParameterDeclaration3ES6.ts, 13, 12))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1450, 1))
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1549, 1))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1451, 1))
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1550, 1))
function a4(...a: arrayString) { }
>a4 : Symbol(a4, Decl(destructuringParameterDeclaration3ES6.ts, 13, 36))
@@ -1,15 +1,21 @@
tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(4,6): error TS2456: Type alias 'T0' circularly references itself.
tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(5,6): error TS2456: Type alias 'T0_1' circularly references itself.
tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(6,6): error TS2456: Type alias 'T0_2' circularly references itself.
tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(7,6): error TS2456: Type alias 'T0_3' circularly references itself.
tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(11,6): error TS2456: Type alias 'T1' circularly references itself.
tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(14,6): error TS2456: Type alias 'T2' circularly references itself.
tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(16,6): error TS2456: Type alias 'T2_1' circularly references itself.
tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(19,6): error TS2456: Type alias 'T3' circularly references itself.
tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(22,6): error TS2456: Type alias 'T4' circularly references itself.
tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(25,5): error TS2502: 'x' is referenced directly or indirectly in its own type annotation.
tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(26,6): error TS2456: Type alias 'T5' circularly references itself.
tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(29,6): error TS2456: Type alias 'T6' circularly references itself.
tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(30,6): error TS2456: Type alias 'T7' circularly references itself.
tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(31,5): error TS2502: 'yy' is referenced directly or indirectly in its own type annotation.
tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(32,6): error TS2456: Type alias 'T8' circularly references itself.
==== tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts (9 errors) ====
==== tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts (15 errors) ====
// It is an error for the type specified in a type alias to depend on that type alias
// A type alias directly depends on the type it aliases.
@@ -17,10 +23,14 @@ tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(
~~
!!! error TS2456: Type alias 'T0' circularly references itself.
type T0_1 = T0_2
~~~~
!!! error TS2456: Type alias 'T0_1' circularly references itself.
type T0_2 = T0_3
~~~~
!!! error TS2456: Type alias 'T0_2' circularly references itself.
type T0_3 = T0_1
~~~~
!!! error TS2456: Type alias 'T0_3' circularly references itself.
// A type reference directly depends on the referenced type and each of the type arguments, if any.
interface I<T> {}
@@ -49,17 +59,25 @@ tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(
// A type query directly depends on the type of the referenced entity.
var x: T5[] = []
~
!!! error TS2502: 'x' is referenced directly or indirectly in its own type annotation.
type T5 = typeof x
~~
!!! error TS2456: Type alias 'T5' circularly references itself.
class C1<T> {}
type T6 = T7 | number
~~
!!! error TS2456: Type alias 'T6' circularly references itself.
type T7 = typeof yy
~~
!!! error TS2456: Type alias 'T7' circularly references itself.
var yy: [string, T8[]];
~~
!!! error TS2502: 'yy' is referenced directly or indirectly in its own type annotation.
type T8 = C<T6>
~~
!!! error TS2456: Type alias 'T8' circularly references itself.
// legal cases
type T9 = () => T9
@@ -5,7 +5,7 @@ function f() {
if (Math.random()) {
>Math.random : Symbol(Math.random, Decl(lib.d.ts, 608, 38))
>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 1705, 1))
>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 1706, 1))
>random : Symbol(Math.random, Decl(lib.d.ts, 608, 38))
let arguments = 100;
@@ -8,7 +8,7 @@ function f() {
if (Math.random()) {
>Math.random : Symbol(Math.random, Decl(lib.d.ts, 608, 38))
>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 1705, 1))
>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 1706, 1))
>random : Symbol(Math.random, Decl(lib.d.ts, 608, 38))
const arguments = 100;
@@ -8,7 +8,7 @@ function f() {
if (Math.random()) {
>Math.random : Symbol(Math.random, Decl(lib.d.ts, 608, 38))
>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 1705, 1))
>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 1706, 1))
>random : Symbol(Math.random, Decl(lib.d.ts, 608, 38))
return () => arguments[0];
@@ -9,7 +9,7 @@ function f() {
if (Math.random()) {
>Math.random : Symbol(Math.random, Decl(lib.d.ts, 608, 38))
>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 1705, 1))
>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 1706, 1))
>random : Symbol(Math.random, Decl(lib.d.ts, 608, 38))
return () => arguments[0];
@@ -9,7 +9,7 @@ function f() {
if (Math.random()) {
>Math.random : Symbol(Math.random, Decl(lib.d.ts, 608, 38))
>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 1705, 1))
>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 1706, 1))
>random : Symbol(Math.random, Decl(lib.d.ts, 608, 38))
return () => arguments;
@@ -0,0 +1,12 @@
//// [exportDefaultVariable.ts]
// Regression test for #3018
declare var io: any;
declare module 'module' {
export default io;
}
//// [exportDefaultVariable.js]
// Regression test for #3018
@@ -0,0 +1,11 @@
=== tests/cases/compiler/exportDefaultVariable.ts ===
// Regression test for #3018
declare var io: any;
>io : Symbol(io, Decl(exportDefaultVariable.ts, 2, 11))
declare module 'module' {
export default io;
>io : Symbol(default, Decl(exportDefaultVariable.ts, 2, 11))
}
@@ -0,0 +1,11 @@
=== tests/cases/compiler/exportDefaultVariable.ts ===
// Regression test for #3018
declare var io: any;
>io : any
declare module 'module' {
export default io;
>io : any
}
+2 -2
View File
@@ -4,6 +4,6 @@ var v: string;
for (v of [""].values()) { }
>v : Symbol(v, Decl(for-of13.ts, 0, 3))
>[""].values : Symbol(Array.values, Decl(lib.d.ts, 1464, 37))
>values : Symbol(Array.values, Decl(lib.d.ts, 1464, 37))
>[""].values : Symbol(Array.values, Decl(lib.d.ts, 1465, 37))
>values : Symbol(Array.values, Decl(lib.d.ts, 1465, 37))
+3 -3
View File
@@ -22,9 +22,9 @@ class StringIterator {
};
}
[Symbol.iterator]() {
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1247, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1197, 53), Decl(lib.d.ts, 1303, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1247, 31))
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1248, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1198, 53), Decl(lib.d.ts, 1304, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1248, 31))
return this;
>this : Symbol(StringIterator, Decl(for-of18.ts, 1, 33))
+3 -3
View File
@@ -27,9 +27,9 @@ class FooIterator {
};
}
[Symbol.iterator]() {
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1247, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1197, 53), Decl(lib.d.ts, 1303, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1247, 31))
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1248, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1198, 53), Decl(lib.d.ts, 1304, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1248, 31))
return this;
>this : Symbol(FooIterator, Decl(for-of19.ts, 4, 13))
+3 -3
View File
@@ -27,9 +27,9 @@ class FooIterator {
};
}
[Symbol.iterator]() {
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1247, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1197, 53), Decl(lib.d.ts, 1303, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1247, 31))
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1248, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1198, 53), Decl(lib.d.ts, 1304, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1248, 31))
return this;
>this : Symbol(FooIterator, Decl(for-of20.ts, 4, 13))
+3 -3
View File
@@ -27,9 +27,9 @@ class FooIterator {
};
}
[Symbol.iterator]() {
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1247, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1197, 53), Decl(lib.d.ts, 1303, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1247, 31))
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1248, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1198, 53), Decl(lib.d.ts, 1304, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1248, 31))
return this;
>this : Symbol(FooIterator, Decl(for-of21.ts, 4, 13))
+3 -3
View File
@@ -28,9 +28,9 @@ class FooIterator {
};
}
[Symbol.iterator]() {
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1247, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1197, 53), Decl(lib.d.ts, 1303, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1247, 31))
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1248, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1198, 53), Decl(lib.d.ts, 1304, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1248, 31))
return this;
>this : Symbol(FooIterator, Decl(for-of22.ts, 5, 13))
+3 -3
View File
@@ -27,9 +27,9 @@ class FooIterator {
};
}
[Symbol.iterator]() {
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1247, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1197, 53), Decl(lib.d.ts, 1303, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1247, 31))
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1248, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1198, 53), Decl(lib.d.ts, 1304, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1248, 31))
return this;
>this : Symbol(FooIterator, Decl(for-of23.ts, 4, 13))
+3 -3
View File
@@ -10,9 +10,9 @@ class StringIterator {
>StringIterator : Symbol(StringIterator, Decl(for-of25.ts, 1, 37))
[Symbol.iterator]() {
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1247, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1197, 53), Decl(lib.d.ts, 1303, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1247, 31))
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1248, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1198, 53), Decl(lib.d.ts, 1304, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1248, 31))
return x;
>x : Symbol(x, Decl(for-of25.ts, 0, 3))
+3 -3
View File
@@ -16,9 +16,9 @@ class StringIterator {
>x : Symbol(x, Decl(for-of26.ts, 0, 3))
}
[Symbol.iterator]() {
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1247, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1197, 53), Decl(lib.d.ts, 1303, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1247, 31))
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1248, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1198, 53), Decl(lib.d.ts, 1304, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1248, 31))
return this;
>this : Symbol(StringIterator, Decl(for-of26.ts, 1, 37))
+3 -3
View File
@@ -7,7 +7,7 @@ class StringIterator {
>StringIterator : Symbol(StringIterator, Decl(for-of27.ts, 0, 37))
[Symbol.iterator]: any;
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1247, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1197, 53), Decl(lib.d.ts, 1303, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1247, 31))
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1248, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1198, 53), Decl(lib.d.ts, 1304, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1248, 31))
}
+3 -3
View File
@@ -10,9 +10,9 @@ class StringIterator {
>next : Symbol(next, Decl(for-of28.ts, 2, 22))
[Symbol.iterator]() {
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1247, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1197, 53), Decl(lib.d.ts, 1303, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1247, 31))
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1248, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1198, 53), Decl(lib.d.ts, 1304, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1248, 31))
return this;
>this : Symbol(StringIterator, Decl(for-of28.ts, 0, 37))
@@ -1,13 +1,16 @@
tests/cases/conformance/es6/for-ofStatements/for-of33.ts(1,10): error TS7022: 'v' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer.
tests/cases/conformance/es6/for-ofStatements/for-of33.ts(4,5): error TS7023: '[Symbol.iterator]' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.
==== tests/cases/conformance/es6/for-ofStatements/for-of33.ts (1 errors) ====
==== tests/cases/conformance/es6/for-ofStatements/for-of33.ts (2 errors) ====
for (var v of new StringIterator) { }
~
!!! error TS7022: 'v' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer.
class StringIterator {
[Symbol.iterator]() {
~~~~~~~~~~~~~~~~~
!!! error TS7023: '[Symbol.iterator]' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.
return v;
}
}
@@ -1,13 +1,16 @@
tests/cases/conformance/es6/for-ofStatements/for-of34.ts(1,10): error TS7022: 'v' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer.
tests/cases/conformance/es6/for-ofStatements/for-of34.ts(4,5): error TS7023: 'next' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.
==== tests/cases/conformance/es6/for-ofStatements/for-of34.ts (1 errors) ====
==== tests/cases/conformance/es6/for-ofStatements/for-of34.ts (2 errors) ====
for (var v of new StringIterator) { }
~
!!! error TS7022: 'v' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer.
class StringIterator {
next() {
~~~~
!!! error TS7023: 'next' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.
return v;
}
@@ -1,13 +1,16 @@
tests/cases/conformance/es6/for-ofStatements/for-of35.ts(1,10): error TS7022: 'v' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer.
tests/cases/conformance/es6/for-ofStatements/for-of35.ts(4,5): error TS7023: 'next' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.
==== tests/cases/conformance/es6/for-ofStatements/for-of35.ts (1 errors) ====
==== tests/cases/conformance/es6/for-ofStatements/for-of35.ts (2 errors) ====
for (var v of new StringIterator) { }
~
!!! error TS7022: 'v' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer.
class StringIterator {
next() {
~~~~
!!! error TS7023: 'next' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.
return {
done: true,
value: v
+1 -1
View File
@@ -1,7 +1,7 @@
=== tests/cases/conformance/es6/for-ofStatements/for-of37.ts ===
var map = new Map([["", true]]);
>map : Symbol(map, Decl(for-of37.ts, 0, 3))
>Map : Symbol(Map, Decl(lib.d.ts, 1878, 1), Decl(lib.d.ts, 1900, 11))
>Map : Symbol(Map, Decl(lib.d.ts, 1879, 1), Decl(lib.d.ts, 1901, 11))
for (var v of map) {
>v : Symbol(v, Decl(for-of37.ts, 1, 8))
+1 -1
View File
@@ -1,7 +1,7 @@
=== tests/cases/conformance/es6/for-ofStatements/for-of38.ts ===
var map = new Map([["", true]]);
>map : Symbol(map, Decl(for-of38.ts, 0, 3))
>Map : Symbol(Map, Decl(lib.d.ts, 1878, 1), Decl(lib.d.ts, 1900, 11))
>Map : Symbol(Map, Decl(lib.d.ts, 1879, 1), Decl(lib.d.ts, 1901, 11))
for (var [k, v] of map) {
>k : Symbol(k, Decl(for-of38.ts, 1, 10))
+1 -1
View File
@@ -1,7 +1,7 @@
=== tests/cases/conformance/es6/for-ofStatements/for-of40.ts ===
var map = new Map([["", true]]);
>map : Symbol(map, Decl(for-of40.ts, 0, 3))
>Map : Symbol(Map, Decl(lib.d.ts, 1878, 1), Decl(lib.d.ts, 1900, 11))
>Map : Symbol(Map, Decl(lib.d.ts, 1879, 1), Decl(lib.d.ts, 1901, 11))
for (var [k = "", v = false] of map) {
>k : Symbol(k, Decl(for-of40.ts, 1, 10))
+1 -1
View File
@@ -1,7 +1,7 @@
=== tests/cases/conformance/es6/for-ofStatements/for-of44.ts ===
var array: [number, string | boolean | symbol][] = [[0, ""], [0, true], [1, Symbol()]]
>array : Symbol(array, Decl(for-of44.ts, 0, 3))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1197, 53), Decl(lib.d.ts, 1303, 11))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1198, 53), Decl(lib.d.ts, 1304, 11))
for (var [num, strBoolSym] of array) {
>num : Symbol(num, Decl(for-of44.ts, 1, 10))
+1 -1
View File
@@ -5,7 +5,7 @@ var k: string, v: boolean;
var map = new Map([["", true]]);
>map : Symbol(map, Decl(for-of45.ts, 1, 3))
>Map : Symbol(Map, Decl(lib.d.ts, 1878, 1), Decl(lib.d.ts, 1900, 11))
>Map : Symbol(Map, Decl(lib.d.ts, 1879, 1), Decl(lib.d.ts, 1901, 11))
for ([k = "", v = false] of map) {
>k : Symbol(k, Decl(for-of45.ts, 0, 3))
+1 -1
View File
@@ -1,7 +1,7 @@
=== tests/cases/conformance/es6/for-ofStatements/for-of50.ts ===
var map = new Map([["", true]]);
>map : Symbol(map, Decl(for-of50.ts, 0, 3))
>Map : Symbol(Map, Decl(lib.d.ts, 1878, 1), Decl(lib.d.ts, 1900, 11))
>Map : Symbol(Map, Decl(lib.d.ts, 1879, 1), Decl(lib.d.ts, 1901, 11))
for (const [k, v] of map) {
>k : Symbol(k, Decl(for-of50.ts, 1, 12))
+1 -1
View File
@@ -1,7 +1,7 @@
=== tests/cases/conformance/es6/for-ofStatements/for-of57.ts ===
var iter: Iterable<number>;
>iter : Symbol(iter, Decl(for-of57.ts, 0, 3))
>Iterable : Symbol(Iterable, Decl(lib.d.ts, 1674, 1))
>Iterable : Symbol(Iterable, Decl(lib.d.ts, 1675, 1))
for (let num of iter) { }
>num : Symbol(num, Decl(for-of57.ts, 1, 8))
@@ -1,31 +1,35 @@
tests/cases/compiler/implicitAnyFromCircularInference.ts(3,5): error TS7021: 'a' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation.
tests/cases/compiler/implicitAnyFromCircularInference.ts(7,5): error TS7021: 'c' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation.
tests/cases/compiler/implicitAnyFromCircularInference.ts(10,5): error TS7021: 'd' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation.
tests/cases/compiler/implicitAnyFromCircularInference.ts(3,5): error TS2502: 'a' is referenced directly or indirectly in its own type annotation.
tests/cases/compiler/implicitAnyFromCircularInference.ts(6,5): error TS2502: 'b' is referenced directly or indirectly in its own type annotation.
tests/cases/compiler/implicitAnyFromCircularInference.ts(7,5): error TS2502: 'c' is referenced directly or indirectly in its own type annotation.
tests/cases/compiler/implicitAnyFromCircularInference.ts(10,5): error TS2502: 'd' is referenced directly or indirectly in its own type annotation.
tests/cases/compiler/implicitAnyFromCircularInference.ts(15,10): error TS7023: 'g' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.
tests/cases/compiler/implicitAnyFromCircularInference.ts(18,10): error TS7024: Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.
tests/cases/compiler/implicitAnyFromCircularInference.ts(23,10): error TS7024: Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.
tests/cases/compiler/implicitAnyFromCircularInference.ts(26,10): error TS7023: 'h' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.
tests/cases/compiler/implicitAnyFromCircularInference.ts(28,14): error TS7023: 'foo' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.
tests/cases/compiler/implicitAnyFromCircularInference.ts(41,5): error TS7022: 's' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer.
tests/cases/compiler/implicitAnyFromCircularInference.ts(46,5): error TS7023: 'x' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.
==== tests/cases/compiler/implicitAnyFromCircularInference.ts (9 errors) ====
==== tests/cases/compiler/implicitAnyFromCircularInference.ts (11 errors) ====
// Error expected
var a: typeof a;
~
!!! error TS7021: 'a' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation.
!!! error TS2502: 'a' is referenced directly or indirectly in its own type annotation.
// Error expected on b or c
var b: typeof c;
~
!!! error TS2502: 'b' is referenced directly or indirectly in its own type annotation.
var c: typeof b;
~
!!! error TS7021: 'c' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation.
!!! error TS2502: 'c' is referenced directly or indirectly in its own type annotation.
// Error expected
var d: Array<typeof d>;
~
!!! error TS7021: 'd' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation.
!!! error TS2502: 'd' is referenced directly or indirectly in its own type annotation.
function f() { return f; }
@@ -52,6 +56,8 @@ tests/cases/compiler/implicitAnyFromCircularInference.ts(46,5): error TS7023: 'x
!!! error TS7023: 'h' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.
return foo();
function foo() {
~~~
!!! error TS7023: 'foo' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.
return h() || "hello";
}
}
@@ -1,4 +1,4 @@
tests/cases/compiler/importedModuleAddToGlobal.ts(15,23): error TS2304: Cannot find name 'b'.
tests/cases/compiler/importedModuleAddToGlobal.ts(15,23): error TS2503: Cannot find namespace 'b'.
==== tests/cases/compiler/importedModuleAddToGlobal.ts (1 errors) ====
@@ -18,5 +18,5 @@ tests/cases/compiler/importedModuleAddToGlobal.ts(15,23): error TS2304: Cannot f
import a = A;
function hello(): b.B { return null; }
~
!!! error TS2304: Cannot find name 'b'.
!!! error TS2503: Cannot find namespace 'b'.
}
@@ -1,7 +1,7 @@
tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts(5,12): error TS2304: Cannot find name 'V'.
tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts(11,12): error TS2304: Cannot find name 'C'.
tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts(17,12): error TS2304: Cannot find name 'E'.
tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts(23,12): error TS2304: Cannot find name 'I'.
tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts(5,12): error TS2503: Cannot find namespace 'V'.
tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts(11,12): error TS2503: Cannot find namespace 'C'.
tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts(17,12): error TS2503: Cannot find namespace 'E'.
tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts(23,12): error TS2503: Cannot find namespace 'I'.
==== tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts (4 errors) ====
@@ -11,7 +11,7 @@ tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIde
import v = V;
~
!!! error TS2304: Cannot find name 'V'.
!!! error TS2503: Cannot find namespace 'V'.
class C {
name: string;
@@ -19,7 +19,7 @@ tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIde
import c = C;
~
!!! error TS2304: Cannot find name 'C'.
!!! error TS2503: Cannot find namespace 'C'.
enum E {
Red, Blue
@@ -27,7 +27,7 @@ tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIde
import e = E;
~
!!! error TS2304: Cannot find name 'E'.
!!! error TS2503: Cannot find namespace 'E'.
interface I {
id: number;
@@ -35,5 +35,5 @@ tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIde
import i = I;
~
!!! error TS2304: Cannot find name 'I'.
!!! error TS2503: Cannot find namespace 'I'.
@@ -1,6 +1,6 @@
tests/cases/conformance/internalModules/moduleDeclarations/invalidInstantiatedModule.ts(2,18): error TS2300: Duplicate identifier 'Point'.
tests/cases/conformance/internalModules/moduleDeclarations/invalidInstantiatedModule.ts(3,16): error TS2300: Duplicate identifier 'Point'.
tests/cases/conformance/internalModules/moduleDeclarations/invalidInstantiatedModule.ts(12,8): error TS2304: Cannot find name 'm'.
tests/cases/conformance/internalModules/moduleDeclarations/invalidInstantiatedModule.ts(12,8): error TS2503: Cannot find namespace 'm'.
==== tests/cases/conformance/internalModules/moduleDeclarations/invalidInstantiatedModule.ts (3 errors) ====
@@ -21,7 +21,7 @@ tests/cases/conformance/internalModules/moduleDeclarations/invalidInstantiatedMo
var m = M2;
var p: m.Point; // Error
~
!!! error TS2304: Cannot find name 'm'.
!!! error TS2503: Cannot find namespace 'm'.
@@ -13,7 +13,7 @@ class SymbolIterator {
return {
value: Symbol(),
>value : Symbol(value, Decl(iterableArrayPattern1.ts, 3, 16))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1197, 53), Decl(lib.d.ts, 1303, 11))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1198, 53), Decl(lib.d.ts, 1304, 11))
done: false
>done : Symbol(done, Decl(iterableArrayPattern1.ts, 4, 28))
@@ -22,9 +22,9 @@ class SymbolIterator {
}
[Symbol.iterator]() {
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1247, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1197, 53), Decl(lib.d.ts, 1303, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1247, 31))
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1248, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1198, 53), Decl(lib.d.ts, 1304, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1248, 31))
return this;
>this : Symbol(SymbolIterator, Decl(iterableArrayPattern1.ts, 0, 32))
@@ -36,9 +36,9 @@ class FooIterator {
}
[Symbol.iterator]() {
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1247, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1197, 53), Decl(lib.d.ts, 1303, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1247, 31))
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1248, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1198, 53), Decl(lib.d.ts, 1304, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1248, 31))
return this;
>this : Symbol(FooIterator, Decl(iterableArrayPattern11.ts, 3, 27))
@@ -36,9 +36,9 @@ class FooIterator {
}
[Symbol.iterator]() {
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1247, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1197, 53), Decl(lib.d.ts, 1303, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1247, 31))
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1248, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1198, 53), Decl(lib.d.ts, 1304, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1248, 31))
return this;
>this : Symbol(FooIterator, Decl(iterableArrayPattern12.ts, 3, 27))
@@ -35,9 +35,9 @@ class FooIterator {
}
[Symbol.iterator]() {
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1247, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1197, 53), Decl(lib.d.ts, 1303, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1247, 31))
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1248, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1198, 53), Decl(lib.d.ts, 1304, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1248, 31))
return this;
>this : Symbol(FooIterator, Decl(iterableArrayPattern13.ts, 3, 27))
@@ -13,7 +13,7 @@ class SymbolIterator {
return {
value: Symbol(),
>value : Symbol(value, Decl(iterableArrayPattern2.ts, 3, 16))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1197, 53), Decl(lib.d.ts, 1303, 11))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1198, 53), Decl(lib.d.ts, 1304, 11))
done: false
>done : Symbol(done, Decl(iterableArrayPattern2.ts, 4, 28))
@@ -22,9 +22,9 @@ class SymbolIterator {
}
[Symbol.iterator]() {
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1247, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1197, 53), Decl(lib.d.ts, 1303, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1247, 31))
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1248, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1198, 53), Decl(lib.d.ts, 1304, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1248, 31))
return this;
>this : Symbol(SymbolIterator, Decl(iterableArrayPattern2.ts, 0, 35))
@@ -37,9 +37,9 @@ class FooIterator {
}
[Symbol.iterator]() {
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1247, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1197, 53), Decl(lib.d.ts, 1303, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1247, 31))
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1248, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1198, 53), Decl(lib.d.ts, 1304, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1248, 31))
return this;
>this : Symbol(FooIterator, Decl(iterableArrayPattern3.ts, 3, 27))
@@ -4,5 +4,5 @@ const [[k1, v1], [k2, v2]] = new Map([["", true], ["hello", true]])
>v1 : Symbol(v1, Decl(iterableArrayPattern30.ts, 0, 11))
>k2 : Symbol(k2, Decl(iterableArrayPattern30.ts, 0, 18))
>v2 : Symbol(v2, Decl(iterableArrayPattern30.ts, 0, 21))
>Map : Symbol(Map, Decl(lib.d.ts, 1878, 1), Decl(lib.d.ts, 1900, 11))
>Map : Symbol(Map, Decl(lib.d.ts, 1879, 1), Decl(lib.d.ts, 1901, 11))
@@ -37,9 +37,9 @@ class FooIterator {
}
[Symbol.iterator]() {
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1247, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1197, 53), Decl(lib.d.ts, 1303, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1247, 31))
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1248, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1198, 53), Decl(lib.d.ts, 1304, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1248, 31))
return this;
>this : Symbol(FooIterator, Decl(iterableArrayPattern4.ts, 3, 27))
@@ -32,9 +32,9 @@ class FooIterator {
}
[Symbol.iterator]() {
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1247, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1197, 53), Decl(lib.d.ts, 1303, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1247, 31))
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1248, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1198, 53), Decl(lib.d.ts, 1304, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1248, 31))
return this;
>this : Symbol(FooIterator, Decl(iterableArrayPattern9.ts, 2, 27))
@@ -1,7 +1,7 @@
=== tests/cases/conformance/expressions/contextualTyping/iterableContextualTyping1.ts ===
var iter: Iterable<(x: string) => number> = [s => s.length];
>iter : Symbol(iter, Decl(iterableContextualTyping1.ts, 0, 3))
>Iterable : Symbol(Iterable, Decl(lib.d.ts, 1674, 1))
>Iterable : Symbol(Iterable, Decl(lib.d.ts, 1675, 1))
>x : Symbol(x, Decl(iterableContextualTyping1.ts, 0, 20))
>s : Symbol(s, Decl(iterableContextualTyping1.ts, 0, 45))
>s.length : Symbol(String.length, Decl(lib.d.ts, 414, 19))
@@ -12,7 +12,7 @@ class SymbolIterator {
return {
value: Symbol(),
>value : Symbol(value, Decl(iteratorSpreadInArray.ts, 4, 16))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1197, 53), Decl(lib.d.ts, 1303, 11))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1198, 53), Decl(lib.d.ts, 1304, 11))
done: false
>done : Symbol(done, Decl(iteratorSpreadInArray.ts, 5, 28))
@@ -21,9 +21,9 @@ class SymbolIterator {
}
[Symbol.iterator]() {
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1247, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1197, 53), Decl(lib.d.ts, 1303, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1247, 31))
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1248, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1198, 53), Decl(lib.d.ts, 1304, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1248, 31))
return this;
>this : Symbol(SymbolIterator, Decl(iteratorSpreadInArray.ts, 0, 36))
@@ -1,7 +1,7 @@
=== tests/cases/conformance/es6/spread/iteratorSpreadInArray11.ts ===
var iter: Iterable<number>;
>iter : Symbol(iter, Decl(iteratorSpreadInArray11.ts, 0, 3))
>Iterable : Symbol(Iterable, Decl(lib.d.ts, 1674, 1))
>Iterable : Symbol(Iterable, Decl(lib.d.ts, 1675, 1))
var array = [...iter];
>array : Symbol(array, Decl(iteratorSpreadInArray11.ts, 1, 3))
@@ -13,7 +13,7 @@ class SymbolIterator {
return {
value: Symbol(),
>value : Symbol(value, Decl(iteratorSpreadInArray2.ts, 4, 16))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1197, 53), Decl(lib.d.ts, 1303, 11))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1198, 53), Decl(lib.d.ts, 1304, 11))
done: false
>done : Symbol(done, Decl(iteratorSpreadInArray2.ts, 5, 28))
@@ -22,9 +22,9 @@ class SymbolIterator {
}
[Symbol.iterator]() {
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1247, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1197, 53), Decl(lib.d.ts, 1303, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1247, 31))
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1248, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1198, 53), Decl(lib.d.ts, 1304, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1248, 31))
return this;
>this : Symbol(SymbolIterator, Decl(iteratorSpreadInArray2.ts, 0, 59))
@@ -48,9 +48,9 @@ class NumberIterator {
}
[Symbol.iterator]() {
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1247, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1197, 53), Decl(lib.d.ts, 1303, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1247, 31))
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1248, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1198, 53), Decl(lib.d.ts, 1304, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1248, 31))
return this;
>this : Symbol(NumberIterator, Decl(iteratorSpreadInArray2.ts, 13, 1))

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