<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[196545] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/196545">196545</a></dd>
<dt>Author</dt> <dd>sbarati@apple.com</dd>
<dt>Date</dt> <dd>2016-02-12 20:52:01 -0800 (Fri, 12 Feb 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>[ES6] we have an incorrect syntax error when a callee of a function expression has the same name as a top-level lexical declaration
https://bugs.webkit.org/show_bug.cgi?id=154143

Reviewed by Benjamin Poulain.

Source/JavaScriptCore:

We were raising syntax errors on the following type of programs when
we shouldn't have been.
```
(function foo() { const foo = 20; });
```

* parser/Parser.cpp:
(JSC::Parser&lt;LexerType&gt;::parseFunctionInfo):
* parser/Parser.h:
(JSC::Scope::computeLexicallyCapturedVariablesAndPurgeCandidates):
(JSC::Scope::declareCallee):
(JSC::Scope::declareVariable):
(JSC::Scope::hasDeclaredVariable):
(JSC::Scope::hasLexicallyDeclaredVariable):
(JSC::Scope::hasDeclaredParameter):
(JSC::Scope::declareWrite):
(JSC::Scope::getCapturedVars):

LayoutTests:

* js/basic-strict-mode-expected.txt:
* js/let-syntax-expected.txt:
* js/script-tests/let-syntax.js:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsjsbasicstrictmodeexpectedtxt">trunk/LayoutTests/js/basic-strict-mode-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsletsyntaxexpectedtxt">trunk/LayoutTests/js/let-syntax-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsscripttestsletsyntaxjs">trunk/LayoutTests/js/script-tests/let-syntax.js</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreparserParsercpp">trunk/Source/JavaScriptCore/parser/Parser.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreparserParserh">trunk/Source/JavaScriptCore/parser/Parser.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (196544 => 196545)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-02-13 04:48:40 UTC (rev 196544)
+++ trunk/LayoutTests/ChangeLog        2016-02-13 04:52:01 UTC (rev 196545)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2016-02-12  Saam barati  &lt;sbarati@apple.com&gt;
+
+        [ES6] we have an incorrect syntax error when a callee of a function expression has the same name as a top-level lexical declaration
+        https://bugs.webkit.org/show_bug.cgi?id=154143
+
+        Reviewed by Benjamin Poulain.
+
+        * js/basic-strict-mode-expected.txt:
+        * js/let-syntax-expected.txt:
+        * js/script-tests/let-syntax.js:
+
</ins><span class="cx"> 2016-02-12  Jiewen Tan  &lt;jiewen_tan@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, build fix after r196520
</span></span></pre></div>
<a id="trunkLayoutTestsjsbasicstrictmodeexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/basic-strict-mode-expected.txt (196544 => 196545)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/basic-strict-mode-expected.txt        2016-02-13 04:48:40 UTC (rev 196544)
+++ trunk/LayoutTests/js/basic-strict-mode-expected.txt        2016-02-13 04:52:01 UTC (rev 196545)
</span><span class="lines">@@ -30,14 +30,14 @@
</span><span class="cx"> PASS testThis.apply() is undefined
</span><span class="cx"> PASS testThis.call(undefined) is undefined
</span><span class="cx"> PASS testThis.apply(undefined) is undefined
</span><del>-PASS (function eval(){'use strict';}) threw exception SyntaxError: Cannot declare a variable named 'eval' in strict mode..
-PASS (function(){(function eval(){'use strict';})}) threw exception SyntaxError: Cannot declare a variable named 'eval' in strict mode..
-PASS (function (eval){'use strict';}) threw exception SyntaxError: Cannot declare a variable named 'eval' in strict mode..
-PASS (function(){(function (eval){'use strict';})}) threw exception SyntaxError: Cannot declare a variable named 'eval' in strict mode..
-PASS (function arguments(){'use strict';}) threw exception SyntaxError: Cannot declare a variable named 'arguments' in strict mode..
-PASS (function(){(function arguments(){'use strict';})}) threw exception SyntaxError: Cannot declare a variable named 'arguments' in strict mode..
-PASS (function (arguments){'use strict';}) threw exception SyntaxError: Cannot declare a variable named 'arguments' in strict mode..
-PASS (function(){(function (arguments){'use strict';})}) threw exception SyntaxError: Cannot declare a variable named 'arguments' in strict mode..
</del><ins>+PASS (function eval(){'use strict';}) threw exception SyntaxError: 'eval' is not a valid function name in strict mode..
+PASS (function(){(function eval(){'use strict';})}) threw exception SyntaxError: 'eval' is not a valid function name in strict mode..
+PASS (function (eval){'use strict';}) threw exception SyntaxError: Invalid parameters or function name in strict mode..
+PASS (function(){(function (eval){'use strict';})}) threw exception SyntaxError: Invalid parameters or function name in strict mode..
+PASS (function arguments(){'use strict';}) threw exception SyntaxError: 'arguments' is not a valid function name in strict mode..
+PASS (function(){(function arguments(){'use strict';})}) threw exception SyntaxError: 'arguments' is not a valid function name in strict mode..
+PASS (function (arguments){'use strict';}) threw exception SyntaxError: Invalid parameters or function name in strict mode..
+PASS (function(){(function (arguments){'use strict';})}) threw exception SyntaxError: Invalid parameters or function name in strict mode..
</ins><span class="cx"> PASS (function (){'use strict'; var eval;}) threw exception SyntaxError: Cannot declare a variable named eval in strict mode..
</span><span class="cx"> PASS (function(){(function (){'use strict'; var eval;})}) threw exception SyntaxError: Cannot declare a variable named eval in strict mode..
</span><span class="cx"> PASS (function (){'use strict'; var arguments;}) threw exception SyntaxError: Cannot declare a variable named arguments in strict mode..
</span></span></pre></div>
<a id="trunkLayoutTestsjsletsyntaxexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/let-syntax-expected.txt (196544 => 196545)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/let-syntax-expected.txt        2016-02-13 04:48:40 UTC (rev 196544)
+++ trunk/LayoutTests/js/let-syntax-expected.txt        2016-02-13 04:52:01 UTC (rev 196545)
</span><span class="lines">@@ -33,6 +33,42 @@
</span><span class="cx"> PASS Does not have syntax error: ''use strict'; ;({ get let() { return 50; }, set let(x) { return 50;} });'
</span><span class="cx"> PASS Does not have syntax error: 'function foo() { { let x; } var x; }'
</span><span class="cx"> PASS Does not have syntax error: ''use strict'; function foo() { { let x; } var x; }'
</span><ins>+PASS Does not have syntax error: 'var x = (function foo() { const foo = 20; });'
+PASS Does not have syntax error: ''use strict'; var x = (function foo() { const foo = 20; });'
+PASS Does not have syntax error: 'var x = (function foo() { let foo = 20; });'
+PASS Does not have syntax error: ''use strict'; var x = (function foo() { let foo = 20; });'
+PASS Does not have syntax error: 'var x = (function foo() { class foo { } });'
+PASS Does not have syntax error: ''use strict'; var x = (function foo() { class foo { } });'
+PASS Does not have syntax error: ';(function foo() { const foo = 20; });'
+PASS Does not have syntax error: ''use strict'; ;(function foo() { const foo = 20; });'
+PASS Does not have syntax error: ';(function foo() { let foo = 20; });'
+PASS Does not have syntax error: ''use strict'; ;(function foo() { let foo = 20; });'
+PASS Does not have syntax error: ';(function foo() { class foo { } });'
+PASS Does not have syntax error: ''use strict'; ;(function foo() { class foo { } });'
+PASS Does not have syntax error: 'let x = {f: function foo() { const foo = 20; } };'
+PASS Does not have syntax error: ''use strict'; let x = {f: function foo() { const foo = 20; } };'
+PASS Does not have syntax error: 'let x = {f: function foo() { let foo = 20; } };'
+PASS Does not have syntax error: ''use strict'; let x = {f: function foo() { let foo = 20; } };'
+PASS Does not have syntax error: 'let x = {f: function foo() { class foo { } } };'
+PASS Does not have syntax error: ''use strict'; let x = {f: function foo() { class foo { } } };'
+PASS Does not have syntax error: 'let x = { foo() { const foo = 20; } };'
+PASS Does not have syntax error: ''use strict'; let x = { foo() { const foo = 20; } };'
+PASS Does not have syntax error: 'let x = { foo() { let foo = 20; } };'
+PASS Does not have syntax error: ''use strict'; let x = { foo() { let foo = 20; } };'
+PASS Does not have syntax error: 'let x = { foo() { class foo { } } };'
+PASS Does not have syntax error: ''use strict'; let x = { foo() { class foo { } } };'
+PASS Does not have syntax error: 'let x = { set foo(x) { const foo = 20; } };'
+PASS Does not have syntax error: ''use strict'; let x = { set foo(x) { const foo = 20; } };'
+PASS Does not have syntax error: 'let x = { set foo(x) { let foo = 20; } };'
+PASS Does not have syntax error: ''use strict'; let x = { set foo(x) { let foo = 20; } };'
+PASS Does not have syntax error: 'let x = { set foo(x) { class foo { } } };'
+PASS Does not have syntax error: ''use strict'; let x = { set foo(x) { class foo { } } };'
+PASS Does not have syntax error: 'let x = { get foo() { const foo = 20; } };'
+PASS Does not have syntax error: ''use strict'; let x = { get foo() { const foo = 20; } };'
+PASS Does not have syntax error: 'let x = { get foo() { let foo = 20; } };'
+PASS Does not have syntax error: ''use strict'; let x = { get foo() { let foo = 20; } };'
+PASS Does not have syntax error: 'let x = { get foo() { class foo { } } };'
+PASS Does not have syntax error: ''use strict'; let x = { get foo() { class foo { } } };'
</ins><span class="cx"> SyntaxError: Unexpected keyword 'let'. Can't use 'let' as an identifier name for a LexicalDeclaration.
</span><span class="cx"> SyntaxError: Unexpected keyword 'let'. Can't use 'let' as an identifier name for a LexicalDeclaration.
</span><span class="cx"> PASS Has syntax error: 'let let;'
</span></span></pre></div>
<a id="trunkLayoutTestsjsscripttestsletsyntaxjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/script-tests/let-syntax.js (196544 => 196545)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/script-tests/let-syntax.js        2016-02-13 04:48:40 UTC (rev 196544)
+++ trunk/LayoutTests/js/script-tests/let-syntax.js        2016-02-13 04:52:01 UTC (rev 196545)
</span><span class="lines">@@ -68,6 +68,24 @@
</span><span class="cx"> shouldNotHaveSyntaxError(&quot;function foo() { var bar; if (truth()) { let bar; } }&quot;);
</span><span class="cx"> shouldNotHaveSyntaxError(&quot;;({ get let() { return 50; }, set let(x) { return 50;} });&quot;);
</span><span class="cx"> shouldNotHaveSyntaxError(&quot;function foo() { { let x; } var x; }&quot;);
</span><ins>+shouldNotHaveSyntaxError(&quot;var x = (function foo() { const foo = 20; });&quot;);
+shouldNotHaveSyntaxError(&quot;var x = (function foo() { let foo = 20; });&quot;);
+shouldNotHaveSyntaxError(&quot;var x = (function foo() { class foo { } });&quot;);
+shouldNotHaveSyntaxError(&quot;;(function foo() { const foo = 20; });&quot;);
+shouldNotHaveSyntaxError(&quot;;(function foo() { let foo = 20; });&quot;);
+shouldNotHaveSyntaxError(&quot;;(function foo() { class foo { } });&quot;);
+shouldNotHaveSyntaxError(&quot;let x = {f: function foo() { const foo = 20; } };&quot;);
+shouldNotHaveSyntaxError(&quot;let x = {f: function foo() { let foo = 20; } };&quot;);
+shouldNotHaveSyntaxError(&quot;let x = {f: function foo() { class foo { } } };&quot;);
+shouldNotHaveSyntaxError(&quot;let x = { foo() { const foo = 20; } };&quot;);
+shouldNotHaveSyntaxError(&quot;let x = { foo() { let foo = 20; } };&quot;);
+shouldNotHaveSyntaxError(&quot;let x = { foo() { class foo { } } };&quot;);
+shouldNotHaveSyntaxError(&quot;let x = { set foo(x) { const foo = 20; } };&quot;);
+shouldNotHaveSyntaxError(&quot;let x = { set foo(x) { let foo = 20; } };&quot;);
+shouldNotHaveSyntaxError(&quot;let x = { set foo(x) { class foo { } } };&quot;);
+shouldNotHaveSyntaxError(&quot;let x = { get foo() { const foo = 20; } };&quot;);
+shouldNotHaveSyntaxError(&quot;let x = { get foo() { let foo = 20; } };&quot;);
+shouldNotHaveSyntaxError(&quot;let x = { get foo() { class foo { } } };&quot;);
</ins><span class="cx"> 
</span><span class="cx"> shouldHaveSyntaxError(&quot;let let;&quot;);
</span><span class="cx"> shouldHaveSyntaxError(&quot;const let;&quot;);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (196544 => 196545)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-02-13 04:48:40 UTC (rev 196544)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-02-13 04:52:01 UTC (rev 196545)
</span><span class="lines">@@ -1,3 +1,28 @@
</span><ins>+2016-02-12  Saam barati  &lt;sbarati@apple.com&gt;
+
+        [ES6] we have an incorrect syntax error when a callee of a function expression has the same name as a top-level lexical declaration
+        https://bugs.webkit.org/show_bug.cgi?id=154143
+
+        Reviewed by Benjamin Poulain.
+
+        We were raising syntax errors on the following type of programs when
+        we shouldn't have been.
+        ```
+        (function foo() { const foo = 20; });
+        ```
+
+        * parser/Parser.cpp:
+        (JSC::Parser&lt;LexerType&gt;::parseFunctionInfo):
+        * parser/Parser.h:
+        (JSC::Scope::computeLexicallyCapturedVariablesAndPurgeCandidates):
+        (JSC::Scope::declareCallee):
+        (JSC::Scope::declareVariable):
+        (JSC::Scope::hasDeclaredVariable):
+        (JSC::Scope::hasLexicallyDeclaredVariable):
+        (JSC::Scope::hasDeclaredParameter):
+        (JSC::Scope::declareWrite):
+        (JSC::Scope::getCapturedVars):
+
</ins><span class="cx"> 2016-02-12  Benjamin Poulain  &lt;bpoulain@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [JSC] ZeroExtend and SignExtend use incorrect addressing on ARM64
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreparserParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/parser/Parser.cpp (196544 => 196545)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/parser/Parser.cpp        2016-02-13 04:48:40 UTC (rev 196544)
+++ trunk/Source/JavaScriptCore/parser/Parser.cpp        2016-02-13 04:52:01 UTC (rev 196545)
</span><span class="lines">@@ -1932,7 +1932,7 @@
</span><span class="cx">             m_parserState.lastFunctionName = functionInfo.name;
</span><span class="cx">             next();
</span><span class="cx">             if (!nameIsInContainingScope)
</span><del>-                failIfTrueIfStrict(functionScope-&gt;declareVariable(functionInfo.name) &amp; DeclarationResult::InvalidStrictMode, &quot;'&quot;, functionInfo.name-&gt;impl(), &quot;' is not a valid &quot;, stringForFunctionMode(mode), &quot; name in strict mode&quot;);
</del><ins>+                failIfTrueIfStrict(functionScope-&gt;declareCallee(functionInfo.name) &amp; DeclarationResult::InvalidStrictMode, &quot;'&quot;, functionInfo.name-&gt;impl(), &quot;' is not a valid &quot;, stringForFunctionMode(mode), &quot; name in strict mode&quot;);
</ins><span class="cx">         } else if (requirements == FunctionNeedsName) {
</span><span class="cx">             if (match(OPENPAREN) &amp;&amp; mode == SourceParseMode::NormalFunctionMode)
</span><span class="cx">                 semanticFail(&quot;Function statements must have a name&quot;);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreparserParserh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/parser/Parser.h (196544 => 196545)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/parser/Parser.h        2016-02-13 04:48:40 UTC (rev 196544)
+++ trunk/Source/JavaScriptCore/parser/Parser.h        2016-02-13 04:52:01 UTC (rev 196545)
</span><span class="lines">@@ -333,12 +333,17 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    void declareCallee(const Identifier* ident)
</del><ins>+    DeclarationResultMask declareCallee(const Identifier* ident)
</ins><span class="cx">     {
</span><span class="cx">         auto addResult = m_declaredVariables.add(ident-&gt;impl());
</span><span class="cx">         // We want to track if callee is captured, but we don't want to act like it's a 'var'
</span><span class="cx">         // because that would cause the BytecodeGenerator to emit bad code.
</span><span class="cx">         addResult.iterator-&gt;value.clearIsVar();
</span><ins>+
+        DeclarationResultMask result = DeclarationResult::Valid;
+        if (isEvalOrArgumentsIdentifier(m_vm, ident))
+            result |= DeclarationResult::InvalidStrictMode;
+        return result;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     DeclarationResultMask declareVariable(const Identifier* ident)
</span><span class="lines">@@ -390,7 +395,11 @@
</span><span class="cx"> 
</span><span class="cx">     bool hasDeclaredVariable(const RefPtr&lt;UniquedStringImpl&gt;&amp; ident)
</span><span class="cx">     {
</span><del>-        return m_declaredVariables.contains(ident.get());
</del><ins>+        auto iter = m_declaredVariables.find(ident.get());
+        if (iter == m_declaredVariables.end())
+            return false;
+        VariableEnvironmentEntry entry = iter-&gt;value;
+        return entry.isVar(); // The callee isn't a &quot;var&quot;.
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     bool hasLexicallyDeclaredVariable(const RefPtr&lt;UniquedStringImpl&gt;&amp; ident) const
</span><span class="lines">@@ -405,7 +414,7 @@
</span><span class="cx"> 
</span><span class="cx">     bool hasDeclaredParameter(const RefPtr&lt;UniquedStringImpl&gt;&amp; ident)
</span><span class="cx">     {
</span><del>-        return m_declaredParameters.contains(ident) || m_declaredVariables.contains(ident.get());
</del><ins>+        return m_declaredParameters.contains(ident) || hasDeclaredVariable(ident);
</ins><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     void declareWrite(const Identifier* ident)
</span><span class="lines">@@ -518,7 +527,8 @@
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx">         for (IdentifierSet::iterator ptr = m_closedVariableCandidates.begin(); ptr != m_closedVariableCandidates.end(); ++ptr) {
</span><del>-            if (!m_declaredVariables.contains(*ptr))
</del><ins>+            // We refer to m_declaredVariables here directly instead of a hasDeclaredVariable because we want to mark the callee as captured.
+            if (!m_declaredVariables.contains(*ptr)) 
</ins><span class="cx">                 continue;
</span><span class="cx">             capturedVariables.add(*ptr);
</span><span class="cx">         }
</span></span></pre>
</div>
</div>

</body>
</html>