Skip to content

Commit

Permalink
Update to TypeScript 3.3.3333.
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielRosenwasser committed Feb 25, 2019
1 parent ed08750 commit d68a936
Show file tree
Hide file tree
Showing 10 changed files with 181 additions and 49 deletions.
2 changes: 1 addition & 1 deletion tsserver/protocol.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2265,7 +2265,7 @@ declare namespace ts.server.protocol {
}
interface UserPreferences {
readonly disableSuggestions?: boolean;
readonly quotePreference?: "double" | "single";
readonly quotePreference?: "auto" | "double" | "single";
/**
* If enabled, TypeScript will search through all external modules' exports and add them to the completions list.
* This affects lone identifier completions but not completions on the right hand side of `obj.`.
Expand Down
25 changes: 21 additions & 4 deletions tsserver/tsc.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
var ts;
(function (ts) {
ts.versionMajorMinor = "3.3";
ts.version = ts.versionMajorMinor + ".1";
ts.version = ts.versionMajorMinor + ".3333";
})(ts || (ts = {}));
(function (ts) {
ts.emptyArray = [];
Expand Down Expand Up @@ -22903,15 +22903,19 @@ var ts;
flowAfterCatch = currentFlow;
}
if (node.finallyBlock) {
var preFinallyPrior = preTryFlow;
if (!node.catchClause) {
if (tryPriors.length) {
var preFinallyFlow_1 = createBranchLabel();
addAntecedent(preFinallyFlow_1, preTryFlow);
for (var _a = 0, tryPriors_2 = tryPriors; _a < tryPriors_2.length; _a++) {
var p = tryPriors_2[_a];
addAntecedent(preFinallyLabel, p);
addAntecedent(preFinallyFlow_1, p);
}
preFinallyPrior = finishFlowLabel(preFinallyFlow_1);
}
}
var preFinallyFlow = { flags: 2048, antecedent: preTryFlow, lock: {} };
var preFinallyFlow = { flags: 2048, antecedent: preFinallyPrior, lock: {} };
addAntecedent(preFinallyLabel, preFinallyFlow);
currentFlow = finishFlowLabel(preFinallyLabel);
bind(node.finallyBlock);
Expand Down Expand Up @@ -48476,7 +48480,7 @@ var ts;
return;
}
var file = host.getSourceFile(resolvedDirective.resolvedFileName);
fileToDirective.set(file.path, key);
addReferencedFilesToTypeDirective(file, key);
});
}
return {
Expand Down Expand Up @@ -48615,6 +48619,19 @@ var ts;
}
return false;
}
function addReferencedFilesToTypeDirective(file, key) {
if (fileToDirective.has(file.path))
return;
fileToDirective.set(file.path, key);
for (var _i = 0, _a = file.referencedFiles; _i < _a.length; _i++) {
var fileName = _a[_i].fileName;
var resolvedFile = ts.resolveTripleslashReference(fileName, file.originalFileName);
var referencedFile = host.getSourceFile(resolvedFile);
if (referencedFile) {
addReferencedFilesToTypeDirective(referencedFile, key);
}
}
}
}
function getExternalModuleFileFromDeclaration(declaration) {
var specifier = declaration.kind === 244 ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration);
Expand Down
42 changes: 33 additions & 9 deletions tsserver/tsserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ var ts;
// If changing the text in this section, be sure to test `configureNightly` too.
ts.versionMajorMinor = "3.3";
/** The version of the TypeScript compiler release */
ts.version = ts.versionMajorMinor + ".1";
ts.version = ts.versionMajorMinor + ".3333";
})(ts || (ts = {}));
(function (ts) {
/* @internal */
Expand Down Expand Up @@ -28107,12 +28107,16 @@ var ts;
// We add the nodes within the `try` block to the `finally`'s antecedents if there's no catch block
// (If there is a `catch` block, it will have all these antecedents instead, and the `finally` will
// have the end of the `try` block and the end of the `catch` block)
var preFinallyPrior = preTryFlow;
if (!node.catchClause) {
if (tryPriors.length) {
var preFinallyFlow_1 = createBranchLabel();
addAntecedent(preFinallyFlow_1, preTryFlow);
for (var _a = 0, tryPriors_2 = tryPriors; _a < tryPriors_2.length; _a++) {
var p = tryPriors_2[_a];
addAntecedent(preFinallyLabel, p);
addAntecedent(preFinallyFlow_1, p);
}
preFinallyPrior = finishFlowLabel(preFinallyFlow_1);
}
}
// in finally flow is combined from pre-try/flow from try/flow from catch
Expand Down Expand Up @@ -28141,7 +28145,7 @@ var ts;
//
// extra edges that we inject allows to control this behavior
// if when walking the flow we step on post-finally edge - we can mark matching pre-finally edge as locked so it will be skipped.
var preFinallyFlow = { flags: 2048 /* PreFinally */, antecedent: preTryFlow, lock: {} };
var preFinallyFlow = { flags: 2048 /* PreFinally */, antecedent: preFinallyPrior, lock: {} };
addAntecedent(preFinallyLabel, preFinallyFlow);
currentFlow = finishFlowLabel(preFinallyLabel);
bind(node.finallyBlock);
Expand Down Expand Up @@ -57874,7 +57878,9 @@ var ts;
return;
}
var file = host.getSourceFile(resolvedDirective.resolvedFileName);
fileToDirective.set(file.path, key);
// Add the transitive closure of path references loaded by this file (as long as they are not)
// part of an existing type reference.
addReferencedFilesToTypeDirective(file, key);
});
}
return {
Expand Down Expand Up @@ -58029,6 +58035,19 @@ var ts;
}
return false;
}
function addReferencedFilesToTypeDirective(file, key) {
if (fileToDirective.has(file.path))
return;
fileToDirective.set(file.path, key);
for (var _i = 0, _a = file.referencedFiles; _i < _a.length; _i++) {
var fileName = _a[_i].fileName;
var resolvedFile = ts.resolveTripleslashReference(fileName, file.originalFileName);
var referencedFile = host.getSourceFile(resolvedFile);
if (referencedFile) {
addReferencedFilesToTypeDirective(referencedFile, key);
}
}
}
}
function getExternalModuleFileFromDeclaration(declaration) {
var specifier = declaration.kind === 244 /* ModuleDeclaration */ ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration);
Expand Down Expand Up @@ -94462,7 +94481,7 @@ var ts;
}
ts.quotePreferenceFromString = quotePreferenceFromString;
function getQuotePreference(sourceFile, preferences) {
if (preferences.quotePreference) {
if (preferences.quotePreference && preferences.quotePreference !== "auto") {
return preferences.quotePreference === "single" ? 0 /* Single */ : 1 /* Double */;
}
else {
Expand Down Expand Up @@ -95033,15 +95052,18 @@ var ts;
if (/^\d+$/.test(text)) {
return text;
}
// Editors can pass in undefined or empty string - we want to infer the preference in those cases.
var quotePreference = preferences.quotePreference || "auto";
var quoted = JSON.stringify(text);
switch (preferences.quotePreference) {
case undefined:
switch (quotePreference) {
// TODO use getQuotePreference to infer the actual quote style.
case "auto":
case "double":
return quoted;
case "single":
return "'" + stripQuotes(quoted).replace("'", "\\'").replace('\\"', '"') + "'";
default:
return ts.Debug.assertNever(preferences.quotePreference);
return ts.Debug.assertNever(quotePreference);
}
}
ts.quote = quote;
Expand Down Expand Up @@ -113925,7 +113947,9 @@ var ts;
}
function createStubbedMethodBody(preferences) {
return ts.createBlock([ts.createThrow(ts.createNew(ts.createIdentifier("Error"),
/*typeArguments*/ undefined, [ts.createLiteral("Method not implemented.", /*isSingleQuote*/ preferences.quotePreference === "single")]))],
/*typeArguments*/ undefined,
// TODO Handle auto quote preference.
[ts.createLiteral("Method not implemented.", /*isSingleQuote*/ preferences.quotePreference === "single")]))],
/*multiline*/ true);
}
function createVisibilityModifier(flags) {
Expand Down
4 changes: 2 additions & 2 deletions tsserver/tsserverlibrary.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3009,7 +3009,7 @@ declare namespace ts {
}
interface UserPreferences {
readonly disableSuggestions?: boolean;
readonly quotePreference?: "double" | "single";
readonly quotePreference?: "auto" | "double" | "single";
readonly includeCompletionsForModuleExports?: boolean;
readonly includeCompletionsWithInsertText?: boolean;
readonly importModuleSpecifierPreference?: "relative" | "non-relative";
Expand Down Expand Up @@ -7925,7 +7925,7 @@ declare namespace ts.server.protocol {
}
interface UserPreferences {
readonly disableSuggestions?: boolean;
readonly quotePreference?: "double" | "single";
readonly quotePreference?: "auto" | "double" | "single";
/**
* If enabled, TypeScript will search through all external modules' exports and add them to the completions list.
* This affects lone identifier completions but not completions on the right hand side of `obj.`.
Expand Down
42 changes: 33 additions & 9 deletions tsserver/tsserverlibrary.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ var ts;
// If changing the text in this section, be sure to test `configureNightly` too.
ts.versionMajorMinor = "3.3";
/** The version of the TypeScript compiler release */
ts.version = ts.versionMajorMinor + ".1";
ts.version = ts.versionMajorMinor + ".3333";
})(ts || (ts = {}));
(function (ts) {
/* @internal */
Expand Down Expand Up @@ -28103,12 +28103,16 @@ var ts;
// We add the nodes within the `try` block to the `finally`'s antecedents if there's no catch block
// (If there is a `catch` block, it will have all these antecedents instead, and the `finally` will
// have the end of the `try` block and the end of the `catch` block)
var preFinallyPrior = preTryFlow;
if (!node.catchClause) {
if (tryPriors.length) {
var preFinallyFlow_1 = createBranchLabel();
addAntecedent(preFinallyFlow_1, preTryFlow);
for (var _a = 0, tryPriors_2 = tryPriors; _a < tryPriors_2.length; _a++) {
var p = tryPriors_2[_a];
addAntecedent(preFinallyLabel, p);
addAntecedent(preFinallyFlow_1, p);
}
preFinallyPrior = finishFlowLabel(preFinallyFlow_1);
}
}
// in finally flow is combined from pre-try/flow from try/flow from catch
Expand Down Expand Up @@ -28137,7 +28141,7 @@ var ts;
//
// extra edges that we inject allows to control this behavior
// if when walking the flow we step on post-finally edge - we can mark matching pre-finally edge as locked so it will be skipped.
var preFinallyFlow = { flags: 2048 /* PreFinally */, antecedent: preTryFlow, lock: {} };
var preFinallyFlow = { flags: 2048 /* PreFinally */, antecedent: preFinallyPrior, lock: {} };
addAntecedent(preFinallyLabel, preFinallyFlow);
currentFlow = finishFlowLabel(preFinallyLabel);
bind(node.finallyBlock);
Expand Down Expand Up @@ -57870,7 +57874,9 @@ var ts;
return;
}
var file = host.getSourceFile(resolvedDirective.resolvedFileName);
fileToDirective.set(file.path, key);
// Add the transitive closure of path references loaded by this file (as long as they are not)
// part of an existing type reference.
addReferencedFilesToTypeDirective(file, key);
});
}
return {
Expand Down Expand Up @@ -58025,6 +58031,19 @@ var ts;
}
return false;
}
function addReferencedFilesToTypeDirective(file, key) {
if (fileToDirective.has(file.path))
return;
fileToDirective.set(file.path, key);
for (var _i = 0, _a = file.referencedFiles; _i < _a.length; _i++) {
var fileName = _a[_i].fileName;
var resolvedFile = ts.resolveTripleslashReference(fileName, file.originalFileName);
var referencedFile = host.getSourceFile(resolvedFile);
if (referencedFile) {
addReferencedFilesToTypeDirective(referencedFile, key);
}
}
}
}
function getExternalModuleFileFromDeclaration(declaration) {
var specifier = declaration.kind === 244 /* ModuleDeclaration */ ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration);
Expand Down Expand Up @@ -94772,7 +94791,7 @@ var ts;
}
ts.quotePreferenceFromString = quotePreferenceFromString;
function getQuotePreference(sourceFile, preferences) {
if (preferences.quotePreference) {
if (preferences.quotePreference && preferences.quotePreference !== "auto") {
return preferences.quotePreference === "single" ? 0 /* Single */ : 1 /* Double */;
}
else {
Expand Down Expand Up @@ -95343,15 +95362,18 @@ var ts;
if (/^\d+$/.test(text)) {
return text;
}
// Editors can pass in undefined or empty string - we want to infer the preference in those cases.
var quotePreference = preferences.quotePreference || "auto";
var quoted = JSON.stringify(text);
switch (preferences.quotePreference) {
case undefined:
switch (quotePreference) {
// TODO use getQuotePreference to infer the actual quote style.
case "auto":
case "double":
return quoted;
case "single":
return "'" + stripQuotes(quoted).replace("'", "\\'").replace('\\"', '"') + "'";
default:
return ts.Debug.assertNever(preferences.quotePreference);
return ts.Debug.assertNever(quotePreference);
}
}
ts.quote = quote;
Expand Down Expand Up @@ -114235,7 +114257,9 @@ var ts;
}
function createStubbedMethodBody(preferences) {
return ts.createBlock([ts.createThrow(ts.createNew(ts.createIdentifier("Error"),
/*typeArguments*/ undefined, [ts.createLiteral("Method not implemented.", /*isSingleQuote*/ preferences.quotePreference === "single")]))],
/*typeArguments*/ undefined,
// TODO Handle auto quote preference.
[ts.createLiteral("Method not implemented.", /*isSingleQuote*/ preferences.quotePreference === "single")]))],
/*multiline*/ true);
}
function createVisibilityModifier(flags) {
Expand Down
2 changes: 1 addition & 1 deletion tsserver/typescript.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3009,7 +3009,7 @@ declare namespace ts {
}
interface UserPreferences {
readonly disableSuggestions?: boolean;
readonly quotePreference?: "double" | "single";
readonly quotePreference?: "auto" | "double" | "single";
readonly includeCompletionsForModuleExports?: boolean;
readonly includeCompletionsWithInsertText?: boolean;
readonly importModuleSpecifierPreference?: "relative" | "non-relative";
Expand Down
Loading

0 comments on commit d68a936

Please sign in to comment.