Forbid unused locals/parameters in compiler#11715
Merged
Conversation
mhegazy
approved these changes
Oct 18, 2016
Contributor
mhegazy
left a comment
There was a problem hiding this comment.
👍
can you also build LKG and make sure non of these changes change typesript.d.ts, we do not want to break API users
| } | ||
|
|
||
| function emitTripleSlashLeadingComment(commentPos: number, commentEnd: number, kind: SyntaxKind, hasTrailingNewLine: boolean, rangePos: number) { | ||
| function emitTripleSlashLeadingComment(commentPos: number, commentEnd: number, _kind: SyntaxKind, hasTrailingNewLine: boolean, rangePos: number) { |
Contributor
There was a problem hiding this comment.
why _kind? seems it is used two lines below.
| } | ||
| else { | ||
| return t => u => u; | ||
| return _t => u => u; |
|
|
||
| const id = (s: SourceFile) => s; | ||
| const nullTransformers: Transformer[] = [ctx => id]; | ||
| const nullTransformers: Transformer[] = [_ctx => id]; |
| /* @internal */ | ||
| export function trace(host: ModuleResolutionHost, message: DiagnosticMessage, ...args: any[]): void; | ||
| export function trace(host: ModuleResolutionHost, message: DiagnosticMessage): void { | ||
| export function trace(host: ModuleResolutionHost, _message: DiagnosticMessage): void { |
Contributor
There was a problem hiding this comment.
consider removing _message all together from the implementation signature, export function trace(host: ModuleResolutionHost): void { .. }
| @@ -575,7 +575,7 @@ namespace ts { | |||
| export function parseSourceFile(fileName: string, _sourceText: string, languageVersion: ScriptTarget, _syntaxCursor: IncrementalParser.SyntaxCursor, setParentNodes?: boolean, scriptKind?: ScriptKind): SourceFile { | |||
Contributor
There was a problem hiding this comment.
why do these start with _?
| getCurrentDirectory: () => ChakraHost.currentDirectory, | ||
| getDirectories: ChakraHost.getDirectories, | ||
| getEnvironmentVariable: ChakraHost.getEnvironmentVariable || ((name: string) => ""), | ||
| getEnvironmentVariable: ChakraHost.getEnvironmentVariable || ((_name: string) => ""), |
Contributor
There was a problem hiding this comment.
do not think you need ht type annotation here.
Author
|
|
This pull request was closed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Mostly I just removed any parameter that wasn't used, and then removed it from callers. If a function is used as a callback, and other callbacks use that parameter, I use an
_underscoredparameter name.TODO: The same thing for harness/server/services, and probably use tsconfig inheritance.