Skip to content

Duplicate switch case - #257

Merged
stasm merged 1 commit into
projectfluent:masterfrom
matbrgz:master
Apr 19, 2019
Merged

stasm merged 1 commit into
projectfluent:masterfrom
matbrgz:master

Conversation

@matbrgz

@matbrgz matbrgz commented Apr 18, 2019

Copy link
Copy Markdown

If two cases in a switch statement have the same label, the second case will never be executed.

In JavaScript, cases in a switch statement can have arbitrary expressions as their labels. The interpreter does not check that these expressions are all different. At runtime, if two cases in a switch statement have the same label, the second case will never be executed. This most likely indicates a copy-paste error where the first case was copied and then not properly adjusted.

If two cases in a switch statement have the same label, the second case will never be executed.
@stasm

stasm commented Apr 19, 2019

Copy link
Copy Markdown
Contributor

Thanks for the PR! This must have been a copy&paste error. Well spotted!

@stasm
stasm merged commit 2bc4b44 into projectfluent:master Apr 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants