Skip to content

Commit ca97006

Browse files
author
Andy Hanson
committed
Just use notImplemented
1 parent 5e7e542 commit ca97006

File tree

7 files changed

+26
-31
lines changed

7 files changed

+26
-31
lines changed

src/compiler/core.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -872,16 +872,11 @@ namespace ts {
872872
/** Does nothing. */
873873
export function noop(): void {}
874874

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

880-
/** A function which isn't implemented, but should be eventually. */
881-
export function notYetImplemented(): never {
882-
throw new Error("TODO: Not yet implemented");
883-
}
884-
885880
export function memoize<T>(callback: () => T): () => T {
886881
let value: T;
887882
return () => {

src/harness/harness.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1668,7 +1668,7 @@ namespace Harness {
16681668
// This does not need to exist strictly speaking, but many tests will need to be updated if it's removed
16691669
export function compileString(_code: string, _unitName: string, _callback: (result: CompilerResult) => void) {
16701670
// NEWTODO: Re-implement 'compileString'
1671-
return ts.notYetImplemented();
1671+
return ts.notImplemented();
16721672
}
16731673

16741674
export interface GeneratedFile {

src/harness/harnessLanguageService.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ namespace Harness.LanguageService {
313313
getLocalizedDiagnosticMessages(): string { return JSON.stringify({}); }
314314

315315
readDirectory(_rootDir: string, _extension: string): string {
316-
return ts.notYetImplemented();
316+
return ts.notImplemented();
317317
}
318318
readDirectoryNames = ts.notImplemented;
319319
readFileNames = ts.notImplemented;
@@ -335,7 +335,7 @@ namespace Harness.LanguageService {
335335
constructor(private shim: ts.ClassifierShim) {
336336
}
337337
getEncodedLexicalClassifications(_text: string, _lexState: ts.EndOfLineState, _classifyKeywordsInGenerics?: boolean): ts.Classifications {
338-
return ts.notYetImplemented();
338+
return ts.notImplemented();
339339
}
340340
getClassificationsForLine(text: string, lexState: ts.EndOfLineState, classifyKeywordsInGenerics?: boolean): ts.ClassificationResult {
341341
const result = this.shim.getClassificationsForLine(text, lexState, classifyKeywordsInGenerics).split("\n");
@@ -644,7 +644,7 @@ namespace Harness.LanguageService {
644644
}
645645

646646
createDirectory(_directoryName: string): void {
647-
return ts.notYetImplemented();
647+
return ts.notImplemented();
648648
}
649649

650650
getCurrentDirectory(): string {
@@ -660,7 +660,7 @@ namespace Harness.LanguageService {
660660
}
661661

662662
readDirectory(_path: string, _extension?: string[], _exclude?: string[], _include?: string[]): string[] {
663-
return ts.notYetImplemented();
663+
return ts.notImplemented();
664664
}
665665

666666
watchFile(): ts.FileWatcher {

src/harness/unittests/cachingInServerLSHost.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ namespace ts {
2626
return path in fileMap ? fileMap[path].content : undefined;
2727
},
2828
writeFile: (_path: string, _data: string, _writeByteOrderMark?: boolean) => {
29-
return ts.notYetImplemented();
29+
return ts.notImplemented();
3030
},
3131
resolvePath: (_path: string): string => {
32-
return ts.notYetImplemented();
32+
return ts.notImplemented();
3333
},
3434
fileExists: (path: string): boolean => {
3535
return path in fileMap;
@@ -47,7 +47,7 @@ namespace ts {
4747
getDirectories: () => [],
4848
getEnvironmentVariable: () => "",
4949
readDirectory: (_path: string, _extension?: string[], _exclude?: string[], _include?: string[]): string[] => {
50-
return ts.notYetImplemented();
50+
return ts.notImplemented();
5151
},
5252
exit: noop,
5353
watchFile: () => ({

src/harness/unittests/reuseProgramStructure.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ namespace ts {
111111
getDefaultLibFileName(): string {
112112
return "lib.d.ts";
113113
},
114-
writeFile: notYetImplemented,
114+
writeFile: notImplemented,
115115
getCurrentDirectory(): string {
116116
return "";
117117
},

src/harness/unittests/tsserverProjectSystem.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -521,8 +521,8 @@ namespace ts.projectSystem {
521521
readonly resolvePath = (s: string) => s;
522522
readonly getExecutingFilePath = () => this.executingFilePath;
523523
readonly getCurrentDirectory = () => this.currentDirectory;
524-
readonly exit = notYetImplemented;
525-
readonly getEnvironmentVariable = notYetImplemented;
524+
readonly exit = notImplemented;
525+
readonly getEnvironmentVariable = notImplemented;
526526
}
527527

528528
export function makeSessionRequest<T>(command: string, args: T) {

src/server/client.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ namespace ts.server {
242242
}
243243

244244
getCompletionEntrySymbol(_fileName: string, _position: number, _entryName: string): Symbol {
245-
return notYetImplemented();
245+
return notImplemented();
246246
}
247247

248248
getNavigateToItems(searchValue: string): NavigateToItem[] {
@@ -415,7 +415,7 @@ namespace ts.server {
415415
}
416416

417417
getEmitOutput(_fileName: string): EmitOutput {
418-
return notYetImplemented();
418+
return notImplemented();
419419
}
420420

421421
getSyntacticDiagnostics(fileName: string): Diagnostic[] {
@@ -457,7 +457,7 @@ namespace ts.server {
457457
}
458458

459459
getCompilerOptionsDiagnostics(): Diagnostic[] {
460-
return notYetImplemented();
460+
return notImplemented();
461461
}
462462

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

564564
getNameOrDottedNameSpan(_fileName: string, _startPos: number, _endPos: number): TextSpan {
565-
return notYetImplemented();
565+
return notImplemented();
566566
}
567567

568568
getBreakpointStatementAtPosition(_fileName: string, _position: number): TextSpan {
569-
return notYetImplemented();
569+
return notImplemented();
570570
}
571571

572572
getSignatureHelpItems(fileName: string, position: number): SignatureHelpItems {
@@ -656,19 +656,19 @@ namespace ts.server {
656656
}
657657

658658
getOutliningSpans(_fileName: string): OutliningSpan[] {
659-
return notYetImplemented();
659+
return notImplemented();
660660
}
661661

662662
getTodoComments(_fileName: string, _descriptors: TodoCommentDescriptor[]): TodoComment[] {
663-
return notYetImplemented();
663+
return notImplemented();
664664
}
665665

666666
getDocCommentTemplateAtPosition(_fileName: string, _position: number): TextInsertion {
667-
return notYetImplemented();
667+
return notImplemented();
668668
}
669669

670670
isValidBraceCompletionAtPosition(_fileName: string, _position: number, _openingBrace: number): boolean {
671-
return notYetImplemented();
671+
return notImplemented();
672672
}
673673

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

737737
getIndentationAtPosition(_fileName: string, _position: number, _options: EditorOptions): number {
738-
return notYetImplemented();
738+
return notImplemented();
739739
}
740740

741741
getSyntacticClassifications(_fileName: string, _span: TextSpan): ClassifiedSpan[] {
742-
return notYetImplemented();
742+
return notImplemented();
743743
}
744744

745745
getSemanticClassifications(_fileName: string, _span: TextSpan): ClassifiedSpan[] {
746-
return notYetImplemented();
746+
return notImplemented();
747747
}
748748

749749
getEncodedSyntacticClassifications(_fileName: string, _span: TextSpan): Classifications {
750-
return notYetImplemented();
750+
return notImplemented();
751751
}
752752

753753
getEncodedSemanticClassifications(_fileName: string, _span: TextSpan): Classifications {
754-
return notYetImplemented();
754+
return notImplemented();
755755
}
756756

757757
getProgram(): Program {

0 commit comments

Comments
 (0)