chakra-core / chakra-core/ChakraCore

Switch statement without reached the case block

Open
#5,630 3 comments 0 reactions 0 assignees View on GitHub
Bug Severity: 2
Dominant language
JavaScript
Stars
9.3k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

Hi everyone,
there is an inconsistency in Chakra if a switch statement with only one case block evaluation that could be not reached.

version: 1.10.2
OS: Ubuntu 16.04 x64

steps to reproduce:
```js
{ function f() { return "f 0"; } }
switch (1)
{
case /0.0/gi:
function f() {
return "f 1";
}
break;
}
print( f() );
```
Actual results:
f 1

Expected results:
f 0

if we try to add the default block (`default: ` or `default: break;`), the same occurs as above.

V8 and SpiderMonkey works as expected.

cinfuzz

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.