Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add code fix to remove unused label#24037

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
3 commits merged intomasterfromfixUnusedLabel
May 18, 2018
Merged

Add code fix to remove unused label#24037

3 commits merged intomasterfromfixUnusedLabel
May 18, 2018

Conversation

@ghost
Copy link

Similar to#24028

@ghost ghost requested a review fromamcaseyMay 10, 2018 21:31
function doChange(changes: textChanges.ChangeTracker, sourceFile: SourceFile, start: number): void {
const token = getTokenAtPosition(sourceFile, start, /*includeJsDocComment*/ false);
const statement = cast(token.parent, isLabeledStatement).statement;
changes.deleteRange(sourceFile, { pos: token.getStart(sourceFile), end: statement.getStart(sourceFile) });
Copy link
Contributor

Choose a reason for hiding this comment

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

this will remove comments on the statement before the label.. if you are deleting a range, why not just delete from token.pos to:.end?

Copy link
Author

Choose a reason for hiding this comment

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

I wanted to remove the space between the: and the statement following it.token.getStart should not include any comments precedingtoken. (Buttoken.pos would.)

Copy link
Member

Choose a reason for hiding this comment

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

/*not deleted*/ label /*deleted*/ : /*deleted*/ call();?

Copy link
Member

@amcaseyamcasey left a comment

Choose a reason for hiding this comment

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

I have concerns about the trivia, but I understand you're tracking that as its own (increasingly expensive) work item. Otherwise, LGTM.

function doChange(changes: textChanges.ChangeTracker, sourceFile: SourceFile, start: number): void {
const token = getTokenAtPosition(sourceFile, start, /*includeJsDocComment*/ false);
const statement = cast(token.parent, isLabeledStatement).statement;
changes.deleteRange(sourceFile, { pos: token.getStart(sourceFile), end: statement.getStart(sourceFile) });
Copy link
Member

Choose a reason for hiding this comment

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

/*not deleted*/ label /*deleted*/ : /*deleted*/ call();?


// @noUnusedLocals: true

////label1: while (1) {}
Copy link
Member

Choose a reason for hiding this comment

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

What happens for outdented labels on preceding lines?

label:    code

Does formatting restore the indentation? Otherwise, it seems like you'd end up withcode outdented.

Copy link
Author

Choose a reason for hiding this comment

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

Fixed.

@ghost ghostforce-pushed thefixUnusedLabel branch from3a501cc to3e1f013CompareMay 18, 2018 21:43
@ghost ghostforce-pushed thefixUnusedLabel branch from3e1f013 to76f56a5CompareMay 18, 2018 22:05
@ghost ghost merged commit3eb66da intomasterMay 18, 2018
@ghost ghost deleted the fixUnusedLabel branchMay 18, 2018 22:25
@microsoftmicrosoft locked and limited conversation to collaboratorsJul 31, 2018
This pull request wasclosed.
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@mhegazy@amcasey

[8]ページ先頭

©2009-2025 Movatter.jp