Closed Bug 1605964 Opened 6 years ago Closed 6 years ago

Wrong realization of eval()

Categories

(Core :: JavaScript Engine, defect)

72 Branch
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1317378

People

(Reporter: sunlili, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:71.0) Gecko/20100101 Firefox/71.0

Steps to reproduce:

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

Thank you for your bug report. This is basically a duplicate of bug 1317378.

Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.