<?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>14090</bug_id>
          
          <creation_ts>2007-06-12 09:18:04 -0700</creation_ts>
          <short_desc>Redeclaring function throws syntax error</short_desc>
          <delta_ts>2008-11-24 16:16:08 -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>523.x (Safari 3)</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>OS X 10.4</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>13790</dup_id>
          
          <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="Brad Fults">bfults</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>mrowe</cc>
    
    <cc>zwarich</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>7833</commentid>
    <comment_count>0</comment_count>
    <who name="Brad Fults">bfults</who>
    <bug_when>2007-06-12 09:18:04 -0700</bug_when>
    <thetext>Using http://mochikit.com/examples/interpreter/ as a simple CLI.

In r22084 nightly:

&gt;&gt;&gt; for (var i=10;i&gt;=0;i--) function x(k) { return ++k; };
Error:
line	1
message	Parse error
name	SyntaxError

In Firefox 2.0.0.4:

&gt;&gt;&gt; for (var i=10;i&gt;=0;i--) function x(k) { return ++k; };

[no error]

In Opera 9.21:

&gt;&gt;&gt; for (var i=10;i&gt;=0;i--) function x(k) { return ++k; };

[no error]

Similar results can be found in IE.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>7633</commentid>
    <comment_count>1</comment_count>
    <who name="Mark Rowe (bdash)">mrowe</who>
    <bug_when>2007-06-13 16:21:30 -0700</bug_when>
    <thetext>This appears to be due to the lack of {}&apos;s inside the for statement.  The following example throws a syntax error:

for (var i = 10; i &gt;= 0; i--)
    function x(k)
    {
        return ++k;
    };


The following example does not:

for (var i = 10; i &gt;= 0; i--)
{
    function x(k)
    {
        return ++k;
    };
}

</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>82773</commentid>
    <comment_count>2</comment_count>
    <who name="Cameron Zwarich (cpst)">zwarich</who>
    <bug_when>2008-06-09 16:39:22 -0700</bug_when>
    <thetext>This is invalid syntax, according to the grammar in the ECMA spec. The body of a for loop is a Statement, and a FunctionDeclaration is not a Statement. Unless this is actually a compatibility issue, we should probably close this bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>82774</commentid>
    <comment_count>3</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2008-06-09 16:57:54 -0700</bug_when>
    <thetext>Per the bug description, this sounds like a compatibility issue.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100095</commentid>
    <comment_count>4</comment_count>
    <who name="Cameron Zwarich (cpst)">zwarich</who>
    <bug_when>2008-11-24 16:16:08 -0800</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of 13790 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>