mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-27 22:13:40 -05:00
parser and services changes due to CR comments
- Adding assert to ensure script kinds are not modified for registered docs - setting script kind in parseSourceFile and consuming it initialize state and getLanguageVariant
This commit is contained in:
@@ -2857,6 +2857,12 @@ namespace ts {
|
||||
// it's source file any more, and instead defers to DocumentRegistry to get
|
||||
// either version 1, version 2 (or some other version) depending on what the
|
||||
// host says should be used.
|
||||
|
||||
// We do not support the scenario where a host can modify a registered
|
||||
// file's script kind, i.e. in one project some file is treated as ".ts"
|
||||
// and in another as ".js"
|
||||
Debug.assert(hostFileInformation.scriptKind === oldSourceFile.scriptKind, "Registered script kind (" + oldSourceFile.scriptKind + ") should match new script kind (" + hostFileInformation.scriptKind +") for file: " + fileName);
|
||||
|
||||
return documentRegistry.updateDocument(fileName, newSettings, hostFileInformation.scriptSnapshot, hostFileInformation.version, hostFileInformation.scriptKind);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user