Skip to content

Commit

Permalink
Move LSIF to TS 4.4.0-Dev
Browse files Browse the repository at this point in the history
  • Loading branch information
dbaeumer committed Jun 8, 2021
1 parent bf4642f commit 2e37f12
Show file tree
Hide file tree
Showing 18 changed files with 11,178 additions and 220 deletions.
71 changes: 55 additions & 16 deletions lib/tsc.js
Original file line number Diff line number Diff line change
Expand Up @@ -23776,8 +23776,8 @@ var ts;
visitNode(cbNode, node.typeExpression) ||
(typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))
: visitNode(cbNode, node.typeExpression) ||
visitNode(cbNode, node.name)) ||
(typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment));
visitNode(cbNode, node.name) ||
(typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)));
case 324:
return visitNode(cbNode, node.tagName) ||
(typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment));
Expand Down Expand Up @@ -36917,6 +36917,9 @@ var ts;
var requireSymbol = createSymbol(4, "require");
var apparentArgumentCount;
var checker = {
setSymbolChainCache: function (cache) {
nodeBuilder.setSymbolChainCache(cache);
},
getNodeCount: function () { return ts.sum(host.getSourceFiles(), "nodeCount"); },
getIdentifierCount: function () { return ts.sum(host.getSourceFiles(), "identifierCount"); },
getSymbolCount: function () { return ts.sum(host.getSourceFiles(), "symbolCount") + symbolCount; },
Expand Down Expand Up @@ -40186,7 +40189,9 @@ var ts;
return !!type.symbol && !!(type.symbol.flags & 32) && (type === getDeclaredTypeOfClassOrInterface(type.symbol) || (!!(type.flags & 524288) && !!(ts.getObjectFlags(type) & 16777216)));
}
function createNodeBuilder() {
var symbolChainCache;
return {
setSymbolChainCache: function (cache) { symbolChainCache = cache; },
typeToTypeNode: function (type, enclosingDeclaration, flags, tracker) {
return withContext(enclosingDeclaration, flags, tracker, function (context) { return typeToTypeNodeHelper(type, context); });
},
Expand Down Expand Up @@ -40233,6 +40238,7 @@ var ts;
fileExists: function (fileName) { return host.fileExists(fileName); },
getFileIncludeReasons: function () { return host.getFileIncludeReasons(); },
} : undefined },
cache: symbolChainCache,
encounteredError: false,
reportedDiagnostic: false,
visitedTypes: undefined,
Expand Down Expand Up @@ -41175,6 +41181,29 @@ var ts;
}
return chain;
function getSymbolChain(symbol, meaning, endOfChain) {
var key;
var result;
if (context.cache) {
key = {
symbol: symbol,
enclosingDeclaration: context.enclosingDeclaration,
flags: context.flags,
meaning: meaning,
yieldModuleSymbol: yieldModuleSymbol,
endOfChain: endOfChain
};
result = context.cache.lookup(key);
if (result) {
return result;
}
}
result = doGetSymbolChain(symbol, meaning, endOfChain);
if (result && key && context.cache) {
context.cache.cache(key, result);
}
return result;
}
function doGetSymbolChain(symbol, meaning, endOfChain) {
var accessibleSymbolChain = getAccessibleSymbolChain(symbol, context.enclosingDeclaration, meaning, !!(context.flags & 128));
var parentSpecifiers;
if (!accessibleSymbolChain ||
Expand Down Expand Up @@ -72587,6 +72616,7 @@ var ts;
case 121:
case 122:
case 126:
case 157:
case 85:
case 134:
case 143:
Expand Down Expand Up @@ -88413,11 +88443,14 @@ var ts;
if (nextNode.kind === 11) {
return 0;
}
else if (preserveSourceNewlines && siblingNodePositionsAreComparable(previousNode, nextNode)) {
return getEffectiveLines(function (includeComments) { return ts.getLinesBetweenRangeEndAndRangeStart(previousNode, nextNode, currentSourceFile, includeComments); });
}
else if (!preserveSourceNewlines && !ts.nodeIsSynthesized(previousNode) && !ts.nodeIsSynthesized(nextNode)) {
return ts.rangeEndIsOnSameLineAsRangeStart(previousNode, nextNode, currentSourceFile) ? 0 : 1;
else if (!ts.nodeIsSynthesized(previousNode) && !ts.nodeIsSynthesized(nextNode)) {
if (preserveSourceNewlines && siblingNodePositionsAreComparable(previousNode, nextNode)) {
return getEffectiveLines(function (includeComments) { return ts.getLinesBetweenRangeEndAndRangeStart(previousNode, nextNode, currentSourceFile, includeComments); });
}
else if (!preserveSourceNewlines && originalNodesHaveSameParent(previousNode, nextNode)) {
return ts.rangeEndIsOnSameLineAsRangeStart(previousNode, nextNode, currentSourceFile) ? 0 : 1;
}
return format & 65536 ? 1 : 0;
}
else if (synthesizedNodeStartsOnNewLine(previousNode, format) || synthesizedNodeStartsOnNewLine(nextNode, format)) {
return 1;
Expand Down Expand Up @@ -88963,10 +88996,11 @@ var ts;
}
exitComment();
}
function originalNodesHaveSameParent(nodeA, nodeB) {
nodeA = ts.getOriginalNode(nodeA);
return nodeA.parent && nodeA.parent === ts.getOriginalNode(nodeB).parent;
}
function siblingNodePositionsAreComparable(previousNode, nextNode) {
if (ts.nodeIsSynthesized(previousNode) || ts.nodeIsSynthesized(nextNode)) {
return false;
}
if (nextNode.pos < previousNode.end) {
return false;
}
Expand Down Expand Up @@ -93601,8 +93635,11 @@ var ts;
var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
var name = _a[_i];
var optionInfo = optionsNameMap.get(name.toLowerCase());
if ((optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsEmit) || (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsSemanticDiagnostics) || name === "skipLibCheck" || name === "skipDefaultLibCheck") {
var optionKey = name.toLowerCase();
var optionInfo = optionsNameMap.get(optionKey);
if ((optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsEmit) || (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsSemanticDiagnostics) ||
optionKey === "strict" ||
optionKey === "skiplibcheck" || optionKey === "skipdefaultlibcheck") {
(result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfo);
}
}
Expand Down Expand Up @@ -95157,7 +95194,7 @@ var ts;
getCanonicalFileName: ts.createGetCanonicalFileName(ts.sys.useCaseSensitiveFileNames)
} : undefined;
function createDiagnosticReporter(system, pretty) {
var host = system === ts.sys ? sysFormatDiagnosticsHost : {
var host = system === ts.sys && sysFormatDiagnosticsHost ? sysFormatDiagnosticsHost : {
getCurrentDirectory: function () { return system.getCurrentDirectory(); },
getNewLine: function () { return system.newLine; },
getCanonicalFileName: ts.createGetCanonicalFileName(system.useCaseSensitiveFileNames),
Expand Down Expand Up @@ -96750,7 +96787,7 @@ var ts;
},
emit: function (targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
if (targetSourceFile || emitOnlyDtsFiles) {
return withProgramOrUndefined(function (program) { return program.emit(targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers); });
return withProgramOrUndefined(function (program) { var _a, _b; return program.emit(targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers || ((_b = (_a = state.host).getCustomTransformers) === null || _b === void 0 ? void 0 : _b.call(_a, project))); });
}
executeSteps(BuildStep.SemanticDiagnostics, cancellationToken);
if (step === BuildStep.EmitBuildInfo) {
Expand Down Expand Up @@ -96832,13 +96869,14 @@ var ts;
}
function emit(writeFileCallback, cancellationToken, customTransformers) {
var _a;
var _b, _c;
ts.Debug.assertIsDefined(program);
ts.Debug.assert(step === BuildStep.Emit);
program.backupState();
var declDiagnostics;
var reportDeclarationDiagnostics = function (d) { return (declDiagnostics || (declDiagnostics = [])).push(d); };
var outputFiles = [];
var emitResult = ts.emitFilesAndReportErrors(program, reportDeclarationDiagnostics, undefined, undefined, function (name, text, writeByteOrderMark) { return outputFiles.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); }, cancellationToken, false, customTransformers).emitResult;
var emitResult = ts.emitFilesAndReportErrors(program, reportDeclarationDiagnostics, undefined, undefined, function (name, text, writeByteOrderMark) { return outputFiles.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); }, cancellationToken, false, customTransformers || ((_c = (_b = state.host).getCustomTransformers) === null || _c === void 0 ? void 0 : _c.call(_b, project))).emitResult;
if (declDiagnostics) {
program.restoreState();
(_a = buildErrors(state, projectPath, program, config, declDiagnostics, BuildResultFlags.DeclarationEmitErrors, "Declaration file"), buildResult = _a.buildResult, step = _a.step);
Expand Down Expand Up @@ -96915,6 +96953,7 @@ var ts;
return emitDiagnostics;
}
function emitBundle(writeFileCallback, customTransformers) {
var _a, _b;
ts.Debug.assert(kind === InvalidatedProjectKind.UpdateBundle);
if (state.options.dry) {
reportStatus(state, ts.Diagnostics.A_non_dry_build_would_update_output_of_project_0, project);
Expand All @@ -96929,7 +96968,7 @@ var ts;
var outputFiles = ts.emitUsingBuildInfo(config, compilerHost, function (ref) {
var refName = resolveProjectName(state, ref.path);
return parseConfigFile(state, refName, toResolvedConfigFilePath(state, refName));
}, customTransformers);
}, customTransformers || ((_b = (_a = state.host).getCustomTransformers) === null || _b === void 0 ? void 0 : _b.call(_a, project)));
if (ts.isString(outputFiles)) {
reportStatus(state, ts.Diagnostics.Cannot_update_output_of_project_0_because_there_was_error_reading_file_1, project, relName(state, outputFiles));
step = BuildStep.BuildInvalidatedProjectOfBundle;
Expand Down
Loading

0 comments on commit 2e37f12

Please sign in to comment.