[Pkg-javascript-commits] [node-typescript] 01/03: New upstream version 2.4.2
Julien Puydt
julien.puydt at laposte.net
Sun Aug 6 07:07:12 UTC 2017
This is an automated email from the git hooks/post-receive script.
jpuydt-guest pushed a commit to branch master
in repository node-typescript.
commit f7b0bfab7238489ed59de5d183ebd52c15fcffd2
Author: Julien Puydt <julien.puydt at laposte.net>
Date: Sun Aug 6 09:03:50 2017 +0200
New upstream version 2.4.2
---
lib/tsc.js | 8 +++---
lib/tsserver.js | 32 ++++++++++++++++++----
lib/tsserverlibrary.d.ts | 2 +-
lib/tsserverlibrary.js | 32 ++++++++++++++++++----
lib/typescript.d.ts | 2 +-
lib/typescript.js | 8 +++---
lib/typescriptServices.d.ts | 2 +-
lib/typescriptServices.js | 8 +++---
lib/typingsInstaller.js | 2 +-
package.json | 2 +-
src/compiler/checker.ts | 6 ++--
src/compiler/core.ts | 2 +-
src/server/builder.ts | 31 +++++++++++++++++++--
.../fourslash/completionList_getExportsOfModule.ts | 16 +++++++++++
14 files changed, 120 insertions(+), 33 deletions(-)
diff --git a/lib/tsc.js b/lib/tsc.js
index a2ce0c5..ce4d95f 100644
--- a/lib/tsc.js
+++ b/lib/tsc.js
@@ -151,7 +151,7 @@ var ts;
})(ts || (ts = {}));
var ts;
(function (ts) {
- ts.version = "2.4.1";
+ ts.version = "2.4.2";
})(ts || (ts = {}));
(function (ts) {
ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator(undefined, { usage: "sort", sensitivity: "accent" }) : undefined;
@@ -23140,7 +23140,7 @@ var ts;
}
function getExportsOfModule(moduleSymbol) {
var links = getSymbolLinks(moduleSymbol);
- return links.resolvedExports || (links.resolvedExports = getExportsForModule(moduleSymbol));
+ return links.resolvedExports || (links.resolvedExports = getExportsOfModuleWorker(moduleSymbol));
}
function extendExportSymbols(target, source, lookupTable, exportNode) {
source && source.forEach(function (sourceSymbol, id) {
@@ -23166,10 +23166,10 @@ var ts;
}
});
}
- function getExportsForModule(moduleSymbol) {
+ function getExportsOfModuleWorker(moduleSymbol) {
var visitedSymbols = [];
moduleSymbol = resolveExternalModuleSymbol(moduleSymbol);
- return visit(moduleSymbol) || moduleSymbol.exports;
+ return visit(moduleSymbol) || emptySymbols;
function visit(symbol) {
if (!(symbol && symbol.flags & 1952 && !ts.contains(visitedSymbols, symbol))) {
return;
diff --git a/lib/tsserver.js b/lib/tsserver.js
index 4d5b7fb..9f9ee09 100644
--- a/lib/tsserver.js
+++ b/lib/tsserver.js
@@ -1145,7 +1145,7 @@ var ts;
})(ts || (ts = {}));
var ts;
(function (ts) {
- ts.version = "2.4.1";
+ ts.version = "2.4.2";
})(ts || (ts = {}));
(function (ts) {
var Ternary;
@@ -24334,7 +24334,7 @@ var ts;
}
function getExportsOfModule(moduleSymbol) {
var links = getSymbolLinks(moduleSymbol);
- return links.resolvedExports || (links.resolvedExports = getExportsForModule(moduleSymbol));
+ return links.resolvedExports || (links.resolvedExports = getExportsOfModuleWorker(moduleSymbol));
}
function extendExportSymbols(target, source, lookupTable, exportNode) {
source && source.forEach(function (sourceSymbol, id) {
@@ -24360,10 +24360,10 @@ var ts;
}
});
}
- function getExportsForModule(moduleSymbol) {
+ function getExportsOfModuleWorker(moduleSymbol) {
var visitedSymbols = [];
moduleSymbol = resolveExternalModuleSymbol(moduleSymbol);
- return visit(moduleSymbol) || moduleSymbol.exports;
+ return visit(moduleSymbol) || emptySymbols;
function visit(symbol) {
if (!(symbol && symbol.flags & 1952 && !ts.contains(visitedSymbols, symbol))) {
return;
@@ -76539,6 +76539,9 @@ var ts;
AbstractBuilder.prototype.getFileInfos = function () {
return this.fileInfos_doNotAccessDirectly || (this.fileInfos_doNotAccessDirectly = ts.createFileMap());
};
+ AbstractBuilder.prototype.hasFileInfos = function () {
+ return !!this.fileInfos_doNotAccessDirectly;
+ };
AbstractBuilder.prototype.clear = function () {
this.fileInfos_doNotAccessDirectly = undefined;
};
@@ -76567,6 +76570,7 @@ var ts;
this.getFileInfos().forEachValue(function (_path, value) { return action(value); });
};
AbstractBuilder.prototype.emitFile = function (scriptInfo, writeFile) {
+ this.ensureFileInfoIfInProject(scriptInfo);
var fileInfo = this.getFileInfo(scriptInfo.path);
if (!fileInfo) {
return false;
@@ -76591,7 +76595,20 @@ var ts;
_this.project = project;
return _this;
}
+ NonModuleBuilder.prototype.ensureFileInfoIfInProject = function (scriptInfo) {
+ if (this.project.containsScriptInfo(scriptInfo)) {
+ this.getOrCreateFileInfo(scriptInfo.path);
+ }
+ };
NonModuleBuilder.prototype.onProjectUpdateGraph = function () {
+ var _this = this;
+ if (this.hasFileInfos()) {
+ this.forEachFileInfo(function (fileInfo) {
+ if (!_this.project.containsScriptInfo(fileInfo.scriptInfo)) {
+ _this.removeFileInfo(fileInfo.scriptInfo.path);
+ }
+ });
+ }
};
NonModuleBuilder.prototype.getFilesAffectedBy = function (scriptInfo) {
var info = this.getOrCreateFileInfo(scriptInfo.path);
@@ -76680,9 +76697,14 @@ var ts;
}
return [];
};
- ModuleBuilder.prototype.onProjectUpdateGraph = function () {
+ ModuleBuilder.prototype.ensureFileInfoIfInProject = function (_scriptInfo) {
this.ensureProjectDependencyGraphUpToDate();
};
+ ModuleBuilder.prototype.onProjectUpdateGraph = function () {
+ if (this.hasFileInfos()) {
+ this.ensureProjectDependencyGraphUpToDate();
+ }
+ };
ModuleBuilder.prototype.ensureProjectDependencyGraphUpToDate = function () {
var _this = this;
if (!this.projectVersionForDependencyGraph || this.project.getProjectVersion() !== this.projectVersionForDependencyGraph) {
diff --git a/lib/tsserverlibrary.d.ts b/lib/tsserverlibrary.d.ts
index 2537e5f..499638a 100644
--- a/lib/tsserverlibrary.d.ts
+++ b/lib/tsserverlibrary.d.ts
@@ -2340,7 +2340,7 @@ declare namespace ts {
}
}
declare namespace ts {
- const version = "2.4.1";
+ const version = "2.4.2";
}
declare function setTimeout(handler: (...args: any[]) => void, timeout: number): any;
declare function clearTimeout(handle: any): void;
diff --git a/lib/tsserverlibrary.js b/lib/tsserverlibrary.js
index 17a5f78..1d1a755 100644
--- a/lib/tsserverlibrary.js
+++ b/lib/tsserverlibrary.js
@@ -1145,7 +1145,7 @@ var ts;
})(ts || (ts = {}));
var ts;
(function (ts) {
- ts.version = "2.4.1";
+ ts.version = "2.4.2";
})(ts || (ts = {}));
(function (ts) {
var Ternary;
@@ -25731,7 +25731,7 @@ var ts;
}
function getExportsOfModule(moduleSymbol) {
var links = getSymbolLinks(moduleSymbol);
- return links.resolvedExports || (links.resolvedExports = getExportsForModule(moduleSymbol));
+ return links.resolvedExports || (links.resolvedExports = getExportsOfModuleWorker(moduleSymbol));
}
function extendExportSymbols(target, source, lookupTable, exportNode) {
source && source.forEach(function (sourceSymbol, id) {
@@ -25757,10 +25757,10 @@ var ts;
}
});
}
- function getExportsForModule(moduleSymbol) {
+ function getExportsOfModuleWorker(moduleSymbol) {
var visitedSymbols = [];
moduleSymbol = resolveExternalModuleSymbol(moduleSymbol);
- return visit(moduleSymbol) || moduleSymbol.exports;
+ return visit(moduleSymbol) || emptySymbols;
function visit(symbol) {
if (!(symbol && symbol.flags & 1952 && !ts.contains(visitedSymbols, symbol))) {
return;
@@ -78425,6 +78425,9 @@ var ts;
AbstractBuilder.prototype.getFileInfos = function () {
return this.fileInfos_doNotAccessDirectly || (this.fileInfos_doNotAccessDirectly = ts.createFileMap());
};
+ AbstractBuilder.prototype.hasFileInfos = function () {
+ return !!this.fileInfos_doNotAccessDirectly;
+ };
AbstractBuilder.prototype.clear = function () {
this.fileInfos_doNotAccessDirectly = undefined;
};
@@ -78453,6 +78456,7 @@ var ts;
this.getFileInfos().forEachValue(function (_path, value) { return action(value); });
};
AbstractBuilder.prototype.emitFile = function (scriptInfo, writeFile) {
+ this.ensureFileInfoIfInProject(scriptInfo);
var fileInfo = this.getFileInfo(scriptInfo.path);
if (!fileInfo) {
return false;
@@ -78477,7 +78481,20 @@ var ts;
_this.project = project;
return _this;
}
+ NonModuleBuilder.prototype.ensureFileInfoIfInProject = function (scriptInfo) {
+ if (this.project.containsScriptInfo(scriptInfo)) {
+ this.getOrCreateFileInfo(scriptInfo.path);
+ }
+ };
NonModuleBuilder.prototype.onProjectUpdateGraph = function () {
+ var _this = this;
+ if (this.hasFileInfos()) {
+ this.forEachFileInfo(function (fileInfo) {
+ if (!_this.project.containsScriptInfo(fileInfo.scriptInfo)) {
+ _this.removeFileInfo(fileInfo.scriptInfo.path);
+ }
+ });
+ }
};
NonModuleBuilder.prototype.getFilesAffectedBy = function (scriptInfo) {
var info = this.getOrCreateFileInfo(scriptInfo.path);
@@ -78566,9 +78583,14 @@ var ts;
}
return [];
};
- ModuleBuilder.prototype.onProjectUpdateGraph = function () {
+ ModuleBuilder.prototype.ensureFileInfoIfInProject = function (_scriptInfo) {
this.ensureProjectDependencyGraphUpToDate();
};
+ ModuleBuilder.prototype.onProjectUpdateGraph = function () {
+ if (this.hasFileInfos()) {
+ this.ensureProjectDependencyGraphUpToDate();
+ }
+ };
ModuleBuilder.prototype.ensureProjectDependencyGraphUpToDate = function () {
var _this = this;
if (!this.projectVersionForDependencyGraph || this.project.getProjectVersion() !== this.projectVersionForDependencyGraph) {
diff --git a/lib/typescript.d.ts b/lib/typescript.d.ts
index 9dc499c..73c18cf 100644
--- a/lib/typescript.d.ts
+++ b/lib/typescript.d.ts
@@ -2594,7 +2594,7 @@ declare namespace ts {
}
declare namespace ts {
/** The version of the TypeScript compiler release */
- const version = "2.4.1";
+ const version = "2.4.2";
}
declare function setTimeout(handler: (...args: any[]) => void, timeout: number): any;
declare function clearTimeout(handle: any): void;
diff --git a/lib/typescript.js b/lib/typescript.js
index 0f2444e..6d3b150 100644
--- a/lib/typescript.js
+++ b/lib/typescript.js
@@ -1318,7 +1318,7 @@ var ts;
var ts;
(function (ts) {
/** The version of the TypeScript compiler release */
- ts.version = "2.4.1";
+ ts.version = "2.4.2";
})(ts || (ts = {}));
/* @internal */
(function (ts) {
@@ -28322,7 +28322,7 @@ var ts;
}
function getExportsOfModule(moduleSymbol) {
var links = getSymbolLinks(moduleSymbol);
- return links.resolvedExports || (links.resolvedExports = getExportsForModule(moduleSymbol));
+ return links.resolvedExports || (links.resolvedExports = getExportsOfModuleWorker(moduleSymbol));
}
/**
* Extends one symbol table with another while collecting information on name collisions for error message generation into the `lookupTable` argument
@@ -28352,11 +28352,11 @@ var ts;
}
});
}
- function getExportsForModule(moduleSymbol) {
+ function getExportsOfModuleWorker(moduleSymbol) {
var visitedSymbols = [];
// A module defined by an 'export=' consists on one export that needs to be resolved
moduleSymbol = resolveExternalModuleSymbol(moduleSymbol);
- return visit(moduleSymbol) || moduleSymbol.exports;
+ return visit(moduleSymbol) || emptySymbols;
// The ES6 spec permits export * declarations in a module to circularly reference the module itself. For example,
// module 'a' can 'export * from "b"' and 'b' can 'export * from "a"' without error.
function visit(symbol) {
diff --git a/lib/typescriptServices.d.ts b/lib/typescriptServices.d.ts
index 1ea738f..8293eab 100644
--- a/lib/typescriptServices.d.ts
+++ b/lib/typescriptServices.d.ts
@@ -2594,7 +2594,7 @@ declare namespace ts {
}
declare namespace ts {
/** The version of the TypeScript compiler release */
- const version = "2.4.1";
+ const version = "2.4.2";
}
declare function setTimeout(handler: (...args: any[]) => void, timeout: number): any;
declare function clearTimeout(handle: any): void;
diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js
index 0f2444e..6d3b150 100644
--- a/lib/typescriptServices.js
+++ b/lib/typescriptServices.js
@@ -1318,7 +1318,7 @@ var ts;
var ts;
(function (ts) {
/** The version of the TypeScript compiler release */
- ts.version = "2.4.1";
+ ts.version = "2.4.2";
})(ts || (ts = {}));
/* @internal */
(function (ts) {
@@ -28322,7 +28322,7 @@ var ts;
}
function getExportsOfModule(moduleSymbol) {
var links = getSymbolLinks(moduleSymbol);
- return links.resolvedExports || (links.resolvedExports = getExportsForModule(moduleSymbol));
+ return links.resolvedExports || (links.resolvedExports = getExportsOfModuleWorker(moduleSymbol));
}
/**
* Extends one symbol table with another while collecting information on name collisions for error message generation into the `lookupTable` argument
@@ -28352,11 +28352,11 @@ var ts;
}
});
}
- function getExportsForModule(moduleSymbol) {
+ function getExportsOfModuleWorker(moduleSymbol) {
var visitedSymbols = [];
// A module defined by an 'export=' consists on one export that needs to be resolved
moduleSymbol = resolveExternalModuleSymbol(moduleSymbol);
- return visit(moduleSymbol) || moduleSymbol.exports;
+ return visit(moduleSymbol) || emptySymbols;
// The ES6 spec permits export * declarations in a module to circularly reference the module itself. For example,
// module 'a' can 'export * from "b"' and 'b' can 'export * from "a"' without error.
function visit(symbol) {
diff --git a/lib/typingsInstaller.js b/lib/typingsInstaller.js
index c83cde7..9c6ca60 100644
--- a/lib/typingsInstaller.js
+++ b/lib/typingsInstaller.js
@@ -161,7 +161,7 @@ var ts;
})(ts || (ts = {}));
var ts;
(function (ts) {
- ts.version = "2.4.1";
+ ts.version = "2.4.2";
})(ts || (ts = {}));
(function (ts) {
ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator(undefined, { usage: "sort", sensitivity: "accent" }) : undefined;
diff --git a/package.json b/package.json
index f672e7f..4933958 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "typescript",
"author": "Microsoft Corp.",
"homepage": "http://typescriptlang.org/",
- "version": "2.4.1",
+ "version": "2.4.2",
"license": "Apache-2.0",
"description": "TypeScript is a language for application scale JavaScript development",
"keywords": [
diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts
index 8158e5e..cca5219 100644
--- a/src/compiler/checker.ts
+++ b/src/compiler/checker.ts
@@ -1770,7 +1770,7 @@ namespace ts {
function getExportsOfModule(moduleSymbol: Symbol): SymbolTable {
const links = getSymbolLinks(moduleSymbol);
- return links.resolvedExports || (links.resolvedExports = getExportsForModule(moduleSymbol));
+ return links.resolvedExports || (links.resolvedExports = getExportsOfModuleWorker(moduleSymbol));
}
interface ExportCollisionTracker {
@@ -1807,13 +1807,13 @@ namespace ts {
});
}
- function getExportsForModule(moduleSymbol: Symbol): SymbolTable {
+ function getExportsOfModuleWorker(moduleSymbol: Symbol): SymbolTable {
const visitedSymbols: Symbol[] = [];
// A module defined by an 'export=' consists on one export that needs to be resolved
moduleSymbol = resolveExternalModuleSymbol(moduleSymbol);
- return visit(moduleSymbol) || moduleSymbol.exports;
+ return visit(moduleSymbol) || emptySymbols;
// The ES6 spec permits export * declarations in a module to circularly reference the module itself. For example,
// module 'a' can 'export * from "b"' and 'b' can 'export * from "a"' without error.
diff --git a/src/compiler/core.ts b/src/compiler/core.ts
index e02fcdd..3b3701e 100644
--- a/src/compiler/core.ts
+++ b/src/compiler/core.ts
@@ -3,7 +3,7 @@
namespace ts {
/** The version of the TypeScript compiler release */
- export const version = "2.4.1";
+ export const version = "2.4.2";
}
/* @internal */
diff --git a/src/server/builder.ts b/src/server/builder.ts
index bfd4f4a..895732e 100644
--- a/src/server/builder.ts
+++ b/src/server/builder.ts
@@ -93,6 +93,10 @@ namespace ts.server {
return this.fileInfos_doNotAccessDirectly || (this.fileInfos_doNotAccessDirectly = createFileMap<T>());
}
+ protected hasFileInfos() {
+ return !!this.fileInfos_doNotAccessDirectly;
+ }
+
public clear() {
// drop the existing list - it will be re-created as necessary
this.fileInfos_doNotAccessDirectly = undefined;
@@ -130,11 +134,13 @@ namespace ts.server {
abstract getFilesAffectedBy(scriptInfo: ScriptInfo): string[];
abstract onProjectUpdateGraph(): void;
+ protected abstract ensureFileInfoIfInProject(scriptInfo: ScriptInfo): void;
/**
* @returns {boolean} whether the emit was conducted or not
*/
emitFile(scriptInfo: ScriptInfo, writeFile: (path: string, data: string, writeByteOrderMark?: boolean) => void): boolean {
+ this.ensureFileInfoIfInProject(scriptInfo);
const fileInfo = this.getFileInfo(scriptInfo.path);
if (!fileInfo) {
return false;
@@ -158,7 +164,21 @@ namespace ts.server {
super(project, BuilderFileInfo);
}
+ protected ensureFileInfoIfInProject(scriptInfo: ScriptInfo) {
+ if (this.project.containsScriptInfo(scriptInfo)) {
+ this.getOrCreateFileInfo(scriptInfo.path);
+ }
+ }
+
onProjectUpdateGraph() {
+ if (this.hasFileInfos()) {
+ this.forEachFileInfo(fileInfo => {
+ if (!this.project.containsScriptInfo(fileInfo.scriptInfo)) {
+ // This file was deleted from this project
+ this.removeFileInfo(fileInfo.scriptInfo.path);
+ }
+ });
+ }
}
/**
@@ -262,10 +282,17 @@ namespace ts.server {
return [];
}
- onProjectUpdateGraph() {
+ protected ensureFileInfoIfInProject(_scriptInfo: ScriptInfo) {
this.ensureProjectDependencyGraphUpToDate();
}
+ onProjectUpdateGraph() {
+ // Update the graph only if we have computed graph earlier
+ if (this.hasFileInfos()) {
+ this.ensureProjectDependencyGraphUpToDate();
+ }
+ }
+
private ensureProjectDependencyGraphUpToDate() {
if (!this.projectVersionForDependencyGraph || this.project.getProjectVersion() !== this.projectVersionForDependencyGraph) {
const currentScriptInfos = this.project.getScriptInfos();
@@ -386,4 +413,4 @@ namespace ts.server {
return new ModuleBuilder(project);
}
}
-}
\ No newline at end of file
+}
diff --git a/tests/cases/fourslash/completionList_getExportsOfModule.ts b/tests/cases/fourslash/completionList_getExportsOfModule.ts
new file mode 100644
index 0000000..0f28c3f
--- /dev/null
+++ b/tests/cases/fourslash/completionList_getExportsOfModule.ts
@@ -0,0 +1,16 @@
+/// <reference path='fourslash.ts'/>
+
+// This used to cause a crash because we would ask for exports on `"x"`,
+// which would return undefined and cause a NPE. Now we return emptySymbol instead.
+// See GH#16610.
+
+////declare module "x" {
+//// declare var x: number;
+//// export = x;
+////}
+////
+////let y: /**/
+
+goTo.marker();
+// This is just a dummy test to cause `getCompletionsAtPosition` to be called.
+verify.not.completionListContains("x");
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-typescript.git
More information about the Pkg-javascript-commits
mailing list