Skip to content

Simplify code in 'rename'#13660

Merged
2 commits merged into
masterfrom
rename
Jan 24, 2017
Merged

Simplify code in 'rename'#13660
2 commits merged into
masterfrom
rename

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost commented Jan 24, 2017

Turns out I don't need to touch this file to fix any issues (so far), but thought I would clean up this code while I was looking at it.
EDIT: Actually, #13663 popped up just after I pushed this!

Comment thread src/services/rename.ts
/* @internal */
namespace ts.Rename {
export function getRenameInfo(typeChecker: TypeChecker, defaultLibFileName: string, getCanonicalFileName: (fileName: string) => string, sourceFile: SourceFile, position: number): RenameInfo {
const canonicalDefaultLibName = getCanonicalFileName(ts.normalizePath(defaultLibFileName));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about:

const getCanonicalDefaultLibName = memoize(()=>getCanonicalFileName(ts.normalizePath(defaultLibFileName)));

and keep isDefinedInLibraryFile the way it was.

@ghost ghost merged commit 8144c89 into master Jan 24, 2017
@ghost ghost deleted the rename branch January 24, 2017 23:18
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants