mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 12:51:30 -05:00
Migrated more MapLikes to Maps
This commit is contained in:
@@ -37,7 +37,7 @@ namespace ts.server {
|
||||
}
|
||||
|
||||
private getLineMap(fileName: string): number[] {
|
||||
let lineMap = ts.lookUp(this.lineMaps, fileName);
|
||||
let lineMap = this.lineMaps[fileName];
|
||||
if (!lineMap) {
|
||||
const scriptSnapshot = this.host.getScriptSnapshot(fileName);
|
||||
lineMap = this.lineMaps[fileName] = ts.computeLineStarts(scriptSnapshot.getText(0, scriptSnapshot.getLength()));
|
||||
|
||||
@@ -136,9 +136,9 @@ namespace ts.server {
|
||||
|
||||
for (const name of names) {
|
||||
// check if this is a duplicate entry in the list
|
||||
let resolution = lookUp(newResolutions, name);
|
||||
let resolution = newResolutions[name];
|
||||
if (!resolution) {
|
||||
const existingResolution = currentResolutionsInFile && ts.lookUp(currentResolutionsInFile, name);
|
||||
const existingResolution = currentResolutionsInFile && currentResolutionsInFile[name];
|
||||
if (moduleResolutionIsValid(existingResolution)) {
|
||||
// ok, it is safe to use existing name resolution results
|
||||
resolution = existingResolution;
|
||||
@@ -563,7 +563,7 @@ namespace ts.server {
|
||||
}
|
||||
|
||||
let strBuilder = "";
|
||||
ts.forEachValue(this.filenameToSourceFile,
|
||||
ts.forEachProperty(this.filenameToSourceFile,
|
||||
sourceFile => { strBuilder += sourceFile.fileName + "\n"; });
|
||||
return strBuilder;
|
||||
}
|
||||
@@ -857,7 +857,7 @@ namespace ts.server {
|
||||
if (project.isConfiguredProject()) {
|
||||
project.projectFileWatcher.close();
|
||||
project.directoryWatcher.close();
|
||||
forEachValue(project.directoriesWatchedForWildcards, watcher => { watcher.close(); });
|
||||
forEachProperty(project.directoriesWatchedForWildcards, watcher => { watcher.close(); });
|
||||
delete project.directoriesWatchedForWildcards;
|
||||
this.configuredProjects = copyListRemovingItem(project, this.configuredProjects);
|
||||
}
|
||||
@@ -1124,7 +1124,7 @@ namespace ts.server {
|
||||
|
||||
getScriptInfo(filename: string) {
|
||||
filename = ts.normalizePath(filename);
|
||||
return ts.lookUp(this.filenameToScriptInfo, filename);
|
||||
return this.filenameToScriptInfo[filename];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1133,7 +1133,7 @@ namespace ts.server {
|
||||
*/
|
||||
openFile(fileName: string, openedByClient: boolean, fileContent?: string, scriptKind?: ScriptKind) {
|
||||
fileName = ts.normalizePath(fileName);
|
||||
let info = ts.lookUp(this.filenameToScriptInfo, fileName);
|
||||
let info = this.filenameToScriptInfo[fileName];
|
||||
if (!info) {
|
||||
let content: string;
|
||||
if (this.host.fileExists(fileName)) {
|
||||
@@ -1246,7 +1246,7 @@ namespace ts.server {
|
||||
* @param filename is absolute pathname
|
||||
*/
|
||||
closeClientFile(filename: string) {
|
||||
const info = ts.lookUp(this.filenameToScriptInfo, filename);
|
||||
const info = this.filenameToScriptInfo[filename];
|
||||
if (info) {
|
||||
this.closeOpenFile(info);
|
||||
info.isOpen = false;
|
||||
@@ -1255,14 +1255,14 @@ namespace ts.server {
|
||||
}
|
||||
|
||||
getProjectForFile(filename: string) {
|
||||
const scriptInfo = ts.lookUp(this.filenameToScriptInfo, filename);
|
||||
const scriptInfo = this.filenameToScriptInfo[filename];
|
||||
if (scriptInfo) {
|
||||
return scriptInfo.defaultProject;
|
||||
}
|
||||
}
|
||||
|
||||
printProjectsForFile(filename: string) {
|
||||
const scriptInfo = ts.lookUp(this.filenameToScriptInfo, filename);
|
||||
const scriptInfo = this.filenameToScriptInfo[filename];
|
||||
if (scriptInfo) {
|
||||
this.psLogger.startGroup();
|
||||
this.psLogger.info("Projects for " + filename);
|
||||
@@ -1419,7 +1419,7 @@ namespace ts.server {
|
||||
/*recursive*/ true
|
||||
);
|
||||
|
||||
project.directoriesWatchedForWildcards = reduceProperties(projectOptions.wildcardDirectories, (watchers, flag, directory) => {
|
||||
project.directoriesWatchedForWildcards = reduceOwnProperties(projectOptions.wildcardDirectories, (watchers, flag, directory) => {
|
||||
if (comparePaths(configDirectoryPath, directory, ".", !this.host.useCaseSensitiveFileNames) !== Comparison.EqualTo) {
|
||||
const recursive = (flag & WatchDirectoryFlags.Recursive) !== 0;
|
||||
this.log(`Add ${ recursive ? "recursive " : ""}watcher for: ${directory}`);
|
||||
|
||||
Reference in New Issue
Block a user