Bug 188930

Summary: JSC should evaluate scoped function block after an eval statement
Product: WebKit Reporter: Sotero Jr <srsj2>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: fpizlo, ysuzuki
Priority: P2    
Version: Safari 11   
Hardware: Unspecified   
OS: iOS 10.3   

Description Sotero Jr 2018-08-24 13:47:39 PDT
Hi everyone,

I found out an inconsistency if we try to evaluate a scoped function block after an eval statement. If I remove the first line (eval line), JSC works as expected.

Version: 235318
O.S: MacOS High Sierra Version 10.13.6

step to reproduce:
eval("if (false) function _f() {} else function f() { return 1; }");
{
   function f() {
      return 2;
   }
}

print(f())

atual result: 
1

expected result:
2

V8, Chakra and SpiderMonkey works as expected 

cinfuzz