Skip to content

Wrong completion value when switch is part of a statement list #6368

Open
@sunlili

Description

@sunlili

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions