mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' into abstract-semicolon-insertion
This commit is contained in:
+15
-1
@@ -14224,7 +14224,21 @@ namespace ts {
|
||||
}
|
||||
|
||||
if (isHeritageClauseElementIdentifier(<EntityName>entityName)) {
|
||||
let meaning = entityName.parent.kind === SyntaxKind.ExpressionWithTypeArguments ? SymbolFlags.Type : SymbolFlags.Namespace;
|
||||
let meaning = SymbolFlags.None;
|
||||
|
||||
// In an interface or class, we're definitely interested in a type.
|
||||
if (entityName.parent.kind === SyntaxKind.ExpressionWithTypeArguments) {
|
||||
meaning = SymbolFlags.Type;
|
||||
|
||||
// In a class 'extends' clause we are also looking for a value.
|
||||
if (isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) {
|
||||
meaning |= SymbolFlags.Value;
|
||||
}
|
||||
}
|
||||
else {
|
||||
meaning = SymbolFlags.Namespace;
|
||||
}
|
||||
|
||||
meaning |= SymbolFlags.Alias;
|
||||
return resolveEntityName(<EntityName>entityName, meaning);
|
||||
}
|
||||
|
||||
+7
-2
@@ -8,7 +8,7 @@ namespace ts {
|
||||
write(s: string): void;
|
||||
readFile(path: string, encoding?: string): string;
|
||||
writeFile(path: string, data: string, writeByteOrderMark?: boolean): void;
|
||||
watchFile?(path: string, callback: (path: string) => void): FileWatcher;
|
||||
watchFile?(path: string, callback: (path: string, removed: boolean) => void): FileWatcher;
|
||||
resolvePath(path: string): string;
|
||||
fileExists(path: string): boolean;
|
||||
directoryExists(path: string): boolean;
|
||||
@@ -292,11 +292,16 @@ namespace ts {
|
||||
};
|
||||
|
||||
function fileChanged(curr: any, prev: any) {
|
||||
// mtime.getTime() equals 0 if file was removed
|
||||
if (curr.mtime.getTime() === 0) {
|
||||
callback(fileName, /* removed */ true);
|
||||
return;
|
||||
}
|
||||
if (+curr.mtime <= +prev.mtime) {
|
||||
return;
|
||||
}
|
||||
|
||||
callback(fileName);
|
||||
callback(fileName, /* removed */ false);
|
||||
}
|
||||
},
|
||||
resolvePath: function (path: string): string {
|
||||
|
||||
+10
-4
@@ -275,7 +275,7 @@ namespace ts {
|
||||
let sourceFile = hostGetSourceFile(fileName, languageVersion, onError);
|
||||
if (sourceFile && compilerOptions.watch) {
|
||||
// Attach a file watcher
|
||||
sourceFile.fileWatcher = sys.watchFile(sourceFile.fileName, () => sourceFileChanged(sourceFile));
|
||||
sourceFile.fileWatcher = sys.watchFile(sourceFile.fileName, (fileName, removed) => sourceFileChanged(sourceFile, removed));
|
||||
}
|
||||
return sourceFile;
|
||||
}
|
||||
@@ -297,9 +297,15 @@ namespace ts {
|
||||
}
|
||||
|
||||
// If a source file changes, mark it as unwatched and start the recompilation timer
|
||||
function sourceFileChanged(sourceFile: SourceFile) {
|
||||
function sourceFileChanged(sourceFile: SourceFile, removed: boolean) {
|
||||
sourceFile.fileWatcher.close();
|
||||
sourceFile.fileWatcher = undefined;
|
||||
if (removed) {
|
||||
let index = rootFileNames.indexOf(sourceFile.fileName);
|
||||
if (index >= 0) {
|
||||
rootFileNames.splice(index, 1);
|
||||
}
|
||||
}
|
||||
startTimer();
|
||||
}
|
||||
|
||||
@@ -531,8 +537,8 @@ namespace ts {
|
||||
|
||||
return;
|
||||
|
||||
function serializeCompilerOptions(options: CompilerOptions): Map<string|number|boolean> {
|
||||
let result: Map<string|number|boolean> = {};
|
||||
function serializeCompilerOptions(options: CompilerOptions): Map<string | number | boolean> {
|
||||
let result: Map<string | number | boolean> = {};
|
||||
let optionsNameMap = getOptionNameMap().optionNameMap;
|
||||
|
||||
for (let name in options) {
|
||||
|
||||
@@ -985,6 +985,7 @@ namespace ts {
|
||||
return node === (<ComputedPropertyName>parent).expression;
|
||||
case SyntaxKind.Decorator:
|
||||
case SyntaxKind.JsxExpression:
|
||||
case SyntaxKind.JsxSpreadAttribute:
|
||||
return true;
|
||||
case SyntaxKind.ExpressionWithTypeArguments:
|
||||
return (<ExpressionWithTypeArguments>parent).expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent);
|
||||
|
||||
@@ -157,7 +157,7 @@ namespace FourSlash {
|
||||
return true;
|
||||
}
|
||||
|
||||
public setCancelled(numberOfCalls: number = 0): void {
|
||||
public setCancelled(numberOfCalls = 0): void {
|
||||
ts.Debug.assert(numberOfCalls >= 0);
|
||||
this.numberOfCallsBeforeCancellation = numberOfCalls;
|
||||
}
|
||||
@@ -761,7 +761,7 @@ namespace FourSlash {
|
||||
this.raiseError(`verifyReferencesAtPositionListContains failed - could not find the item: ${JSON.stringify(missingItem)} in the returned list: (${JSON.stringify(references)})`);
|
||||
}
|
||||
|
||||
public verifyReferencesCountIs(count: number, localFilesOnly: boolean = true) {
|
||||
public verifyReferencesCountIs(count: number, localFilesOnly = true) {
|
||||
this.taoInvalidReason = "verifyReferences NYI";
|
||||
|
||||
let references = this.getReferencesAtCaret();
|
||||
|
||||
+10
-10
@@ -11,7 +11,7 @@ namespace ts.server {
|
||||
input: process.stdin,
|
||||
output: process.stdout,
|
||||
terminal: false,
|
||||
});
|
||||
});
|
||||
|
||||
class Logger implements ts.server.Logger {
|
||||
fd = -1;
|
||||
@@ -58,7 +58,7 @@ namespace ts.server {
|
||||
isVerbose() {
|
||||
return this.loggingEnabled() && (this.level == "verbose");
|
||||
}
|
||||
|
||||
|
||||
|
||||
msg(s: string, type = "Err") {
|
||||
if (this.fd < 0) {
|
||||
@@ -85,7 +85,7 @@ namespace ts.server {
|
||||
|
||||
interface WatchedFile {
|
||||
fileName: string;
|
||||
callback: (fileName: string) => void;
|
||||
callback: (fileName: string, removed: boolean) => void;
|
||||
mtime: Date;
|
||||
}
|
||||
|
||||
@@ -121,11 +121,11 @@ namespace ts.server {
|
||||
|
||||
fs.stat(watchedFile.fileName,(err, stats) => {
|
||||
if (err) {
|
||||
watchedFile.callback(watchedFile.fileName);
|
||||
watchedFile.callback(watchedFile.fileName, /* removed */ false);
|
||||
}
|
||||
else if (watchedFile.mtime.getTime() !== stats.mtime.getTime()) {
|
||||
watchedFile.mtime = WatchedFileSet.getModifiedTime(watchedFile.fileName);
|
||||
watchedFile.callback(watchedFile.fileName);
|
||||
watchedFile.callback(watchedFile.fileName, watchedFile.mtime.getTime() === 0);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -153,7 +153,7 @@ namespace ts.server {
|
||||
}, this.interval);
|
||||
}
|
||||
|
||||
addFile(fileName: string, callback: (fileName: string) => void ): WatchedFile {
|
||||
addFile(fileName: string, callback: (fileName: string, removed: boolean) => void ): WatchedFile {
|
||||
var file: WatchedFile = {
|
||||
fileName,
|
||||
callback,
|
||||
@@ -170,7 +170,7 @@ namespace ts.server {
|
||||
removeFile(file: WatchedFile) {
|
||||
this.watchedFiles = WatchedFileSet.copyListRemovingItem(file, this.watchedFiles);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class IOSession extends Session {
|
||||
constructor(host: ServerHost, logger: ts.server.Logger) {
|
||||
@@ -243,11 +243,11 @@ namespace ts.server {
|
||||
// TODO: check that this location is writable
|
||||
|
||||
var logger = createLoggerFromEnv();
|
||||
|
||||
|
||||
// REVIEW: for now this implementation uses polling.
|
||||
// The advantage of polling is that it works reliably
|
||||
// on all os and with network mounted files.
|
||||
// For 90 referenced files, the average time to detect
|
||||
// For 90 referenced files, the average time to detect
|
||||
// changes is 2*msInterval (by default 5 seconds).
|
||||
// The overhead of this is .04 percent (1/2500) with
|
||||
// average pause of < 1 millisecond (and max
|
||||
@@ -271,4 +271,4 @@ namespace ts.server {
|
||||
});
|
||||
// Start listening
|
||||
ioSession.listen();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user