Skip to content

Commit

Permalink
Update LKG
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielRosenwasser committed Jan 25, 2023
1 parent d4d640f commit dcad07f
Show file tree
Hide file tree
Showing 7 changed files with 5,835 additions and 115 deletions.
34 changes: 25 additions & 9 deletions lib/tsc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11724,6 +11724,20 @@ function getScriptTargetFeatures() {
BigUint64Array: ["at"],
ObjectConstructor: ["hasOwn"],
Error: ["cause"]
},
es2023: {
Array: ["findLastIndex", "findLast"],
Int8Array: ["findLastIndex", "findLast"],
Uint8Array: ["findLastIndex", "findLast"],
Uint8ClampedArray: ["findLastIndex", "findLast"],
Int16Array: ["findLastIndex", "findLast"],
Uint16Array: ["findLastIndex", "findLast"],
Int32Array: ["findLastIndex", "findLast"],
Uint32Array: ["findLastIndex", "findLast"],
Float32Array: ["findLastIndex", "findLast"],
Float64Array: ["findLastIndex", "findLast"],
BigInt64Array: ["findLastIndex", "findLast"],
BigUint64Array: ["findLastIndex", "findLast"]
}
};
}
Expand Down Expand Up @@ -46308,7 +46322,7 @@ function createTypeChecker(host) {
return writer ? symbolToStringWorker(writer).getText() : usingSingleLineStringWriter(symbolToStringWorker);
function symbolToStringWorker(writer2) {
const entity = builder(symbol, meaning, enclosingDeclaration, nodeFlags);
const printer = (enclosingDeclaration == null ? void 0 : enclosingDeclaration.kind) === 308 /* SourceFile */ ? createPrinter({ removeComments: true, neverAsciiEscape: true }) : createPrinter({ removeComments: true });
const printer = (enclosingDeclaration == null ? void 0 : enclosingDeclaration.kind) === 308 /* SourceFile */ ? createPrinterWithRemoveCommentsNeverAsciiEscape() : createPrinterWithRemoveComments();
const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
printer.writeNode(
4 /* Unspecified */,
Expand All @@ -46330,7 +46344,7 @@ function createTypeChecker(host) {
sigOutput = kind === 1 /* Construct */ ? 177 /* ConstructSignature */ : 176 /* CallSignature */;
}
const sig = nodeBuilder.signatureToSignatureDeclaration(signature, sigOutput, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | 512 /* WriteTypeParametersInQualifiedName */);
const printer = createPrinter({ removeComments: true, omitTrailingSemicolon: true });
const printer = createPrinterWithRemoveCommentsOmitTrailingSemicolon();
const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
printer.writeNode(
4 /* Unspecified */,
Expand All @@ -46347,8 +46361,7 @@ function createTypeChecker(host) {
const typeNode = nodeBuilder.typeToTypeNode(type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | (noTruncation ? 1 /* NoTruncation */ : 0));
if (typeNode === void 0)
return Debug.fail("should always get typenode");
const options = { removeComments: type !== unresolvedType };
const printer = createPrinter(options);
const printer = type !== unresolvedType ? createPrinterWithRemoveComments() : createPrinterWithDefaults();
const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
printer.writeNode(
4 /* Unspecified */,
Expand Down Expand Up @@ -49699,7 +49712,7 @@ function createTypeChecker(host) {
typePredicate.type && nodeBuilder.typeToTypeNode(typePredicate.type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | 512 /* WriteTypeParametersInQualifiedName */)
// TODO: GH#18217
);
const printer = createPrinter({ removeComments: true });
const printer = createPrinterWithRemoveComments();
const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
printer.writeNode(
4 /* Unspecified */,
Expand Down Expand Up @@ -64727,7 +64740,7 @@ function createTypeChecker(host) {
return getNonMissingTypeOfSymbol(symbol);
}
function getControlFlowContainer(node) {
return findAncestor(node.parent, (node2) => isFunctionLike(node2) && !getImmediatelyInvokedFunctionExpression(node2) || node2.kind === 265 /* ModuleBlock */ || node2.kind === 308 /* SourceFile */ || node2.kind === 295 /* CatchClause */ || node2.kind === 169 /* PropertyDeclaration */);
return findAncestor(node.parent, (node2) => isFunctionLike(node2) && !getImmediatelyInvokedFunctionExpression(node2) || node2.kind === 265 /* ModuleBlock */ || node2.kind === 308 /* SourceFile */ || node2.kind === 169 /* PropertyDeclaration */);
}
function isSymbolAssigned(symbol) {
if (!symbol.valueDeclaration) {
Expand Down Expand Up @@ -64988,14 +65001,13 @@ function createTypeChecker(host) {
const isParameter2 = getRootDeclaration(declaration).kind === 166 /* Parameter */;
const declarationContainer = getControlFlowContainer(declaration);
let flowContainer = getControlFlowContainer(node);
const isCatch = flowContainer.kind === 295 /* CatchClause */;
const isOuterVariable = flowContainer !== declarationContainer;
const isSpreadDestructuringAssignmentTarget = node.parent && node.parent.parent && isSpreadAssignment(node.parent) && isDestructuringAssignmentTarget(node.parent.parent);
const isModuleExports = symbol.flags & 134217728 /* ModuleExports */;
while (flowContainer !== declarationContainer && (flowContainer.kind === 215 /* FunctionExpression */ || flowContainer.kind === 216 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstVariable(localOrExportSymbol) && type !== autoArrayType || isParameter2 && !isSymbolAssigned(localOrExportSymbol))) {
flowContainer = getControlFlowContainer(flowContainer);
}
const assumeInitialized = isParameter2 || isCatch || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */)) !== 0 || isInTypeQuery(node) || isInAmbientOrTypeNode(node) || node.parent.kind === 278 /* ExportSpecifier */) || node.parent.kind === 232 /* NonNullExpression */ || declaration.kind === 257 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 16777216 /* Ambient */;
const assumeInitialized = isParameter2 || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */)) !== 0 || isInTypeQuery(node) || isInAmbientOrTypeNode(node) || node.parent.kind === 278 /* ExportSpecifier */) || node.parent.kind === 232 /* NonNullExpression */ || declaration.kind === 257 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 16777216 /* Ambient */;
const initialType = assumeInitialized ? isParameter2 ? removeOptionalityFromDeclaredType(type, declaration) : type : type === autoType || type === autoArrayType ? undefinedType : getOptionalType(type);
const flowType = getFlowTypeOfReference(node, type, initialType, flowContainer);
if (!isEvolvingArrayOperationTarget(node) && (type === autoType || type === autoArrayType)) {
Expand Down Expand Up @@ -78255,7 +78267,7 @@ function createTypeChecker(host) {
if (typeAnnotationNode) {
checkTypeAssignableTo(checkExpressionCached(node.expression), getTypeFromTypeNode(typeAnnotationNode), node.expression);
}
const isIllegalExportDefaultInCJS = !node.isExportEquals && compilerOptions.verbatimModuleSyntax && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */);
const isIllegalExportDefaultInCJS = !node.isExportEquals && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */);
if (node.expression.kind === 79 /* Identifier */) {
const id = node.expression;
const sym = resolveEntityName(
Expand Down Expand Up @@ -106274,6 +106286,10 @@ function emitUsingBuildInfoWorker(config, host, getCommandLine, customTransforme
);
return outputFiles;
}
var createPrinterWithDefaults = memoize(() => createPrinter({}));
var createPrinterWithRemoveComments = memoize(() => createPrinter({ removeComments: true }));
var createPrinterWithRemoveCommentsNeverAsciiEscape = memoize(() => createPrinter({ removeComments: true, neverAsciiEscape: true }));
var createPrinterWithRemoveCommentsOmitTrailingSemicolon = memoize(() => createPrinter({ removeComments: true, omitTrailingSemicolon: true }));
function createPrinter(printerOptions = {}, handlers = {}) {
const {
hasGlobalName,
Expand Down

0 comments on commit dcad07f

Please sign in to comment.