Skip to content

Commit

Permalink
Update LKG
Browse files Browse the repository at this point in the history
  • Loading branch information
mhegazy committed Aug 30, 2017
1 parent 20da159 commit 171c664
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 32 deletions.
11 changes: 5 additions & 6 deletions lib/tsserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -64887,11 +64887,10 @@ var ts;
var bucket = getBucketForCompilationSettings(key, true);
var entry = bucket.get(path);
if (!entry) {
ts.Debug.assert(acquiring, "How could we be trying to update a document that the registry doesn't have?");
var sourceFile = ts.createLanguageServiceSourceFile(fileName, scriptSnapshot, compilationSettings.target, version, false, scriptKind);
entry = {
sourceFile: sourceFile,
languageServiceRefCount: 0,
languageServiceRefCount: 1,
owners: []
};
bucket.set(path, entry);
Expand All @@ -64900,9 +64899,9 @@ var ts;
if (entry.sourceFile.version !== version) {
entry.sourceFile = ts.updateLanguageServiceSourceFile(entry.sourceFile, scriptSnapshot, version, scriptSnapshot.getChangeRange(entry.sourceFile.scriptSnapshot));
}
}
if (acquiring) {
entry.languageServiceRefCount++;
if (acquiring) {
entry.languageServiceRefCount++;
}
}
return entry.sourceFile;
}
Expand Down Expand Up @@ -80823,7 +80822,7 @@ var ts;
for (var _i = 0, openFiles_1 = openFiles; _i < openFiles_1.length; _i++) {
var file = openFiles_1[_i];
var scriptInfo = this.getScriptInfo(file.fileName);
ts.Debug.assert(!scriptInfo || !scriptInfo.isScriptOpen());
ts.Debug.assert(!scriptInfo || !scriptInfo.isScriptOpen(), "Script should not exist and not be open already");
var normalizedPath = scriptInfo ? scriptInfo.fileName : server.toNormalizedPath(file.fileName);
this.openClientFileWithNormalizedPath(normalizedPath, file.content, tryConvertScriptKindName(file.scriptKind), file.hasMixedContent);
}
Expand Down
11 changes: 5 additions & 6 deletions lib/tsserverlibrary.js
Original file line number Diff line number Diff line change
Expand Up @@ -64887,11 +64887,10 @@ var ts;
var bucket = getBucketForCompilationSettings(key, true);
var entry = bucket.get(path);
if (!entry) {
ts.Debug.assert(acquiring, "How could we be trying to update a document that the registry doesn't have?");
var sourceFile = ts.createLanguageServiceSourceFile(fileName, scriptSnapshot, compilationSettings.target, version, false, scriptKind);
entry = {
sourceFile: sourceFile,
languageServiceRefCount: 0,
languageServiceRefCount: 1,
owners: []
};
bucket.set(path, entry);
Expand All @@ -64900,9 +64899,9 @@ var ts;
if (entry.sourceFile.version !== version) {
entry.sourceFile = ts.updateLanguageServiceSourceFile(entry.sourceFile, scriptSnapshot, version, scriptSnapshot.getChangeRange(entry.sourceFile.scriptSnapshot));
}
}
if (acquiring) {
entry.languageServiceRefCount++;
if (acquiring) {
entry.languageServiceRefCount++;
}
}
return entry.sourceFile;
}
Expand Down Expand Up @@ -82561,7 +82560,7 @@ var ts;
for (var _i = 0, openFiles_1 = openFiles; _i < openFiles_1.length; _i++) {
var file = openFiles_1[_i];
var scriptInfo = this.getScriptInfo(file.fileName);
ts.Debug.assert(!scriptInfo || !scriptInfo.isScriptOpen());
ts.Debug.assert(!scriptInfo || !scriptInfo.isScriptOpen(), "Script should not exist and not be open already");
var normalizedPath = scriptInfo ? scriptInfo.fileName : server.toNormalizedPath(file.fileName);
this.openClientFileWithNormalizedPath(normalizedPath, file.content, tryConvertScriptKindName(file.scriptKind), file.hasMixedContent);
}
Expand Down
19 changes: 9 additions & 10 deletions lib/typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -78177,12 +78177,11 @@ var ts;
var bucket = getBucketForCompilationSettings(key, /*createIfMissing*/ true);
var entry = bucket.get(path);
if (!entry) {
ts.Debug.assert(acquiring, "How could we be trying to update a document that the registry doesn't have?");
// Have never seen this file with these settings. Create a new source file for it.
var sourceFile = ts.createLanguageServiceSourceFile(fileName, scriptSnapshot, compilationSettings.target, version, /*setNodeParents*/ false, scriptKind);
entry = {
sourceFile: sourceFile,
languageServiceRefCount: 0,
languageServiceRefCount: 1,
owners: []
};
bucket.set(path, entry);
Expand All @@ -78194,14 +78193,14 @@ var ts;
if (entry.sourceFile.version !== version) {
entry.sourceFile = ts.updateLanguageServiceSourceFile(entry.sourceFile, scriptSnapshot, version, scriptSnapshot.getChangeRange(entry.sourceFile.scriptSnapshot));
}
}
// If we're acquiring, then this is the first time this LS is asking for this document.
// Increase our ref count so we know there's another LS using the document. If we're
// not acquiring, then that means the LS is 'updating' the file instead, and that means
// it has already acquired the document previously. As such, we do not need to increase
// the ref count.
if (acquiring) {
entry.languageServiceRefCount++;
// If we're acquiring, then this is the first time this LS is asking for this document.
// Increase our ref count so we know there's another LS using the document. If we're
// not acquiring, then that means the LS is 'updating' the file instead, and that means
// it has already acquired the document previously. As such, we do not need to increase
// the ref count.
if (acquiring) {
entry.languageServiceRefCount++;
}
}
return entry.sourceFile;
}
Expand Down
19 changes: 9 additions & 10 deletions lib/typescriptServices.js
Original file line number Diff line number Diff line change
Expand Up @@ -78177,12 +78177,11 @@ var ts;
var bucket = getBucketForCompilationSettings(key, /*createIfMissing*/ true);
var entry = bucket.get(path);
if (!entry) {
ts.Debug.assert(acquiring, "How could we be trying to update a document that the registry doesn't have?");
// Have never seen this file with these settings. Create a new source file for it.
var sourceFile = ts.createLanguageServiceSourceFile(fileName, scriptSnapshot, compilationSettings.target, version, /*setNodeParents*/ false, scriptKind);
entry = {
sourceFile: sourceFile,
languageServiceRefCount: 0,
languageServiceRefCount: 1,
owners: []
};
bucket.set(path, entry);
Expand All @@ -78194,14 +78193,14 @@ var ts;
if (entry.sourceFile.version !== version) {
entry.sourceFile = ts.updateLanguageServiceSourceFile(entry.sourceFile, scriptSnapshot, version, scriptSnapshot.getChangeRange(entry.sourceFile.scriptSnapshot));
}
}
// If we're acquiring, then this is the first time this LS is asking for this document.
// Increase our ref count so we know there's another LS using the document. If we're
// not acquiring, then that means the LS is 'updating' the file instead, and that means
// it has already acquired the document previously. As such, we do not need to increase
// the ref count.
if (acquiring) {
entry.languageServiceRefCount++;
// If we're acquiring, then this is the first time this LS is asking for this document.
// Increase our ref count so we know there's another LS using the document. If we're
// not acquiring, then that means the LS is 'updating' the file instead, and that means
// it has already acquired the document previously. As such, we do not need to increase
// the ref count.
if (acquiring) {
entry.languageServiceRefCount++;
}
}
return entry.sourceFile;
}
Expand Down

0 comments on commit 171c664

Please sign in to comment.