Skip to content

Commit 614b106

Browse files
Merge branch 'master' into completionEntryDetails
2 parents 8d55fe0 + baac6d8 commit 614b106

28 files changed

+577
-206
lines changed

src/compiler/checker.ts

+11-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ module ts {
77

88
/* @internal */ export let checkTime = 0;
99

10+
/* @internal */
11+
export function getSymbolId(symbol: Symbol): number {
12+
if (!symbol.id) {
13+
symbol.id = nextSymbolId++;
14+
}
15+
16+
return symbol.id;
17+
}
18+
1019
export function createTypeChecker(host: TypeCheckerHost, produceDiagnostics: boolean): TypeChecker {
1120
let Symbol = objectAllocator.getSymbolConstructor();
1221
let Type = objectAllocator.getTypeConstructor();
@@ -250,8 +259,8 @@ module ts {
250259

251260
function getSymbolLinks(symbol: Symbol): SymbolLinks {
252261
if (symbol.flags & SymbolFlags.Transient) return <TransientSymbol>symbol;
253-
if (!symbol.id) symbol.id = nextSymbolId++;
254-
return symbolLinks[symbol.id] || (symbolLinks[symbol.id] = {});
262+
var id = getSymbolId(symbol);
263+
return symbolLinks[id] || (symbolLinks[id] = {});
255264
}
256265

257266
function getNodeLinks(node: Node): NodeLinks {

src/compiler/program.ts

+21
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,22 @@ module ts {
1010
/** The version of the TypeScript compiler release */
1111
export let version = "1.5.0.0";
1212

13+
export function findConfigFile(searchPath: string): string {
14+
var fileName = "tsconfig.json";
15+
while (true) {
16+
if (sys.fileExists(fileName)) {
17+
return fileName;
18+
}
19+
var parentPath = getDirectoryPath(searchPath);
20+
if (parentPath === searchPath) {
21+
break;
22+
}
23+
searchPath = parentPath;
24+
fileName = "../" + fileName;
25+
}
26+
return undefined;
27+
}
28+
1329
export function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost {
1430
let currentDirectory: string;
1531
let existingDirectories: Map<boolean> = {};
@@ -87,6 +103,11 @@ module ts {
87103

88104
export function getPreEmitDiagnostics(program: Program): Diagnostic[] {
89105
let diagnostics = program.getSyntacticDiagnostics().concat(program.getGlobalDiagnostics()).concat(program.getSemanticDiagnostics());
106+
107+
if (program.getCompilerOptions().declaration) {
108+
diagnostics.concat(program.getDeclarationDiagnostics());
109+
}
110+
90111
return sortAndDeduplicateDiagnostics(diagnostics);
91112
}
92113

src/compiler/tsc.ts

+2-18
Original file line numberDiff line numberDiff line change
@@ -132,23 +132,6 @@ module ts {
132132
return typeof JSON === "object" && typeof JSON.parse === "function";
133133
}
134134

135-
function findConfigFile(): string {
136-
var searchPath = normalizePath(sys.getCurrentDirectory());
137-
var fileName = "tsconfig.json";
138-
while (true) {
139-
if (sys.fileExists(fileName)) {
140-
return fileName;
141-
}
142-
var parentPath = getDirectoryPath(searchPath);
143-
if (parentPath === searchPath) {
144-
break;
145-
}
146-
searchPath = parentPath;
147-
fileName = "../" + fileName;
148-
}
149-
return undefined;
150-
}
151-
152135
export function executeCommandLine(args: string[]): void {
153136
var commandLine = parseCommandLine(args);
154137
var configFileName: string; // Configuration file name (if any)
@@ -198,7 +181,8 @@ module ts {
198181
}
199182
}
200183
else if (commandLine.fileNames.length === 0 && isJSONSupported()) {
201-
configFileName = findConfigFile();
184+
var searchPath = normalizePath(sys.getCurrentDirectory());
185+
configFileName = findConfigFile(searchPath);
202186
}
203187

204188
if (commandLine.fileNames.length === 0 && !configFileName) {

src/harness/harnessLanguageService.ts

+3
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,9 @@ module Harness.LanguageService {
330330
getReferencesAtPosition(fileName: string, position: number): ts.ReferenceEntry[] {
331331
return unwrapJSONCallResult(this.shim.getReferencesAtPosition(fileName, position));
332332
}
333+
findReferences(fileName: string, position: number): ts.ReferencedSymbol[] {
334+
return unwrapJSONCallResult(this.shim.findReferences(fileName, position));
335+
}
333336
getOccurrencesAtPosition(fileName: string, position: number): ts.ReferenceEntry[] {
334337
return unwrapJSONCallResult(this.shim.getOccurrencesAtPosition(fileName, position));
335338
}

src/server/client.ts

+5
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,11 @@ module ts.server {
300300
});
301301
}
302302

303+
findReferences(fileName: string, position: number): ReferencedSymbol[]{
304+
// Not yet implemented.
305+
return [];
306+
}
307+
303308
getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[] {
304309
var lineOffset = this.positionToOneBasedLineOffset(fileName, position);
305310
var args: protocol.FileLocationRequestArgs = {

0 commit comments

Comments
 (0)