Bug 205577 - Wrong realization of eval()
Summary: Wrong realization of eval()
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-12-24 00:18 PST by sunlili
Modified: 2019-12-25 11:01 PST (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description sunlili 2019-12-24 00:18:45 PST
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
Comment 1 Radar WebKit Bug Importer 2019-12-25 10:39:06 PST
<rdar://problem/58194612>
Comment 2 Keith Miller 2019-12-25 11:01:05 PST
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.