Skip to content

Commit

Permalink
Just use notImplemented
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Hanson committed Oct 20, 2016
1 parent 5e7e542 commit ca97006
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 31 deletions.
7 changes: 1 addition & 6 deletions src/compiler/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -872,16 +872,11 @@ namespace ts {
/** Does nothing. */
export function noop(): void {}

/** A function not intended to be implemented. */
/** Throws an error because a function is not implemented. */
export function notImplemented(): never {
throw new Error("Not implemented");
}

/** A function which isn't implemented, but should be eventually. */
export function notYetImplemented(): never {
throw new Error("TODO: Not yet implemented");
}

export function memoize<T>(callback: () => T): () => T {
let value: T;
return () => {
Expand Down
2 changes: 1 addition & 1 deletion src/harness/harness.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1668,7 +1668,7 @@ namespace Harness {
// This does not need to exist strictly speaking, but many tests will need to be updated if it's removed
export function compileString(_code: string, _unitName: string, _callback: (result: CompilerResult) => void) {
// NEWTODO: Re-implement 'compileString'
return ts.notYetImplemented();
return ts.notImplemented();
}

export interface GeneratedFile {
Expand Down
8 changes: 4 additions & 4 deletions src/harness/harnessLanguageService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ namespace Harness.LanguageService {
getLocalizedDiagnosticMessages(): string { return JSON.stringify({}); }

readDirectory(_rootDir: string, _extension: string): string {
return ts.notYetImplemented();
return ts.notImplemented();
}
readDirectoryNames = ts.notImplemented;
readFileNames = ts.notImplemented;
Expand All @@ -335,7 +335,7 @@ namespace Harness.LanguageService {
constructor(private shim: ts.ClassifierShim) {
}
getEncodedLexicalClassifications(_text: string, _lexState: ts.EndOfLineState, _classifyKeywordsInGenerics?: boolean): ts.Classifications {
return ts.notYetImplemented();
return ts.notImplemented();
}
getClassificationsForLine(text: string, lexState: ts.EndOfLineState, classifyKeywordsInGenerics?: boolean): ts.ClassificationResult {
const result = this.shim.getClassificationsForLine(text, lexState, classifyKeywordsInGenerics).split("\n");
Expand Down Expand Up @@ -644,7 +644,7 @@ namespace Harness.LanguageService {
}

createDirectory(_directoryName: string): void {
return ts.notYetImplemented();
return ts.notImplemented();
}

getCurrentDirectory(): string {
Expand All @@ -660,7 +660,7 @@ namespace Harness.LanguageService {
}

readDirectory(_path: string, _extension?: string[], _exclude?: string[], _include?: string[]): string[] {
return ts.notYetImplemented();
return ts.notImplemented();
}

watchFile(): ts.FileWatcher {
Expand Down
6 changes: 3 additions & 3 deletions src/harness/unittests/cachingInServerLSHost.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ namespace ts {
return path in fileMap ? fileMap[path].content : undefined;
},
writeFile: (_path: string, _data: string, _writeByteOrderMark?: boolean) => {
return ts.notYetImplemented();
return ts.notImplemented();
},
resolvePath: (_path: string): string => {
return ts.notYetImplemented();
return ts.notImplemented();
},
fileExists: (path: string): boolean => {
return path in fileMap;
Expand All @@ -47,7 +47,7 @@ namespace ts {
getDirectories: () => [],
getEnvironmentVariable: () => "",
readDirectory: (_path: string, _extension?: string[], _exclude?: string[], _include?: string[]): string[] => {
return ts.notYetImplemented();
return ts.notImplemented();
},
exit: noop,
watchFile: () => ({
Expand Down
2 changes: 1 addition & 1 deletion src/harness/unittests/reuseProgramStructure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ namespace ts {
getDefaultLibFileName(): string {
return "lib.d.ts";
},
writeFile: notYetImplemented,
writeFile: notImplemented,
getCurrentDirectory(): string {
return "";
},
Expand Down
4 changes: 2 additions & 2 deletions src/harness/unittests/tsserverProjectSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -521,8 +521,8 @@ namespace ts.projectSystem {
readonly resolvePath = (s: string) => s;
readonly getExecutingFilePath = () => this.executingFilePath;
readonly getCurrentDirectory = () => this.currentDirectory;
readonly exit = notYetImplemented;
readonly getEnvironmentVariable = notYetImplemented;
readonly exit = notImplemented;
readonly getEnvironmentVariable = notImplemented;
}

export function makeSessionRequest<T>(command: string, args: T) {
Expand Down
28 changes: 14 additions & 14 deletions src/server/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ namespace ts.server {
}

getCompletionEntrySymbol(_fileName: string, _position: number, _entryName: string): Symbol {
return notYetImplemented();
return notImplemented();
}

getNavigateToItems(searchValue: string): NavigateToItem[] {
Expand Down Expand Up @@ -415,7 +415,7 @@ namespace ts.server {
}

getEmitOutput(_fileName: string): EmitOutput {
return notYetImplemented();
return notImplemented();
}

getSyntacticDiagnostics(fileName: string): Diagnostic[] {
Expand Down Expand Up @@ -457,7 +457,7 @@ namespace ts.server {
}

getCompilerOptionsDiagnostics(): Diagnostic[] {
return notYetImplemented();
return notImplemented();
}

getRenameInfo(fileName: string, position: number, findInStrings?: boolean, findInComments?: boolean): RenameInfo {
Expand Down Expand Up @@ -562,11 +562,11 @@ namespace ts.server {
}

getNameOrDottedNameSpan(_fileName: string, _startPos: number, _endPos: number): TextSpan {
return notYetImplemented();
return notImplemented();
}

getBreakpointStatementAtPosition(_fileName: string, _position: number): TextSpan {
return notYetImplemented();
return notImplemented();
}

getSignatureHelpItems(fileName: string, position: number): SignatureHelpItems {
Expand Down Expand Up @@ -656,19 +656,19 @@ namespace ts.server {
}

getOutliningSpans(_fileName: string): OutliningSpan[] {
return notYetImplemented();
return notImplemented();
}

getTodoComments(_fileName: string, _descriptors: TodoCommentDescriptor[]): TodoComment[] {
return notYetImplemented();
return notImplemented();
}

getDocCommentTemplateAtPosition(_fileName: string, _position: number): TextInsertion {
return notYetImplemented();
return notImplemented();
}

isValidBraceCompletionAtPosition(_fileName: string, _position: number, _openingBrace: number): boolean {
return notYetImplemented();
return notImplemented();
}

getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: number[]): CodeAction[] {
Expand Down Expand Up @@ -735,23 +735,23 @@ namespace ts.server {
}

getIndentationAtPosition(_fileName: string, _position: number, _options: EditorOptions): number {
return notYetImplemented();
return notImplemented();
}

getSyntacticClassifications(_fileName: string, _span: TextSpan): ClassifiedSpan[] {
return notYetImplemented();
return notImplemented();
}

getSemanticClassifications(_fileName: string, _span: TextSpan): ClassifiedSpan[] {
return notYetImplemented();
return notImplemented();
}

getEncodedSyntacticClassifications(_fileName: string, _span: TextSpan): Classifications {
return notYetImplemented();
return notImplemented();
}

getEncodedSemanticClassifications(_fileName: string, _span: TextSpan): Classifications {
return notYetImplemented();
return notImplemented();
}

getProgram(): Program {
Expand Down

0 comments on commit ca97006

Please sign in to comment.