diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index d1821d6067..f8826da961 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -9598,7 +9598,7 @@ module ts { return diagnostics.getDiagnostics(); } - function getGlobalDiagnostics(): Diagnostic[]{ + function getGlobalDiagnostics(): Diagnostic[] { throwIfNonDiagnosticsProducing(); return diagnostics.getGlobalDiagnostics(); } @@ -9624,7 +9624,7 @@ module ts { return false; } - function getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[]{ + function getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[] { var symbols: SymbolTable = {}; var memberFlags: NodeFlags = 0; function copySymbol(symbol: Symbol, meaning: SymbolFlags) { @@ -10010,7 +10010,7 @@ module ts { return getNamedMembers(propsByName); } - function getRootSymbols(symbol: Symbol): Symbol[]{ + function getRootSymbols(symbol: Symbol): Symbol[] { if (symbol.flags & SymbolFlags.UnionProperty) { var symbols: Symbol[] = []; var name = symbol.name; diff --git a/src/compiler/core.ts b/src/compiler/core.ts index b82ca2f07a..d527b62005 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -342,16 +342,16 @@ module ts { return diagnostic.file ? diagnostic.file.fileName : undefined; } - export function compareDiagnostics(d1: Diagnostic, d2: Diagnostic): number { + export function compareDiagnostics(d1: Diagnostic, d2: Diagnostic): Comparison { return compareValues(getDiagnosticFileName(d1), getDiagnosticFileName(d2)) || compareValues(d1.start, d2.start) || compareValues(d1.length, d2.length) || compareValues(d1.code, d2.code) || compareMessageText(d1.messageText, d2.messageText) || - 0; + Comparison.EqualTo; } - function compareMessageText(text1: string | DiagnosticMessageChain, text2: string | DiagnosticMessageChain): number { + function compareMessageText(text1: string | DiagnosticMessageChain, text2: string | DiagnosticMessageChain): Comparison { while (text1 && text2) { // We still have both chains. var string1 = typeof text1 === "string" ? text1 : text1.messageText; @@ -368,14 +368,14 @@ module ts { if (!text1 && !text2) { // if the chains are done, then these messages are the same. - return 0; + return Comparison.EqualTo; } // We still have one chain remaining. The shorter chain should come first. - return text1 ? 1 : -1; + return text1 ? Comparison.GreaterThan : Comparison.LessThan; } - export function sortAndDeduplicateDiagnostics(diagnostics: Diagnostic[]): Diagnostic[] { + export function sortAndDeduplicateDiagnostics(diagnostics: Diagnostic[]): Diagnostic[]{ return deduplicateSortedDiagnostics(diagnostics.sort(compareDiagnostics)); } diff --git a/src/compiler/program.ts b/src/compiler/program.ts index e933c54bc1..954c443a77 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -165,7 +165,7 @@ module ts { return noDiagnosticsTypeChecker || (noDiagnosticsTypeChecker = createTypeChecker(program, /*produceDiagnostics:*/ false)); } - function getDeclarationDiagnostics(targetSourceFile: SourceFile): Diagnostic[]{ + function getDeclarationDiagnostics(targetSourceFile: SourceFile): Diagnostic[] { var resolver = getDiagnosticsProducingTypeChecker().getEmitResolver(targetSourceFile); return ts.getDeclarationDiagnostics(getEmitHost(), resolver, targetSourceFile); } @@ -206,11 +206,11 @@ module ts { return sortAndDeduplicateDiagnostics(allDiagnostics); } - function getSyntacticDiagnostics(sourceFile?: SourceFile): Diagnostic[]{ + function getSyntacticDiagnostics(sourceFile?: SourceFile): Diagnostic[] { return getDiagnosticsHelper(sourceFile, getSyntacticDiagnosticsForFile); } - function getSemanticDiagnostics(sourceFile?: SourceFile): Diagnostic[]{ + function getSemanticDiagnostics(sourceFile?: SourceFile): Diagnostic[] { return getDiagnosticsHelper(sourceFile, getSemanticDiagnosticsForFile); } @@ -229,7 +229,7 @@ module ts { return bindDiagnostics.concat(checkDiagnostics).concat(programDiagnostics); } - function getGlobalDiagnostics(): Diagnostic[]{ + function getGlobalDiagnostics(): Diagnostic[] { var typeChecker = getDiagnosticsProducingTypeChecker(); var allDiagnostics: Diagnostic[] = []; diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 23da074815..fd675597cc 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1688,7 +1688,7 @@ module ts { // @internal export interface DiagnosticCollection { // Adds a diagnostic to this diagnostic collection. - add(diagnostic?: Diagnostic): void; + add(diagnostic: Diagnostic): void; // Gets all the diagnostics that aren't associated with a file. getGlobalDiagnostics(): Diagnostic[]; @@ -1697,7 +1697,7 @@ module ts { // Otherwise, returns all the diagnostics (global and file associated) in this colletion. getDiagnostics(fileName?: string): Diagnostic[]; - // Gets a count of how many times this collectoin has been modified. This value changes + // Gets a count of how many times this collection has been modified. This value changes // each time 'add' is called (regardless of whether or not an equivalent diagnostic was // already in the collection). As such, it can be used as a simple way to tell if any // operation caused diagnostics to be returned by storing and comparing the return value