Skip to content

Commit

Permalink
Merge branch 'master' into exportEqualsMerged
Browse files Browse the repository at this point in the history
  • Loading branch information
mhegazy committed Mar 25, 2015
2 parents aa01dcd + baac6d8 commit 1c45b77
Show file tree
Hide file tree
Showing 28 changed files with 572 additions and 206 deletions.
13 changes: 11 additions & 2 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ module ts {

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

/* @internal */
export function getSymbolId(symbol: Symbol): number {
if (!symbol.id) {
symbol.id = nextSymbolId++;
}

return symbol.id;
}

export function createTypeChecker(host: TypeCheckerHost, produceDiagnostics: boolean): TypeChecker {
let Symbol = objectAllocator.getSymbolConstructor();
let Type = objectAllocator.getTypeConstructor();
Expand Down Expand Up @@ -250,8 +259,8 @@ module ts {

function getSymbolLinks(symbol: Symbol): SymbolLinks {
if (symbol.flags & SymbolFlags.Transient) return <TransientSymbol>symbol;
if (!symbol.id) symbol.id = nextSymbolId++;
return symbolLinks[symbol.id] || (symbolLinks[symbol.id] = {});
var id = getSymbolId(symbol);
return symbolLinks[id] || (symbolLinks[id] = {});
}

function getNodeLinks(node: Node): NodeLinks {
Expand Down
16 changes: 16 additions & 0 deletions src/compiler/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,22 @@ module ts {
/** The version of the TypeScript compiler release */
export let version = "1.5.0.0";

export function findConfigFile(searchPath: string): string {
var fileName = "tsconfig.json";
while (true) {
if (sys.fileExists(fileName)) {
return fileName;
}
var parentPath = getDirectoryPath(searchPath);
if (parentPath === searchPath) {
break;
}
searchPath = parentPath;
fileName = "../" + fileName;
}
return undefined;
}

export function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost {
let currentDirectory: string;
let existingDirectories: Map<boolean> = {};
Expand Down
20 changes: 2 additions & 18 deletions src/compiler/tsc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,23 +132,6 @@ module ts {
return typeof JSON === "object" && typeof JSON.parse === "function";
}

function findConfigFile(): string {
var searchPath = normalizePath(sys.getCurrentDirectory());
var fileName = "tsconfig.json";
while (true) {
if (sys.fileExists(fileName)) {
return fileName;
}
var parentPath = getDirectoryPath(searchPath);
if (parentPath === searchPath) {
break;
}
searchPath = parentPath;
fileName = "../" + fileName;
}
return undefined;
}

export function executeCommandLine(args: string[]): void {
var commandLine = parseCommandLine(args);
var configFileName: string; // Configuration file name (if any)
Expand Down Expand Up @@ -198,7 +181,8 @@ module ts {
}
}
else if (commandLine.fileNames.length === 0 && isJSONSupported()) {
configFileName = findConfigFile();
var searchPath = normalizePath(sys.getCurrentDirectory());
configFileName = findConfigFile(searchPath);
}

if (commandLine.fileNames.length === 0 && !configFileName) {
Expand Down
3 changes: 3 additions & 0 deletions src/harness/harnessLanguageService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,9 @@ module Harness.LanguageService {
getReferencesAtPosition(fileName: string, position: number): ts.ReferenceEntry[] {
return unwrapJSONCallResult(this.shim.getReferencesAtPosition(fileName, position));
}
findReferences(fileName: string, position: number): ts.ReferencedSymbol[] {
return unwrapJSONCallResult(this.shim.findReferences(fileName, position));
}
getOccurrencesAtPosition(fileName: string, position: number): ts.ReferenceEntry[] {
return unwrapJSONCallResult(this.shim.getOccurrencesAtPosition(fileName, position));
}
Expand Down
5 changes: 5 additions & 0 deletions src/server/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,11 @@ module ts.server {
});
}

findReferences(fileName: string, position: number): ReferencedSymbol[]{
// Not yet implemented.
return [];
}

getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[] {
var lineOffset = this.positionToOneBasedLineOffset(fileName, position);
var args: protocol.FileLocationRequestArgs = {
Expand Down
Loading

0 comments on commit 1c45b77

Please sign in to comment.