Bug 205577
Summary: | Wrong realization of eval() | ||
---|---|---|---|
Product: | WebKit | Reporter: | sunlili |
Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED INVALID | ||
Severity: | Normal | CC: | fpizlo, keith_miller, mark.lam, webkit-bug-importer, ysuzuki |
Priority: | P2 | Keywords: | InRadar |
Version: | WebKit Local Build | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
sunlili
What steps will reproduce the problem?
1.Running following code:
let temp = eval('42;switch (0) { case 0: break; };');
console.log(temp);
What is the expected output?
42
What do you see instead?
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. However, switch statement not produce value, so the result should be 42.
ISec Lab
2019.12.24
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/58194612>
Keith Miller
I believe this behaves correctly, https://tc39.es/ecma262/#sec-runtime-semantics-caseblockevaluation, produces a normal completion of undefined if the StatementList if the case label has no production.