Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unusual fallthrough in unusedIdentifierFixes.ts #14885

Closed
ghost opened this issue Mar 27, 2017 · 1 comment
Closed

Unusual fallthrough in unusedIdentifierFixes.ts #14885

ghost opened this issue Mar 27, 2017 · 1 comment
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@ghost
Copy link

ghost commented Mar 27, 2017

In unusedIdentifierFixes.ts, there is:

switch (token.parent.kind) {
    case ts.SyntaxKind.VariableDeclaration:
        switch (token.parent.parent.parent.kind) {
            ...

            case SyntaxKind.ForOfStatement:
                const forOfStatement = <ForOfStatement>token.parent.parent.parent;
                if (forOfStatement.initializer.kind === SyntaxKind.VariableDeclarationList) {
                    const forOfInitializer = <VariableDeclarationList>forOfStatement.initializer;
                    return replaceNode(forOfInitializer.declarations[0], createObjectLiteral());
                }
                break;

            ...
        }

        ...
}

The break; will break out of the inner switch, not the outer switch, so there is fallthrough. Can the inner switch be its own function with no fallthrough? CC @paulvanbrenk

@mhegazy
Copy link
Contributor

mhegazy commented Apr 27, 2017

I think so.

@mhegazy mhegazy added the Bug A bug in TypeScript label Apr 27, 2017
@mhegazy mhegazy assigned ghost Apr 27, 2017
@mhegazy mhegazy added this to the TypeScript 2.4 milestone Apr 27, 2017
@ghost ghost closed this as completed in #15496 May 1, 2017
@mhegazy mhegazy added the Fixed A PR has been merged for this issue label May 1, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 21, 2018
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

1 participant