<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>167328</bug_id>
          
          <creation_ts>2017-01-23 15:10:12 -0800</creation_ts>
          <short_desc>strict mode eval doesn&apos;t initialize functions with the proper scope</short_desc>
          <delta_ts>2017-01-25 12:16:45 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>JavaScriptCore</component>
          <version>WebKit Local Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>REOPENED</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Saam Barati">saam</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>benjamin</cc>
    
    <cc>fpizlo</cc>
    
    <cc>ggaren</cc>
    
    <cc>gskachkov</cc>
    
    <cc>jfbastien</cc>
    
    <cc>keith_miller</cc>
    
    <cc>manian</cc>
    
    <cc>mark.lam</cc>
    
    <cc>msaboff</cc>
    
    <cc>oliver</cc>
    
    <cc>ticaiolima</cc>
    
    <cc>WebkitBugTracker</cc>
    
    <cc>ysuzuki</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1269208</commentid>
    <comment_count>0</comment_count>
    <who name="Saam Barati">saam</who>
    <bug_when>2017-01-23 15:10:12 -0800</bug_when>
    <thetext>They don&apos;t have access to the eval&apos;s lexical variables at the top level. For example, this doesn&apos;t work:
eval(&quot;&apos;use strict&apos;; let x = 20; function foo() { return x; }; foo();&quot;)

But these do:
eval(&quot;&apos;use strict&apos;; let x = 20; let foo = function() { return x; }; foo();&quot;)
eval(&quot;&apos;use strict&apos;; let x = 20; let y; { function foo() { return x; }; y =foo;} y();&quot;)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1269219</commentid>
    <comment_count>1</comment_count>
    <who name="Saam Barati">saam</who>
    <bug_when>2017-01-23 15:18:57 -0800</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 163208 ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1269892</commentid>
    <comment_count>2</comment_count>
    <who name="Saam Barati">saam</who>
    <bug_when>2017-01-25 11:20:03 -0800</bug_when>
    <thetext>This isn&apos;t a duplicate.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1269904</commentid>
    <comment_count>3</comment_count>
    <who name="Saam Barati">saam</who>
    <bug_when>2017-01-25 12:06:58 -0800</bug_when>
    <thetext>I think we should simplify how we do variables in strict mode eval.

Currently, we rely on Interpreter::execute(Eval) to create a StrictEvalActivation that contains the &quot;function&quot; and &quot;var&quot; variables in it. However, I think this is probably unnecessary. I think we can do all of this in bytecode and just create a normal JSLexicalEnvironment for the &quot;var&quot; variables and &quot;function&quot; variables inside the bytecode generator (as long as we&apos;re in strict mode). If we&apos;re in sloppy mode, we should continue to do what we do now.

Anybody have thoughts on this? Am I missing something that would make this not Just Work?</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>