Skip to content

Switch statement without reached the case block #5630

Description

@igor-simoes

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:

{ 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions