chakra-core / chakra-core/ChakraCore

Wrong completion value when switch is part of a statement list

Open
#6,368 1 comment 1 reaction 0 assignees View on GitHub
Bug ES Spec Conformance
Dominant language
JavaScript
Stars
9.3k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

The bug can be reproduced in ch version 1.11.15.0.
Running following code:
```
let temp = eval('42;switch (0) { case 0: break; };');
console.log(temp);
```
Actual results:

`42`

Expected results:

`undefined`

According to ecma manual,https://tc39.es/ecma262/#sec-block-runtime-semantics-evaluation, the value of a StatementList is the value of the last value producing item in the StatementList. Switch statement produce value undefined (https://tc39.es/ecma262/#sec-runtime-semantics-caseblockevaluation), so the result should be undefined.

ISec Lab
2019.12.26

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.