@@ -42743,9 +42743,10 @@ var ts;
42743
42743
this.host = host;
42744
42744
this.project = project;
42745
42745
this.ls = null;
42746
- this.filenameToScript = {};
42747
42746
this.roots = [];
42748
- this.resolvedModuleNames = ts.createFileMap(ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames));
42747
+ var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames);
42748
+ this.resolvedModuleNames = ts.createFileMap(getCanonicalFileName);
42749
+ this.filenameToScript = ts.createFileMap(getCanonicalFileName);
42749
42750
this.moduleResolutionHost = {
42750
42751
fileExists: function (fileName) { return _this.fileExists(fileName); },
42751
42752
readFile: function (fileName) { return _this.host.readFile(fileName); }
@@ -42824,33 +42825,29 @@ var ts;
42824
42825
};
42825
42826
LSHost.prototype.removeReferencedFile = function (info) {
42826
42827
if (!info.isOpen) {
42827
- this.filenameToScript[ info.fileName] = undefined ;
42828
+ this.filenameToScript.remove( info.fileName) ;
42828
42829
this.resolvedModuleNames.remove(info.fileName);
42829
42830
}
42830
42831
};
42831
42832
LSHost.prototype.getScriptInfo = function (filename) {
42832
- var scriptInfo = ts.lookUp( this.filenameToScript, filename);
42833
+ var scriptInfo = this.filenameToScript.get( filename);
42833
42834
if (!scriptInfo) {
42834
42835
scriptInfo = this.project.openReferencedFile(filename);
42835
42836
if (scriptInfo) {
42836
- this.filenameToScript[ scriptInfo.fileName] = scriptInfo;
42837
+ this.filenameToScript.set( scriptInfo.fileName, scriptInfo) ;
42837
42838
}
42838
42839
}
42839
- else {
42840
- }
42841
42840
return scriptInfo;
42842
42841
};
42843
42842
LSHost.prototype.addRoot = function (info) {
42844
- var scriptInfo = ts.lookUp(this.filenameToScript, info.fileName);
42845
- if (!scriptInfo) {
42846
- this.filenameToScript[info.fileName] = info;
42843
+ if (!this.filenameToScript.contains(info.fileName)) {
42844
+ this.filenameToScript.set(info.fileName, info);
42847
42845
this.roots.push(info);
42848
42846
}
42849
42847
};
42850
42848
LSHost.prototype.removeRoot = function (info) {
42851
- var scriptInfo = ts.lookUp(this.filenameToScript, info.fileName);
42852
- if (scriptInfo) {
42853
- this.filenameToScript[info.fileName] = undefined;
42849
+ if (!this.filenameToScript.contains(info.fileName)) {
42850
+ this.filenameToScript.remove(info.fileName);
42854
42851
this.roots = copyListRemovingItem(info, this.roots);
42855
42852
this.resolvedModuleNames.remove(info.fileName);
42856
42853
}
@@ -42890,7 +42887,7 @@ var ts;
42890
42887
return this.host.directoryExists(path);
42891
42888
};
42892
42889
LSHost.prototype.lineToTextSpan = function (filename, line) {
42893
- var script = this.filenameToScript[ filename] ;
42890
+ var script = this.filenameToScript.get( filename) ;
42894
42891
var index = script.snap().index;
42895
42892
var lineInfo = index.lineNumberToInfo(line + 1);
42896
42893
var len;
@@ -42904,13 +42901,13 @@ var ts;
42904
42901
return ts.createTextSpan(lineInfo.offset, len);
42905
42902
};
42906
42903
LSHost.prototype.lineOffsetToPosition = function (filename, line, offset) {
42907
- var script = this.filenameToScript[ filename] ;
42904
+ var script = this.filenameToScript.get( filename) ;
42908
42905
var index = script.snap().index;
42909
42906
var lineInfo = index.lineNumberToInfo(line);
42910
42907
return (lineInfo.offset + offset - 1);
42911
42908
};
42912
42909
LSHost.prototype.positionToLineOffset = function (filename, position) {
42913
- var script = this.filenameToScript[ filename] ;
42910
+ var script = this.filenameToScript.get( filename) ;
42914
42911
var index = script.snap().index;
42915
42912
var lineOffset = index.charOffsetToLineNumberAndPos(position);
42916
42913
return { line: lineOffset.line, offset: lineOffset.offset + 1 };
0 commit comments