Update LKG

This commit is contained in:
Mohamed Hegazy 2018-05-24 13:50:41 -07:00
parent 9164261183
commit b23671b96b
9 changed files with 1487 additions and 1009 deletions

View File

@ -974,15 +974,6 @@ var ts;
return to;
}
ts.addRange = addRange;
function prependRange(to, from) {
if (from === undefined || from.length === 0)
return to;
if (to === undefined)
return from.slice();
to.unshift.apply(to, from);
return to;
}
ts.prependRange = prependRange;
function pushIfUnique(array, toAdd, equalityComparer) {
if (contains(array, toAdd, equalityComparer)) {
return false;
@ -1729,6 +1720,14 @@ var ts;
return moduleResolution;
}
ts.getEmitModuleResolutionKind = getEmitModuleResolutionKind;
function unreachableCodeIsError(options) {
return options.allowUnreachableCode === false;
}
ts.unreachableCodeIsError = unreachableCodeIsError;
function unusedLabelIsError(options) {
return options.allowUnusedLabels === false;
}
ts.unusedLabelIsError = unusedLabelIsError;
function getAreDeclarationMapsEnabled(options) {
return !!(options.declaration && options.declarationMap);
}
@ -4198,7 +4197,7 @@ var ts;
_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible: diag(2692, ts.DiagnosticCategory.Error, "_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible_2692", "'{0}' is a primitive, but '{1}' is a wrapper object. Prefer using '{0}' when possible."),
_0_only_refers_to_a_type_but_is_being_used_as_a_value_here: diag(2693, ts.DiagnosticCategory.Error, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_2693", "'{0}' only refers to a type, but is being used as a value here."),
Namespace_0_has_no_exported_member_1: diag(2694, ts.DiagnosticCategory.Error, "Namespace_0_has_no_exported_member_1_2694", "Namespace '{0}' has no exported member '{1}'."),
Left_side_of_comma_operator_is_unused_and_has_no_side_effects: diag(2695, ts.DiagnosticCategory.Error, "Left_side_of_comma_operator_is_unused_and_has_no_side_effects_2695", "Left side of comma operator is unused and has no side effects."),
Left_side_of_comma_operator_is_unused_and_has_no_side_effects: diag(2695, ts.DiagnosticCategory.Error, "Left_side_of_comma_operator_is_unused_and_has_no_side_effects_2695", "Left side of comma operator is unused and has no side effects.", true),
The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead: diag(2696, ts.DiagnosticCategory.Error, "The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead_2696", "The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?"),
An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: diag(2697, ts.DiagnosticCategory.Error, "An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_in_2697", "An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option."),
Spread_types_may_only_be_created_from_object_types: diag(2698, ts.DiagnosticCategory.Error, "Spread_types_may_only_be_created_from_object_types_2698", "Spread types may only be created from object types."),
@ -4554,7 +4553,7 @@ var ts;
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: diag(7024, ts.DiagnosticCategory.Error, "Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_ref_7024", "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."),
Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type: diag(7025, ts.DiagnosticCategory.Error, "Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_typ_7025", "Generator implicitly has type '{0}' because it does not yield any values. Consider supplying a return type."),
JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists: diag(7026, ts.DiagnosticCategory.Error, "JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists_7026", "JSX element implicitly has type 'any' because no interface 'JSX.{0}' exists."),
Unreachable_code_detected: diag(7027, ts.DiagnosticCategory.Error, "Unreachable_code_detected_7027", "Unreachable code detected."),
Unreachable_code_detected: diag(7027, ts.DiagnosticCategory.Error, "Unreachable_code_detected_7027", "Unreachable code detected.", true),
Unused_label: diag(7028, ts.DiagnosticCategory.Error, "Unused_label_7028", "Unused label.", true),
Fallthrough_case_in_switch: diag(7029, ts.DiagnosticCategory.Error, "Fallthrough_case_in_switch_7029", "Fallthrough case in switch."),
Not_all_code_paths_return_a_value: diag(7030, ts.DiagnosticCategory.Error, "Not_all_code_paths_return_a_value_7030", "Not all code paths return a value."),
@ -6602,6 +6601,19 @@ var ts;
return !nodeIsMissing(node);
}
ts.nodeIsPresent = nodeIsPresent;
function prependStatements(to, from) {
if (from === undefined || from.length === 0)
return to;
if (to === undefined)
return from.slice();
var prologue = to.length && isPrologueDirective(to[0]) && to.shift();
to.unshift.apply(to, from);
if (prologue) {
to.unshift(prologue);
}
return to;
}
ts.prependStatements = prependStatements;
function isRecognizedTripleSlashComment(text, commentPos, commentEnd) {
if (text.charCodeAt(commentPos + 1) === 47 &&
commentPos + 2 < commentEnd &&
@ -12428,6 +12440,7 @@ var ts;
nodeCount++;
sourceFile.text = sourceText;
sourceFile.bindDiagnostics = [];
sourceFile.bindSuggestionDiagnostics = undefined;
sourceFile.languageVersion = languageVersion;
sourceFile.fileName = ts.normalizePath(fileName);
sourceFile.languageVariant = getLanguageVariant(scriptKind);
@ -18323,7 +18336,7 @@ var ts;
bind(node.statement);
popActiveLabel();
if (!activeLabel.referenced && !options.allowUnusedLabels) {
file.bindDiagnostics.push(createDiagnosticForNode(node.label, ts.Diagnostics.Unused_label));
errorOrSuggestionOnFirstToken(ts.unusedLabelIsError(options), node, ts.Diagnostics.Unused_label);
}
if (!node.statement || node.statement.kind !== 217) {
addAntecedent(postStatementLabel, currentFlow);
@ -18864,6 +18877,16 @@ var ts;
var span = ts.getSpanOfTokenAtPosition(file, node.pos);
file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, message, arg0, arg1, arg2));
}
function errorOrSuggestionOnFirstToken(isError, node, message, arg0, arg1, arg2) {
var span = ts.getSpanOfTokenAtPosition(file, node.pos);
var diag = ts.createFileDiagnostic(file, span.start, span.length, message, arg0, arg1, arg2);
if (isError) {
file.bindDiagnostics.push(diag);
}
else {
file.bindSuggestionDiagnostics = ts.append(file.bindSuggestionDiagnostics, __assign({}, diag, { category: ts.DiagnosticCategory.Suggestion }));
}
}
function bind(node) {
if (!node) {
return;
@ -19495,13 +19518,13 @@ var ts;
(node.kind === 237 && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums));
if (reportError) {
currentFlow = reportedUnreachableFlow;
var reportUnreachableCode = !options.allowUnreachableCode &&
!(node.flags & 4194304) &&
(node.kind !== 213 ||
ts.getCombinedNodeFlags(node.declarationList) & 3 ||
ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; }));
if (reportUnreachableCode) {
errorOnFirstToken(node, ts.Diagnostics.Unreachable_code_detected);
if (!options.allowUnreachableCode) {
var isError = ts.unreachableCodeIsError(options) &&
!(node.flags & 4194304) &&
(!ts.isVariableStatement(node) ||
!!(ts.getCombinedNodeFlags(node.declarationList) & 3) ||
node.declarationList.declarations.some(function (d) { return !!d.initializer; }));
errorOrSuggestionOnFirstToken(isError, node, ts.Diagnostics.Unreachable_code_detected);
}
}
}
@ -23400,7 +23423,7 @@ var ts;
}
function isAccessible(symbolFromSymbolTable, resolvedAliasSymbol, ignoreQualification) {
return symbol === (resolvedAliasSymbol || symbolFromSymbolTable) &&
!ts.some(symbolFromSymbolTable.declarations, hasExternalModuleSymbol) &&
!ts.some(symbolFromSymbolTable.declarations, hasNonGlobalAugmentationExternalModuleSymbol) &&
(ignoreQualification || canQualifySymbol(symbolFromSymbolTable, meaning));
}
function trySymbolTable(symbols, ignoreQualification) {
@ -23423,13 +23446,18 @@ var ts;
return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports);
}
}
if (symbolFromSymbolTable.escapedName === symbol.escapedName && symbolFromSymbolTable.exportSymbol) {
if (isAccessible(getMergedSymbol(symbolFromSymbolTable.exportSymbol), undefined, ignoreQualification)) {
return [symbol];
}
}
});
}
}
function needsQualification(symbol, enclosingDeclaration, meaning) {
var qualify = false;
forEachSymbolTableInScope(enclosingDeclaration, function (symbolTable) {
var symbolFromSymbolTable = symbolTable.get(symbol.escapedName);
var symbolFromSymbolTable = getMergedSymbol(symbolTable.get(symbol.escapedName));
if (!symbolFromSymbolTable) {
return false;
}
@ -23489,7 +23517,7 @@ var ts;
return hasAccessibleDeclarations;
}
else {
if (ts.some(symbol.declarations, hasExternalModuleSymbol)) {
if (ts.some(symbol.declarations, hasNonGlobalAugmentationExternalModuleSymbol)) {
return {
accessibility: 0
};
@ -23523,6 +23551,9 @@ var ts;
function hasExternalModuleSymbol(declaration) {
return ts.isAmbientModule(declaration) || (declaration.kind === 273 && ts.isExternalOrCommonJsModule(declaration));
}
function hasNonGlobalAugmentationExternalModuleSymbol(declaration) {
return ts.isModuleWithStringLiteralName(declaration) || (declaration.kind === 273 && ts.isExternalOrCommonJsModule(declaration));
}
function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) {
var aliasesToMakeVisible;
if (ts.forEach(symbol.declarations, function (declaration) { return !getIsDeclarationVisible(declaration); })) {
@ -23806,8 +23837,9 @@ var ts;
!isTypeSymbolAccessible(type.symbol, context.enclosingDeclaration)) {
return ts.createTypeReferenceNode(ts.getGeneratedNameForNode(type.symbol.declarations[0].name, 16 | 8), undefined);
}
var name = type.symbol ? symbolToName(type.symbol, context, 67901928, false) : ts.createIdentifier("?");
return ts.createTypeReferenceNode(name, undefined);
return type.symbol
? symbolToTypeNode(type.symbol, context, 67901928)
: ts.createTypeReferenceNode(ts.createIdentifier("?"), undefined);
}
if (!inTypeAlias && type.aliasSymbol && (context.flags & 16384 || isTypeSymbolAccessible(type.aliasSymbol, context.enclosingDeclaration))) {
var typeArgumentNodes = mapToTypeNodes(type.aliasTypeArguments, context);
@ -24274,7 +24306,7 @@ var ts;
return accessibleSymbolChain;
}
if (endOfChain ||
(yieldModuleSymbol || !(!parentSymbol && ts.forEach(symbol.declarations, hasExternalModuleSymbol))) &&
(yieldModuleSymbol || !(!parentSymbol && ts.forEach(symbol.declarations, hasNonGlobalAugmentationExternalModuleSymbol))) &&
!(symbol.flags & (2048 | 4096))) {
return [symbol];
}
@ -28790,7 +28822,9 @@ var ts;
return type;
}
function getRegularTypeOfLiteralType(type) {
return type.flags & 96 && type.flags & 8388608 ? type.regularType : type;
return type.flags & 96 && type.flags & 8388608 ? type.regularType :
type.flags & 131072 ? getUnionType(ts.sameMap(type.types, getRegularTypeOfLiteralType)) :
type;
}
function getLiteralType(value, enumId, symbol) {
var qualifier = typeof value === "number" ? "#" : "@";
@ -31631,10 +31665,12 @@ var ts;
}
function getCovariantInference(inference, context, signature) {
var candidates = widenObjectLiteralCandidates(inference.candidates);
var widenLiteralTypes = inference.topLevel &&
!hasPrimitiveConstraint(inference.typeParameter) &&
var primitiveConstraint = hasPrimitiveConstraint(inference.typeParameter);
var widenLiteralTypes = !primitiveConstraint && inference.topLevel &&
(inference.isFixed || !isTypeParameterAtTopLevel(getReturnTypeOfSignature(signature), inference.typeParameter));
var baseCandidates = widenLiteralTypes ? ts.sameMap(candidates, getWidenedLiteralType) : candidates;
var baseCandidates = primitiveConstraint ? ts.sameMap(candidates, getRegularTypeOfLiteralType) :
widenLiteralTypes ? ts.sameMap(candidates, getWidenedLiteralType) :
candidates;
var unwidenedType = context.flags & 1 || inference.priority & 28 ?
getUnionType(baseCandidates, 2) :
getCommonSupertype(baseCandidates);
@ -33580,6 +33616,22 @@ var ts;
return getContextualType(attribute.parent);
}
}
function isPossiblyDiscriminantValue(node) {
switch (node.kind) {
case 9:
case 8:
case 13:
case 101:
case 86:
case 95:
case 71:
return true;
case 184:
case 190:
return isPossiblyDiscriminantValue(node.expression);
}
return false;
}
function getApparentTypeOfContextualType(node) {
var contextualType = getContextualType(node);
contextualType = contextualType && mapType(contextualType, getApparentType);
@ -33593,8 +33645,8 @@ var ts;
continue;
if (prop.kind !== 269)
continue;
if (isDiscriminantProperty(contextualType, prop.symbol.escapedName)) {
var discriminatingType = getTypeOfNode(prop.initializer);
if (isPossiblyDiscriminantValue(prop.initializer) && isDiscriminantProperty(contextualType, prop.symbol.escapedName)) {
var discriminatingType = checkExpression(prop.initializer);
for (var _b = 0, _c = contextualType.types; _b < _c.length; _b++) {
var type = _c[_b];
var targetType = getTypeOfPropertyOfType(type, prop.symbol.escapedName);
@ -37424,14 +37476,6 @@ var ts;
}
return widened;
}
function isTypeParameterWithKeyofConstraint(type) {
if (type.flags & 32768) {
var constraintDeclaration = getConstraintDeclaration(type);
return constraintDeclaration && constraintDeclaration.kind === 174 &&
constraintDeclaration.operator === 128;
}
return false;
}
function isLiteralOfContextualType(candidateType, contextualType) {
if (contextualType) {
if (contextualType.flags & 393216) {
@ -37440,11 +37484,9 @@ var ts;
}
if (contextualType.flags & 7372800) {
var constraint = getBaseConstraintOfType(contextualType) || emptyObjectType;
return isTypeParameterWithKeyofConstraint(contextualType) && maybeTypeOfKind(candidateType, 32 | 64 | 1024) ||
constraint.flags & 2 && maybeTypeOfKind(candidateType, 32) ||
constraint.flags & 4 && maybeTypeOfKind(candidateType, 64) ||
constraint.flags & 8 && maybeTypeOfKind(candidateType, 128) ||
constraint.flags & 512 && maybeTypeOfKind(candidateType, 1024) ||
return maybeTypeOfKind(constraint, 2) && maybeTypeOfKind(candidateType, 32) ||
maybeTypeOfKind(constraint, 4) && maybeTypeOfKind(candidateType, 64) ||
maybeTypeOfKind(constraint, 512) && maybeTypeOfKind(candidateType, 1024) ||
isLiteralOfContextualType(candidateType, constraint);
}
return contextualType.flags & (32 | 524288) && maybeTypeOfKind(candidateType, 32) ||
@ -42003,7 +42045,7 @@ var ts;
}
}
if (!typeSymbol) {
return ts.TypeReferenceSerializationKind.ObjectType;
return ts.TypeReferenceSerializationKind.Unknown;
}
var type = getDeclaredTypeOfSymbol(typeSymbol);
if (type === unknownType) {
@ -45682,6 +45724,8 @@ var ts;
updated.parseDiagnostics = node.parseDiagnostics;
if (node.bindDiagnostics !== undefined)
updated.bindDiagnostics = node.bindDiagnostics;
if (node.bindSuggestionDiagnostics !== undefined)
updated.bindSuggestionDiagnostics = node.bindSuggestionDiagnostics;
if (node.lineMap !== undefined)
updated.lineMap = node.lineMap;
if (node.classifiableNames !== undefined)
@ -47989,7 +48033,7 @@ var ts;
}
return ts.isNodeArray(statements)
? ts.setTextRange(ts.createNodeArray(ts.concatenate(declarations, statements)), statements)
: ts.prependRange(statements, declarations);
: ts.prependStatements(statements, declarations);
}
ts.mergeLexicalEnvironment = mergeLexicalEnvironment;
function liftToBlock(nodes) {
@ -49014,7 +49058,7 @@ var ts;
statement.pos = closingBraceLocation.pos;
ts.setEmitFlags(statement, 1536 | 384);
statements.push(statement);
ts.prependRange(statements, context.endLexicalEnvironment());
ts.prependStatements(statements, context.endLexicalEnvironment());
var iife = ts.createImmediatelyInvokedArrowFunction(statements);
ts.setEmitFlags(iife, 33554432);
var varStatement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([
@ -49604,7 +49648,8 @@ var ts;
return serializedUnion || ts.createVoidZero();
}
function serializeTypeReferenceNode(node) {
switch (resolver.getTypeReferenceSerializationKind(node.typeName, currentScope)) {
var kind = resolver.getTypeReferenceSerializationKind(node.typeName, currentScope);
switch (kind) {
case ts.TypeReferenceSerializationKind.Unknown:
var serialized = serializeEntityNameAsExpression(node.typeName, true);
var temp = ts.createTempVariable(hoistVariableDeclaration);
@ -49630,8 +49675,9 @@ var ts;
case ts.TypeReferenceSerializationKind.Promise:
return ts.createIdentifier("Promise");
case ts.TypeReferenceSerializationKind.ObjectType:
default:
return ts.createIdentifier("Object");
default:
return ts.Debug.assertNever(kind);
}
}
function serializeEntityNameAsExpression(node, useFallback) {
@ -49900,7 +49946,7 @@ var ts;
var statements = [];
startLexicalEnvironment();
var members = ts.map(node.members, transformEnumMember);
ts.prependRange(statements, endLexicalEnvironment());
ts.prependStatements(statements, endLexicalEnvironment());
ts.addRange(statements, members);
currentNamespaceContainerName = savedCurrentNamespaceLocalName;
return ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), node.members), true);
@ -50045,7 +50091,7 @@ var ts;
var moduleBlock = getInnerMostModuleDeclarationFromDottedModule(node).body;
statementsLocation = ts.moveRangePos(moduleBlock.statements, -1);
}
ts.prependRange(statements, endLexicalEnvironment());
ts.prependStatements(statements, endLexicalEnvironment());
currentNamespaceContainerName = savedCurrentNamespaceContainerName;
currentNamespace = savedCurrentNamespace;
currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName;
@ -50611,7 +50657,7 @@ var ts;
var statements = [];
var statementOffset = ts.addPrologue(statements, node.body.statements, false, visitor);
statements.push(ts.createReturn(createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformAsyncFunctionBodyWorker(node.body, statementOffset))));
ts.prependRange(statements, endLexicalEnvironment());
ts.prependStatements(statements, endLexicalEnvironment());
var block = ts.createBlock(statements, true);
ts.setTextRange(block, node.body);
if (languageVersion >= 2) {
@ -51118,7 +51164,7 @@ var ts;
var statementOffset = ts.addPrologue(statements, node.body.statements, false, visitor);
appendObjectRestAssignmentsIfNeeded(statements, node);
statements.push(ts.createReturn(createAsyncGeneratorHelper(context, ts.createFunctionExpression(undefined, ts.createToken(39), node.name && ts.getGeneratedNameForNode(node.name), undefined, [], undefined, ts.updateBlock(node.body, ts.visitLexicalEnvironment(node.body.statements, visitor, context, statementOffset))))));
ts.prependRange(statements, endLexicalEnvironment());
ts.prependStatements(statements, endLexicalEnvironment());
var block = ts.updateBlock(node.body, statements);
if (languageVersion >= 2) {
if (resolver.getNodeCheckFlags(node) & 4096) {
@ -51144,7 +51190,7 @@ var ts;
var leadingStatements = endLexicalEnvironment();
if (statementOffset > 0 || ts.some(statements) || ts.some(leadingStatements)) {
var block = ts.convertToFunctionBody(body, true);
ts.prependRange(statements, leadingStatements);
ts.prependStatements(statements, leadingStatements);
ts.addRange(statements, block.statements.slice(statementOffset));
return ts.updateBlock(block, ts.setTextRange(ts.createNodeArray(statements), block.statements));
}
@ -52009,7 +52055,7 @@ var ts;
if (taggedTemplateStringDeclarations) {
statements.push(ts.createVariableStatement(undefined, ts.createVariableDeclarationList(taggedTemplateStringDeclarations)));
}
ts.prependRange(statements, endLexicalEnvironment());
ts.prependStatements(statements, endLexicalEnvironment());
exitSubtree(ancestorFacts, 0, 0);
return ts.updateSourceFileNode(node, ts.setTextRange(ts.createNodeArray(statements), node.statements));
}
@ -52178,7 +52224,7 @@ var ts;
statement.pos = closingBraceLocation.pos;
ts.setEmitFlags(statement, 1536 | 384);
statements.push(statement);
ts.prependRange(statements, endLexicalEnvironment());
ts.prependStatements(statements, endLexicalEnvironment());
var block = ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), node.members), true);
ts.setEmitFlags(block, 1536);
return block;
@ -52241,7 +52287,7 @@ var ts;
&& !(constructor && isSufficientlyCoveredByReturnStatements(constructor.body))) {
statements.push(ts.createReturn(ts.createFileLevelUniqueName("_this")));
}
ts.prependRange(statements, endLexicalEnvironment());
ts.prependStatements(statements, endLexicalEnvironment());
if (constructor) {
prependCaptureNewTargetIfNeeded(statements, constructor, false);
}
@ -52643,7 +52689,7 @@ var ts;
closeBraceLocation = body;
}
var lexicalEnvironment = context.endLexicalEnvironment();
ts.prependRange(statements, lexicalEnvironment);
ts.prependStatements(statements, lexicalEnvironment);
prependCaptureNewTargetIfNeeded(statements, node, false);
if (!multiLine && lexicalEnvironment && lexicalEnvironment.length) {
multiLine = true;
@ -53048,7 +53094,7 @@ var ts;
if (loopOutParameters.length) {
copyOutParameters(loopOutParameters, 1, statements_4);
}
ts.prependRange(statements_4, lexicalEnvironment);
ts.prependStatements(statements_4, lexicalEnvironment);
loopBody = ts.createBlock(statements_4, true);
}
if (ts.isBlock(loopBody)) {
@ -54042,7 +54088,7 @@ var ts;
var statementOffset = ts.addPrologue(statements, body.statements, false, visitor);
transformAndEmitStatements(body.statements, statementOffset);
var buildResult = build();
ts.prependRange(statements, endLexicalEnvironment());
ts.prependStatements(statements, endLexicalEnvironment());
statements.push(ts.createReturn(buildResult));
inGeneratorFunctionBody = savedInGeneratorFunctionBody;
inStatementContainingYield = savedInStatementContainingYield;
@ -55508,7 +55554,7 @@ var ts;
ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement));
ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset));
addExportEqualsIfNeeded(statements, false);
ts.prependRange(statements, endLexicalEnvironment());
ts.prependStatements(statements, endLexicalEnvironment());
var updated = ts.updateSourceFileNode(node, ts.setTextRange(ts.createNodeArray(statements), node.statements));
if (currentModuleInfo.hasExportStarsToExportValues && !compilerOptions.importHelpers) {
ts.addEmitHelper(updated, exportStarHelper);
@ -55623,7 +55669,7 @@ var ts;
}
ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset));
addExportEqualsIfNeeded(statements, true);
ts.prependRange(statements, endLexicalEnvironment());
ts.prependStatements(statements, endLexicalEnvironment());
var body = ts.createBlock(statements, true);
if (currentModuleInfo.hasExportStarsToExportValues && !compilerOptions.importHelpers) {
ts.addEmitHelper(body, exportStarHelper);
@ -56427,7 +56473,7 @@ var ts;
ts.visitNode(moduleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement);
var executeStatements = ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset);
ts.addRange(statements, hoistedStatements);
ts.prependRange(statements, endLexicalEnvironment());
ts.prependStatements(statements, endLexicalEnvironment());
var exportStarFunction = addExportStarIfNeeded(statements);
var moduleObject = ts.createObjectLiteral([
ts.createPropertyAssignment("setters", createSettersArray(exportStarFunction, dependencyGroups)),
@ -63106,8 +63152,7 @@ var ts;
}
ts.isProgramUptoDate = isProgramUptoDate;
function getConfigFileParsingDiagnostics(configFileParseResult) {
return configFileParseResult.options.configFile ?
configFileParseResult.options.configFile.parseDiagnostics.concat(configFileParseResult.errors) :
return configFileParseResult.options.configFile ? configFileParseResult.options.configFile.parseDiagnostics.concat(configFileParseResult.errors) :
configFileParseResult.errors;
}
ts.getConfigFileParsingDiagnostics = getConfigFileParsingDiagnostics;
@ -63760,11 +63805,19 @@ var ts;
var checkDiagnostics = includeBindAndCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : ts.emptyArray;
var fileProcessingDiagnosticsInFile = fileProcessingDiagnostics.getDiagnostics(sourceFile.fileName);
var programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName);
var diagnostics = bindDiagnostics.concat(checkDiagnostics, fileProcessingDiagnosticsInFile, programDiagnosticsInFile);
if (isCheckJs) {
diagnostics = ts.concatenate(diagnostics, sourceFile.jsDocDiagnostics);
var diagnostics;
for (var _i = 0, _a = [bindDiagnostics, checkDiagnostics, fileProcessingDiagnosticsInFile, programDiagnosticsInFile, isCheckJs ? sourceFile.jsDocDiagnostics : undefined]; _i < _a.length; _i++) {
var diags = _a[_i];
if (diags) {
for (var _b = 0, diags_1 = diags; _b < diags_1.length; _b++) {
var diag = diags_1[_b];
if (shouldReportDiagnostic(diag)) {
diagnostics = ts.append(diagnostics, diag);
}
}
}
}
return ts.filter(diagnostics, shouldReportDiagnostic);
return diagnostics;
});
}
function shouldReportDiagnostic(diagnostic) {

File diff suppressed because it is too large Load Diff

View File

@ -1734,9 +1734,10 @@ declare namespace ts {
emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean, customTransformers?: CustomTransformers): EmitResult;
getOptionsDiagnostics(cancellationToken?: CancellationToken): ReadonlyArray<Diagnostic>;
getGlobalDiagnostics(cancellationToken?: CancellationToken): ReadonlyArray<Diagnostic>;
getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray<Diagnostic>;
getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray<DiagnosticWithLocation>;
/** The first time this is called, it will return global diagnostics (no location). */
getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray<Diagnostic>;
getDeclarationDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray<Diagnostic>;
getDeclarationDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray<DiagnosticWithLocation>;
getConfigFileParsingDiagnostics(): ReadonlyArray<Diagnostic>;
/**
* Gets a type checker that can be used to semantically analyze source files in the program.
@ -2359,6 +2360,11 @@ declare namespace ts {
code: number;
source?: string;
}
interface DiagnosticWithLocation extends Diagnostic {
file: SourceFile;
start: number;
length: number;
}
enum DiagnosticCategory {
Warning = 0,
Error = 1,
@ -2754,7 +2760,7 @@ declare namespace ts {
/** Gets the transformed source files. */
transformed: T[];
/** Gets diagnostics for the transformation. */
diagnostics?: Diagnostic[];
diagnostics?: DiagnosticWithLocation[];
/**
* Gets a substitute for a node, if one is available; otherwise, returns the original node.
*
@ -2960,7 +2966,7 @@ declare namespace ts {
}
declare namespace ts {
function isExternalModuleNameRelative(moduleName: string): boolean;
function sortAndDeduplicateDiagnostics(diagnostics: ReadonlyArray<Diagnostic>): Diagnostic[];
function sortAndDeduplicateDiagnostics<T extends Diagnostic>(diagnostics: ReadonlyArray<T>): T[];
}
declare function setTimeout(handler: (...args: any[]) => void, timeout: number): any;
declare function clearTimeout(handle: any): void;
@ -4497,9 +4503,10 @@ declare namespace ts {
}
interface LanguageService {
cleanupSemanticCache(): void;
getSyntacticDiagnostics(fileName: string): Diagnostic[];
getSyntacticDiagnostics(fileName: string): DiagnosticWithLocation[];
/** The first time this is called, it will return global diagnostics (no location). */
getSemanticDiagnostics(fileName: string): Diagnostic[];
getSuggestionDiagnostics(fileName: string): Diagnostic[];
getSuggestionDiagnostics(fileName: string): DiagnosticWithLocation[];
getCompilerOptionsDiagnostics(): Diagnostic[];
/**
* @deprecated Use getEncodedSyntacticClassifications instead.
@ -8127,7 +8134,6 @@ declare namespace ts.server {
syntaxOnly?: boolean;
}
class ProjectService {
private readonly documentRegistry;
/**
* Container of all known scripts
*/
@ -8176,7 +8182,7 @@ declare namespace ts.server {
private safelist;
private legacySafelist;
private pendingProjectUpdates;
readonly currentDirectory: string;
readonly currentDirectory: NormalizedPath;
readonly toCanonicalFileName: (f: string) => string;
readonly host: ServerHost;
readonly logger: Logger;
@ -8391,6 +8397,7 @@ declare namespace ts.server {
suppressDiagnosticEvents?: boolean;
syntaxOnly?: boolean;
throttleWaitMilliseconds?: number;
noGetErrOnBackgroundUpdate?: boolean;
globalPlugins?: ReadonlyArray<string>;
pluginProbeLocations?: ReadonlyArray<string>;
allowLocalPluginLoads?: boolean;
@ -8410,6 +8417,7 @@ declare namespace ts.server {
protected canUseEvents: boolean;
private suppressDiagnosticEvents?;
private eventHandler;
private readonly noGetErrOnBackgroundUpdate?;
constructor(opts: SessionOptions);
private sendRequestCompletedEvent;
private defaultEventHandler;

File diff suppressed because it is too large Load Diff

19
lib/typescript.d.ts vendored
View File

@ -1734,9 +1734,10 @@ declare namespace ts {
emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean, customTransformers?: CustomTransformers): EmitResult;
getOptionsDiagnostics(cancellationToken?: CancellationToken): ReadonlyArray<Diagnostic>;
getGlobalDiagnostics(cancellationToken?: CancellationToken): ReadonlyArray<Diagnostic>;
getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray<Diagnostic>;
getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray<DiagnosticWithLocation>;
/** The first time this is called, it will return global diagnostics (no location). */
getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray<Diagnostic>;
getDeclarationDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray<Diagnostic>;
getDeclarationDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray<DiagnosticWithLocation>;
getConfigFileParsingDiagnostics(): ReadonlyArray<Diagnostic>;
/**
* Gets a type checker that can be used to semantically analyze source files in the program.
@ -2359,6 +2360,11 @@ declare namespace ts {
code: number;
source?: string;
}
interface DiagnosticWithLocation extends Diagnostic {
file: SourceFile;
start: number;
length: number;
}
enum DiagnosticCategory {
Warning = 0,
Error = 1,
@ -2754,7 +2760,7 @@ declare namespace ts {
/** Gets the transformed source files. */
transformed: T[];
/** Gets diagnostics for the transformation. */
diagnostics?: Diagnostic[];
diagnostics?: DiagnosticWithLocation[];
/**
* Gets a substitute for a node, if one is available; otherwise, returns the original node.
*
@ -2960,7 +2966,7 @@ declare namespace ts {
}
declare namespace ts {
function isExternalModuleNameRelative(moduleName: string): boolean;
function sortAndDeduplicateDiagnostics(diagnostics: ReadonlyArray<Diagnostic>): Diagnostic[];
function sortAndDeduplicateDiagnostics<T extends Diagnostic>(diagnostics: ReadonlyArray<T>): T[];
}
declare function setTimeout(handler: (...args: any[]) => void, timeout: number): any;
declare function clearTimeout(handle: any): void;
@ -4497,9 +4503,10 @@ declare namespace ts {
}
interface LanguageService {
cleanupSemanticCache(): void;
getSyntacticDiagnostics(fileName: string): Diagnostic[];
getSyntacticDiagnostics(fileName: string): DiagnosticWithLocation[];
/** The first time this is called, it will return global diagnostics (no location). */
getSemanticDiagnostics(fileName: string): Diagnostic[];
getSuggestionDiagnostics(fileName: string): Diagnostic[];
getSuggestionDiagnostics(fileName: string): DiagnosticWithLocation[];
getCompilerOptionsDiagnostics(): Diagnostic[];
/**
* @deprecated Use getEncodedSyntacticClassifications instead.

File diff suppressed because it is too large Load Diff

View File

@ -1734,9 +1734,10 @@ declare namespace ts {
emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean, customTransformers?: CustomTransformers): EmitResult;
getOptionsDiagnostics(cancellationToken?: CancellationToken): ReadonlyArray<Diagnostic>;
getGlobalDiagnostics(cancellationToken?: CancellationToken): ReadonlyArray<Diagnostic>;
getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray<Diagnostic>;
getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray<DiagnosticWithLocation>;
/** The first time this is called, it will return global diagnostics (no location). */
getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray<Diagnostic>;
getDeclarationDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray<Diagnostic>;
getDeclarationDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray<DiagnosticWithLocation>;
getConfigFileParsingDiagnostics(): ReadonlyArray<Diagnostic>;
/**
* Gets a type checker that can be used to semantically analyze source files in the program.
@ -2359,6 +2360,11 @@ declare namespace ts {
code: number;
source?: string;
}
interface DiagnosticWithLocation extends Diagnostic {
file: SourceFile;
start: number;
length: number;
}
enum DiagnosticCategory {
Warning = 0,
Error = 1,
@ -2754,7 +2760,7 @@ declare namespace ts {
/** Gets the transformed source files. */
transformed: T[];
/** Gets diagnostics for the transformation. */
diagnostics?: Diagnostic[];
diagnostics?: DiagnosticWithLocation[];
/**
* Gets a substitute for a node, if one is available; otherwise, returns the original node.
*
@ -2960,7 +2966,7 @@ declare namespace ts {
}
declare namespace ts {
function isExternalModuleNameRelative(moduleName: string): boolean;
function sortAndDeduplicateDiagnostics(diagnostics: ReadonlyArray<Diagnostic>): Diagnostic[];
function sortAndDeduplicateDiagnostics<T extends Diagnostic>(diagnostics: ReadonlyArray<T>): T[];
}
declare function setTimeout(handler: (...args: any[]) => void, timeout: number): any;
declare function clearTimeout(handle: any): void;
@ -4497,9 +4503,10 @@ declare namespace ts {
}
interface LanguageService {
cleanupSemanticCache(): void;
getSyntacticDiagnostics(fileName: string): Diagnostic[];
getSyntacticDiagnostics(fileName: string): DiagnosticWithLocation[];
/** The first time this is called, it will return global diagnostics (no location). */
getSemanticDiagnostics(fileName: string): Diagnostic[];
getSuggestionDiagnostics(fileName: string): Diagnostic[];
getSuggestionDiagnostics(fileName: string): DiagnosticWithLocation[];
getCompilerOptionsDiagnostics(): Diagnostic[];
/**
* @deprecated Use getEncodedSyntacticClassifications instead.

File diff suppressed because it is too large Load Diff

View File

@ -980,15 +980,6 @@ var ts;
return to;
}
ts.addRange = addRange;
function prependRange(to, from) {
if (from === undefined || from.length === 0)
return to;
if (to === undefined)
return from.slice();
to.unshift.apply(to, from);
return to;
}
ts.prependRange = prependRange;
function pushIfUnique(array, toAdd, equalityComparer) {
if (contains(array, toAdd, equalityComparer)) {
return false;
@ -1735,6 +1726,14 @@ var ts;
return moduleResolution;
}
ts.getEmitModuleResolutionKind = getEmitModuleResolutionKind;
function unreachableCodeIsError(options) {
return options.allowUnreachableCode === false;
}
ts.unreachableCodeIsError = unreachableCodeIsError;
function unusedLabelIsError(options) {
return options.allowUnusedLabels === false;
}
ts.unusedLabelIsError = unusedLabelIsError;
function getAreDeclarationMapsEnabled(options) {
return !!(options.declaration && options.declarationMap);
}
@ -4204,7 +4203,7 @@ var ts;
_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible: diag(2692, ts.DiagnosticCategory.Error, "_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible_2692", "'{0}' is a primitive, but '{1}' is a wrapper object. Prefer using '{0}' when possible."),
_0_only_refers_to_a_type_but_is_being_used_as_a_value_here: diag(2693, ts.DiagnosticCategory.Error, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_2693", "'{0}' only refers to a type, but is being used as a value here."),
Namespace_0_has_no_exported_member_1: diag(2694, ts.DiagnosticCategory.Error, "Namespace_0_has_no_exported_member_1_2694", "Namespace '{0}' has no exported member '{1}'."),
Left_side_of_comma_operator_is_unused_and_has_no_side_effects: diag(2695, ts.DiagnosticCategory.Error, "Left_side_of_comma_operator_is_unused_and_has_no_side_effects_2695", "Left side of comma operator is unused and has no side effects."),
Left_side_of_comma_operator_is_unused_and_has_no_side_effects: diag(2695, ts.DiagnosticCategory.Error, "Left_side_of_comma_operator_is_unused_and_has_no_side_effects_2695", "Left side of comma operator is unused and has no side effects.", true),
The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead: diag(2696, ts.DiagnosticCategory.Error, "The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead_2696", "The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?"),
An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: diag(2697, ts.DiagnosticCategory.Error, "An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_in_2697", "An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option."),
Spread_types_may_only_be_created_from_object_types: diag(2698, ts.DiagnosticCategory.Error, "Spread_types_may_only_be_created_from_object_types_2698", "Spread types may only be created from object types."),
@ -4560,7 +4559,7 @@ var ts;
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: diag(7024, ts.DiagnosticCategory.Error, "Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_ref_7024", "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."),
Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type: diag(7025, ts.DiagnosticCategory.Error, "Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_typ_7025", "Generator implicitly has type '{0}' because it does not yield any values. Consider supplying a return type."),
JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists: diag(7026, ts.DiagnosticCategory.Error, "JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists_7026", "JSX element implicitly has type 'any' because no interface 'JSX.{0}' exists."),
Unreachable_code_detected: diag(7027, ts.DiagnosticCategory.Error, "Unreachable_code_detected_7027", "Unreachable code detected."),
Unreachable_code_detected: diag(7027, ts.DiagnosticCategory.Error, "Unreachable_code_detected_7027", "Unreachable code detected.", true),
Unused_label: diag(7028, ts.DiagnosticCategory.Error, "Unused_label_7028", "Unused label.", true),
Fallthrough_case_in_switch: diag(7029, ts.DiagnosticCategory.Error, "Fallthrough_case_in_switch_7029", "Fallthrough case in switch."),
Not_all_code_paths_return_a_value: diag(7030, ts.DiagnosticCategory.Error, "Not_all_code_paths_return_a_value_7030", "Not all code paths return a value."),
@ -4915,6 +4914,19 @@ var ts;
return !nodeIsMissing(node);
}
ts.nodeIsPresent = nodeIsPresent;
function prependStatements(to, from) {
if (from === undefined || from.length === 0)
return to;
if (to === undefined)
return from.slice();
var prologue = to.length && isPrologueDirective(to[0]) && to.shift();
to.unshift.apply(to, from);
if (prologue) {
to.unshift(prologue);
}
return to;
}
ts.prependStatements = prependStatements;
function isRecognizedTripleSlashComment(text, commentPos, commentEnd) {
if (text.charCodeAt(commentPos + 1) === 47 &&
commentPos + 2 < commentEnd &&
@ -12434,6 +12446,7 @@ var ts;
nodeCount++;
sourceFile.text = sourceText;
sourceFile.bindDiagnostics = [];
sourceFile.bindSuggestionDiagnostics = undefined;
sourceFile.languageVersion = languageVersion;
sourceFile.fileName = ts.normalizePath(fileName);
sourceFile.languageVariant = getLanguageVariant(scriptKind);