<!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>[170034] 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/170034">170034</a></dd>
<dt>Author</dt> <dd>mark.lam@apple.com</dd>
<dt>Date</dt> <dd>2014-06-16 16:19:29 -0700 (Mon, 16 Jun 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Parser statementDepth accounting needs to account for when a function body excludes its braces.
<https://webkit.org/b/133832>
Reviewed by Oliver Hunt.
Source/JavaScriptCore:
In some cases (e.g. when a Function object is instantiated from a string), the
function body source may not include its braces. The parser needs to account
for this when calculating its statementDepth.
* bytecode/UnlinkedCodeBlock.cpp:
(JSC::generateFunctionCodeBlock):
(JSC::UnlinkedFunctionExecutable::codeBlockFor):
* bytecode/UnlinkedCodeBlock.h:
* parser/Parser.cpp:
(JSC::Parser<LexerType>::parseStatement):
- Also fixed the error message for declaring nested functions in strict mode
to be more accurate.
* parser/Parser.h:
(JSC::Parser<LexerType>::parse):
(JSC::parse):
* runtime/Executable.cpp:
(JSC::ScriptExecutable::newCodeBlockFor):
LayoutTests:
* js/parser-syntax-check-expected.txt:
* js/script-tests/parser-syntax-check.js:
- Added cases for declaring functions in strict mode.
- Added caught error to the test result logging if it's not a SyntaxError.
This helps catch the issue in this bug which was erroneously throwing
RangeErrors.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsjsparsersyntaxcheckexpectedtxt">trunk/LayoutTests/js/parser-syntax-check-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsscripttestsparsersyntaxcheckjs">trunk/LayoutTests/js/script-tests/parser-syntax-check.js</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeUnlinkedCodeBlockcpp">trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeUnlinkedCodeBlockh">trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h</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>
<li><a href="#trunkSourceJavaScriptCoreruntimeExecutablecpp">trunk/Source/JavaScriptCore/runtime/Executable.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (170033 => 170034)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-06-16 22:57:28 UTC (rev 170033)
+++ trunk/LayoutTests/ChangeLog        2014-06-16 23:19:29 UTC (rev 170034)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2014-06-12 Mark Lam <mark.lam@apple.com>
+
+ Parser statementDepth accounting needs to account for when a function body excludes its braces.
+ <https://webkit.org/b/133832>
+
+ Reviewed by Oliver Hunt.
+
+ * js/parser-syntax-check-expected.txt:
+ * js/script-tests/parser-syntax-check.js:
+ - Added cases for declaring functions in strict mode.
+ - Added caught error to the test result logging if it's not a SyntaxError.
+ This helps catch the issue in this bug which was erroneously throwing
+ RangeErrors.
+
</ins><span class="cx"> 2014-06-16 Radu Stavila <stavila@adobe.com>
</span><span class="cx">
</span><span class="cx"> REGRESSION (r168046): Incorrect layout for multicol spanners when moving from one thread to another
</span></span></pre></div>
<a id="trunkLayoutTestsjsparsersyntaxcheckexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/parser-syntax-check-expected.txt (170033 => 170034)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/parser-syntax-check-expected.txt        2014-06-16 22:57:28 UTC (rev 170033)
+++ trunk/LayoutTests/js/parser-syntax-check-expected.txt        2014-06-16 23:19:29 UTC (rev 170034)
</span><span class="lines">@@ -18,25 +18,25 @@
</span><span class="cx"> PASS Invalid: "function f() { () }"
</span><span class="cx"> PASS Invalid: "a.'l'"
</span><span class="cx"> PASS Invalid: "function f() { a.'l' }"
</span><del>-PASS Valid: "a: +~!new a"
</del><ins>+PASS Valid: "a: +~!new a" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { a: +~!new a }"
</span><span class="cx"> PASS Invalid: "new -a"
</span><span class="cx"> PASS Invalid: "function f() { new -a }"
</span><del>-PASS Valid: "new (-1)"
</del><ins>+PASS Valid: "new (-1)" with TypeError
</ins><span class="cx"> PASS Valid: "function f() { new (-1) }"
</span><del>-PASS Valid: "a: b: c: new f(x++)++"
</del><ins>+PASS Valid: "a: b: c: new f(x++)++" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { a: b: c: new f(x++)++ }"
</span><del>-PASS Valid: "(a)++"
</del><ins>+PASS Valid: "(a)++" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { (a)++ }"
</span><del>-PASS Valid: "(1--).x"
</del><ins>+PASS Valid: "(1--).x" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { (1--).x }"
</span><span class="cx"> PASS Invalid: "a-- ++"
</span><span class="cx"> PASS Invalid: "function f() { a-- ++ }"
</span><span class="cx"> PASS Invalid: "(a:) --b"
</span><span class="cx"> PASS Invalid: "function f() { (a:) --b }"
</span><del>-PASS Valid: "++ -- ++ a"
</del><ins>+PASS Valid: "++ -- ++ a" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { ++ -- ++ a }"
</span><del>-PASS Valid: "++ new new a ++"
</del><ins>+PASS Valid: "++ new new a ++" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { ++ new new a ++ }"
</span><span class="cx"> PASS Valid: "delete void 0"
</span><span class="cx"> PASS Valid: "function f() { delete void 0 }"
</span><span class="lines">@@ -44,11 +44,11 @@
</span><span class="cx"> PASS Invalid: "function f() { delete the void }"
</span><span class="cx"> PASS Invalid: "(a++"
</span><span class="cx"> PASS Invalid: "function f() { (a++ }"
</span><del>-PASS Valid: "++a--"
</del><ins>+PASS Valid: "++a--" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { ++a-- }"
</span><del>-PASS Valid: "++((a))--"
</del><ins>+PASS Valid: "++((a))--" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { ++((a))-- }"
</span><del>-PASS Valid: "(a.x++)++"
</del><ins>+PASS Valid: "(a.x++)++" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { (a.x++)++ }"
</span><span class="cx"> PASS Invalid: "1: null"
</span><span class="cx"> PASS Invalid: "function f() { 1: null }"
</span><span class="lines">@@ -67,7 +67,7 @@
</span><span class="cx"> PASS Valid: "1 .l"
</span><span class="cx"> PASS Valid: "function f() { 1 .l }"
</span><span class="cx"> Binary and conditional operators
</span><del>-PASS Valid: "a + + typeof this"
</del><ins>+PASS Valid: "a + + typeof this" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { a + + typeof this }"
</span><span class="cx"> PASS Invalid: "a + * b"
</span><span class="cx"> PASS Invalid: "function f() { a + * b }"
</span><span class="lines">@@ -79,13 +79,13 @@
</span><span class="cx"> PASS Invalid: "function f() { %a }"
</span><span class="cx"> PASS Invalid: "a-"
</span><span class="cx"> PASS Invalid: "function f() { a- }"
</span><del>-PASS Valid: "a = b ? b = c : d = e"
</del><ins>+PASS Valid: "a = b ? b = c : d = e" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { a = b ? b = c : d = e }"
</span><del>-PASS Valid: "s: a[1].l ? b.l['s'] ? c++ : d : true"
</del><ins>+PASS Valid: "s: a[1].l ? b.l['s'] ? c++ : d : true" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { s: a[1].l ? b.l['s'] ? c++ : d : true }"
</span><del>-PASS Valid: "a ? b + 1 ? c + 3 * d.l : d[5][6] : e"
</del><ins>+PASS Valid: "a ? b + 1 ? c + 3 * d.l : d[5][6] : e" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { a ? b + 1 ? c + 3 * d.l : d[5][6] : e }"
</span><del>-PASS Valid: "a in b instanceof delete -c"
</del><ins>+PASS Valid: "a in b instanceof delete -c" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { a in b instanceof delete -c }"
</span><span class="cx"> PASS Invalid: "a in instanceof b.l"
</span><span class="cx"> PASS Invalid: "function f() { a in instanceof b.l }"
</span><span class="lines">@@ -93,26 +93,26 @@
</span><span class="cx"> PASS Valid: "function f() { - - true % 5 }"
</span><span class="cx"> PASS Invalid: "- false = 3"
</span><span class="cx"> PASS Invalid: "function f() { - false = 3 }"
</span><del>-PASS Valid: "a: b: c: (1 + null) = 3"
</del><ins>+PASS Valid: "a: b: c: (1 + null) = 3" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { a: b: c: (1 + null) = 3 }"
</span><del>-PASS Valid: "a[2] = b.l += c /= 4 * 7 ^ !6"
</del><ins>+PASS Valid: "a[2] = b.l += c /= 4 * 7 ^ !6" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { a[2] = b.l += c /= 4 * 7 ^ !6 }"
</span><span class="cx"> PASS Invalid: "a + typeof b += c in d"
</span><span class="cx"> PASS Invalid: "function f() { a + typeof b += c in d }"
</span><span class="cx"> PASS Invalid: "typeof a &= typeof b"
</span><span class="cx"> PASS Invalid: "function f() { typeof a &= typeof b }"
</span><del>-PASS Valid: "a: ((typeof (a))) >>>= a || b.l && c"
</del><ins>+PASS Valid: "a: ((typeof (a))) >>>= a || b.l && c" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { a: ((typeof (a))) >>>= a || b.l && c }"
</span><del>-PASS Valid: "a: b: c[a /= f[a %= b]].l[c[x] = 7] -= a ? b <<= f : g"
</del><ins>+PASS Valid: "a: b: c[a /= f[a %= b]].l[c[x] = 7] -= a ? b <<= f : g" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { a: b: c[a /= f[a %= b]].l[c[x] = 7] -= a ? b <<= f : g }"
</span><del>-PASS Valid: "-void+x['y'].l == x.l != 5 - f[7]"
</del><ins>+PASS Valid: "-void+x['y'].l == x.l != 5 - f[7]" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { -void+x['y'].l == x.l != 5 - f[7] }"
</span><span class="cx"> Function calls (and new with arguments)
</span><del>-PASS Valid: "a()()()"
</del><ins>+PASS Valid: "a()()()" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { a()()() }"
</span><del>-PASS Valid: "s: l: a[2](4 == 6, 5 = 6)(f[4], 6)"
</del><ins>+PASS Valid: "s: l: a[2](4 == 6, 5 = 6)(f[4], 6)" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { s: l: a[2](4 == 6, 5 = 6)(f[4], 6) }"
</span><del>-PASS Valid: "s: eval(a.apply(), b.call(c[5] - f[7]))"
</del><ins>+PASS Valid: "s: eval(a.apply(), b.call(c[5] - f[7]))" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { s: eval(a.apply(), b.call(c[5] - f[7])) }"
</span><span class="cx"> PASS Invalid: "a("
</span><span class="cx"> PASS Invalid: "function f() { a( }"
</span><span class="lines">@@ -124,25 +124,25 @@
</span><span class="cx"> PASS Invalid: "function f() { a(5,) }"
</span><span class="cx"> PASS Invalid: "a(5,6"
</span><span class="cx"> PASS Invalid: "function f() { a(5,6 }"
</span><del>-PASS Valid: "a(b[7], c <d> e.l, new a() > b)"
</del><ins>+PASS Valid: "a(b[7], c <d> e.l, new a() > b)" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { a(b[7], c <d> e.l, new a() > b) }"
</span><span class="cx"> PASS Invalid: "a(b[5)"
</span><span class="cx"> PASS Invalid: "function f() { a(b[5) }"
</span><span class="cx"> PASS Invalid: "a(b.)"
</span><span class="cx"> PASS Invalid: "function f() { a(b.) }"
</span><del>-PASS Valid: "~new new a(1)(i++)(c[l])"
</del><ins>+PASS Valid: "~new new a(1)(i++)(c[l])" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { ~new new a(1)(i++)(c[l]) }"
</span><span class="cx"> PASS Invalid: "a(*a)"
</span><span class="cx"> PASS Invalid: "function f() { a(*a) }"
</span><del>-PASS Valid: "((((a))((b)()).l))()"
</del><ins>+PASS Valid: "((((a))((b)()).l))()" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { ((((a))((b)()).l))() }"
</span><del>-PASS Valid: "(a)[b + (c) / (d())].l--"
</del><ins>+PASS Valid: "(a)[b + (c) / (d())].l--" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { (a)[b + (c) / (d())].l-- }"
</span><del>-PASS Valid: "new (5)"
</del><ins>+PASS Valid: "new (5)" with TypeError
</ins><span class="cx"> PASS Valid: "function f() { new (5) }"
</span><span class="cx"> PASS Invalid: "new a(5"
</span><span class="cx"> PASS Invalid: "function f() { new a(5 }"
</span><del>-PASS Valid: "new (f + 5)(6, (g)() - 'l'() - true(false))"
</del><ins>+PASS Valid: "new (f + 5)(6, (g)() - 'l'() - true(false))" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { new (f + 5)(6, (g)() - 'l'() - true(false)) }"
</span><span class="cx"> PASS Invalid: "a(.length)"
</span><span class="cx"> PASS Invalid: "function f() { a(.length) }"
</span><span class="lines">@@ -169,7 +169,7 @@
</span><span class="cx"> PASS Invalid: "function f() { (function a{}) }"
</span><span class="cx"> PASS Invalid: "(function this(){})"
</span><span class="cx"> PASS Invalid: "function f() { (function this(){}) }"
</span><del>-PASS Valid: "(delete new function f(){} + function(a,b){}(5)(6))"
</del><ins>+PASS Valid: "(delete new function f(){} + function(a,b){}(5)(6))" with TypeError
</ins><span class="cx"> PASS Valid: "function f() { (delete new function f(){} + function(a,b){}(5)(6)) }"
</span><span class="cx"> PASS Valid: "6 - function (m) { function g() {} }"
</span><span class="cx"> PASS Valid: "function f() { 6 - function (m) { function g() {} } }"
</span><span class="lines">@@ -178,7 +178,7 @@
</span><span class="cx"> PASS Invalid: "function l++(){}"
</span><span class="cx"> PASS Invalid: "function f() { function l++(){} }"
</span><span class="cx"> Array and object literal, comma operator
</span><del>-PASS Valid: "[] in [5,6] * [,5,] / [,,5,,] || [a,] && new [,b] % [,,]"
</del><ins>+PASS Valid: "[] in [5,6] * [,5,] / [,,5,,] || [a,] && new [,b] % [,,]" with TypeError
</ins><span class="cx"> PASS Valid: "function f() { [] in [5,6] * [,5,] / [,,5,,] || [a,] && new [,b] % [,,] }"
</span><span class="cx"> PASS Invalid: "[5,"
</span><span class="cx"> PASS Invalid: "function f() { [5, }"
</span><span class="lines">@@ -186,7 +186,7 @@
</span><span class="cx"> PASS Invalid: "function f() { [, }"
</span><span class="cx"> PASS Invalid: "(a,)"
</span><span class="cx"> PASS Invalid: "function f() { (a,) }"
</span><del>-PASS Valid: "1 + {get get(){}, set set(a){}, get1:4, set1:get-set, }"
</del><ins>+PASS Valid: "1 + {get get(){}, set set(a){}, get1:4, set1:get-set, }" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { 1 + {get get(){}, set set(a){}, get1:4, set1:get-set, } }"
</span><span class="cx"> PASS Invalid: "1 + {a"
</span><span class="cx"> PASS Invalid: "function f() { 1 + {a }"
</span><span class="lines">@@ -196,7 +196,7 @@
</span><span class="cx"> PASS Invalid: "function f() { 1 + {get l( }"
</span><span class="cx"> PASS Invalid: ",a"
</span><span class="cx"> PASS Invalid: "function f() { ,a }"
</span><del>-PASS Valid: "(4,(5,a(3,4))),f[4,a-6]"
</del><ins>+PASS Valid: "(4,(5,a(3,4))),f[4,a-6]" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { (4,(5,a(3,4))),f[4,a-6] }"
</span><span class="cx"> PASS Invalid: "(,f)"
</span><span class="cx"> PASS Invalid: "function f() { (,f) }"
</span><span class="lines">@@ -215,11 +215,11 @@
</span><span class="cx"> PASS Valid: "function f() { a: { ; } }"
</span><span class="cx"> PASS Invalid: "{ a: }"
</span><span class="cx"> PASS Invalid: "function f() { { a: } }"
</span><del>-PASS Valid: "{} f; { 6 + f() }"
</del><ins>+PASS Valid: "{} f; { 6 + f() }" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { {} f; { 6 + f() } }"
</span><del>-PASS Valid: "{ a[5],6; {} ++b-new (-5)() } c().l++"
</del><ins>+PASS Valid: "{ a[5],6; {} ++b-new (-5)() } c().l++" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { { a[5],6; {} ++b-new (-5)() } c().l++ }"
</span><del>-PASS Valid: "{ l1: l2: l3: { this } a = 32 ; { i++ ; { { { } } ++i } } }"
</del><ins>+PASS Valid: "{ l1: l2: l3: { this } a = 32 ; { i++ ; { { { } } ++i } } }" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { { l1: l2: l3: { this } a = 32 ; { i++ ; { { { } } ++i } } } }"
</span><span class="cx"> PASS Valid: "if (a) ;"
</span><span class="cx"> PASS Valid: "function f() { if (a) ; }"
</span><span class="lines">@@ -235,25 +235,25 @@
</span><span class="cx"> PASS Valid: "function f() { x: s: if (a) ; else b }"
</span><span class="cx"> PASS Invalid: "else {}"
</span><span class="cx"> PASS Invalid: "function f() { else {} }"
</span><del>-PASS Valid: "if (a) if (b) y; else {} else ;"
</del><ins>+PASS Valid: "if (a) if (b) y; else {} else ;" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { if (a) if (b) y; else {} else ; }"
</span><span class="cx"> PASS Invalid: "if (a) {} else x; else"
</span><span class="cx"> PASS Invalid: "function f() { if (a) {} else x; else }"
</span><span class="cx"> PASS Invalid: "if (a) { else }"
</span><span class="cx"> PASS Invalid: "function f() { if (a) { else } }"
</span><del>-PASS Valid: "if (a.l + new b()) 4 + 5 - f()"
</del><ins>+PASS Valid: "if (a.l + new b()) 4 + 5 - f()" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { if (a.l + new b()) 4 + 5 - f() }"
</span><del>-PASS Valid: "if (a) with (x) ; else with (y) ;"
</del><ins>+PASS Valid: "if (a) with (x) ; else with (y) ;" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { if (a) with (x) ; else with (y) ; }"
</span><span class="cx"> PASS Invalid: "with a.b { }"
</span><span class="cx"> PASS Invalid: "function f() { with a.b { } }"
</span><del>-PASS Valid: "while (a() - new b) ;"
</del><ins>+PASS Valid: "while (a() - new b) ;" with TypeError
</ins><span class="cx"> PASS Valid: "function f() { while (a() - new b) ; }"
</span><span class="cx"> PASS Invalid: "while a {}"
</span><span class="cx"> PASS Invalid: "function f() { while a {} }"
</span><del>-PASS Valid: "do ; while(0) i++"
</del><ins>+PASS Valid: "do ; while(0) i++" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { do ; while(0) i++ }"
</span><del>-PASS Valid: "do if (a) x; else y; while(z)"
</del><ins>+PASS Valid: "do if (a) x; else y; while(z)" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { do if (a) x; else y; while(z) }"
</span><span class="cx"> PASS Invalid: "do g; while 4"
</span><span class="cx"> PASS Invalid: "function f() { do g; while 4 }"
</span><span class="lines">@@ -263,7 +263,7 @@
</span><span class="cx"> PASS Valid: "function f() { { { do do do ; while(0) while(0) while(0) } } }"
</span><span class="cx"> PASS Valid: "do while (0) if (a) {} else y; while(0)"
</span><span class="cx"> PASS Valid: "function f() { do while (0) if (a) {} else y; while(0) }"
</span><del>-PASS Valid: "if (a) while (b) if (c) with(d) {} else e; else f"
</del><ins>+PASS Valid: "if (a) while (b) if (c) with(d) {} else e; else f" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { if (a) while (b) if (c) with(d) {} else e; else f }"
</span><span class="cx"> PASS Invalid: "break ; break your_limits ; continue ; continue living ; debugger"
</span><span class="cx"> PASS Invalid: "function f() { break ; break your_limits ; continue ; continue living ; debugger }"
</span><span class="lines">@@ -277,7 +277,7 @@
</span><span class="cx"> PASS Invalid: "function f() { continue (my_friend) }"
</span><span class="cx"> PASS Valid: "while (1) break"
</span><span class="cx"> PASS Valid: "function f() { while (1) break }"
</span><del>-PASS Valid: "do if (a) with (b) continue; else debugger; while (false)"
</del><ins>+PASS Valid: "do if (a) with (b) continue; else debugger; while (false)" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { do if (a) with (b) continue; else debugger; while (false) }"
</span><span class="cx"> PASS Invalid: "do if (a) while (false) else debugger"
</span><span class="cx"> PASS Invalid: "function f() { do if (a) while (false) else debugger }"
</span><span class="lines">@@ -285,7 +285,7 @@
</span><span class="cx"> PASS Invalid: "function f() { while if (a) ; }"
</span><span class="cx"> PASS Valid: "if (a) function f() {} else function g() {}"
</span><span class="cx"> PASS Valid: "function f() { if (a) function f() {} else function g() {} }"
</span><del>-PASS Valid: "if (a()) while(0) function f() {} else function g() {}"
</del><ins>+PASS Valid: "if (a()) while(0) function f() {} else function g() {}" with TypeError
</ins><span class="cx"> PASS Valid: "function f() { if (a()) while(0) function f() {} else function g() {} }"
</span><span class="cx"> PASS Invalid: "if (a()) function f() { else function g() }"
</span><span class="cx"> PASS Invalid: "function f() { if (a()) function f() { else function g() } }"
</span><span class="lines">@@ -293,9 +293,9 @@
</span><span class="cx"> PASS Invalid: "function f() { if (a) if (b) ; else function f {} }"
</span><span class="cx"> PASS Invalid: "if (a) if (b) ; else function (){}"
</span><span class="cx"> PASS Invalid: "function f() { if (a) if (b) ; else function (){} }"
</span><del>-PASS Valid: "throw a"
</del><ins>+PASS Valid: "throw a" with 32
</ins><span class="cx"> PASS Valid: "function f() { throw a }"
</span><del>-PASS Valid: "throw a + b in void c"
</del><ins>+PASS Valid: "throw a + b in void c" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { throw a + b in void c }"
</span><span class="cx"> PASS Invalid: "throw"
</span><span class="cx"> PASS Invalid: "function f() { throw }"
</span><span class="lines">@@ -320,7 +320,7 @@
</span><span class="cx"> PASS Invalid: "function f() { var a = if (b) { c } }"
</span><span class="cx"> PASS Invalid: "var a = var b"
</span><span class="cx"> PASS Invalid: "function f() { var a = var b }"
</span><del>-PASS Valid: "const a = b += c, a, a, a = (b - f())"
</del><ins>+PASS Valid: "const a = b += c, a, a, a = (b - f())" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { const a = b += c, a, a, a = (b - f()) }"
</span><span class="cx"> PASS Invalid: "var a %= b | 5"
</span><span class="cx"> PASS Invalid: "function f() { var a %= b | 5 }"
</span><span class="lines">@@ -332,11 +332,11 @@
</span><span class="cx"> PASS Invalid: "function f() { const 'l' = 3 }"
</span><span class="cx"> PASS Invalid: "var var = 3"
</span><span class="cx"> PASS Invalid: "function f() { var var = 3 }"
</span><del>-PASS Valid: "var varr = 3 in 1"
</del><ins>+PASS Valid: "var varr = 3 in 1" with TypeError
</ins><span class="cx"> PASS Valid: "function f() { var varr = 3 in 1 }"
</span><span class="cx"> PASS Valid: "const a, a, a = void 7 - typeof 8, a = 8"
</span><span class="cx"> PASS Valid: "function f() { const a, a, a = void 7 - typeof 8, a = 8 }"
</span><del>-PASS Valid: "const x_x = 6 /= 7 ? e : f"
</del><ins>+PASS Valid: "const x_x = 6 /= 7 ? e : f" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { const x_x = 6 /= 7 ? e : f }"
</span><span class="cx"> PASS Invalid: "var a = ?"
</span><span class="cx"> PASS Invalid: "function f() { var a = ? }"
</span><span class="lines">@@ -344,7 +344,7 @@
</span><span class="cx"> PASS Invalid: "function f() { const a = *7 }"
</span><span class="cx"> PASS Invalid: "var a = :)"
</span><span class="cx"> PASS Invalid: "function f() { var a = :) }"
</span><del>-PASS Valid: "var a = a in b in c instanceof d"
</del><ins>+PASS Valid: "var a = a in b in c instanceof d" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { var a = a in b in c instanceof d }"
</span><span class="cx"> PASS Invalid: "var a = b ? c, b"
</span><span class="cx"> PASS Invalid: "function f() { var a = b ? c, b }"
</span><span class="lines">@@ -407,9 +407,9 @@
</span><span class="cx"> PASS Valid: "function f() { for (var a, b ; ; ) { break } }"
</span><span class="cx"> PASS Valid: "for (var a = b, b = a ; ; ) break"
</span><span class="cx"> PASS Valid: "function f() { for (var a = b, b = a ; ; ) break }"
</span><del>-PASS Valid: "for (var a = b, c, d, b = a ; x in b ; ) { break }"
</del><ins>+PASS Valid: "for (var a = b, c, d, b = a ; x in b ; ) { break }" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { for (var a = b, c, d, b = a ; x in b ; ) { break } }"
</span><del>-PASS Valid: "for (var a = b, c, d ; ; 1 in a()) break"
</del><ins>+PASS Valid: "for (var a = b, c, d ; ; 1 in a()) break" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { for (var a = b, c, d ; ; 1 in a()) break }"
</span><span class="cx"> PASS Invalid: "for ( ; var a ; ) break"
</span><span class="cx"> PASS Invalid: "function f() { for ( ; var a ; ) break }"
</span><span class="lines">@@ -417,47 +417,47 @@
</span><span class="cx"> PASS Invalid: "function f() { for (const a; ; ) break }"
</span><span class="cx"> PASS Invalid: "for ( %a ; ; ) { }"
</span><span class="cx"> PASS Invalid: "function f() { for ( %a ; ; ) { } }"
</span><del>-PASS Valid: "for (a in b) break"
</del><ins>+PASS Valid: "for (a in b) break" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { for (a in b) break }"
</span><del>-PASS Valid: "for (a() in b) break"
</del><ins>+PASS Valid: "for (a() in b) break" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { for (a() in b) break }"
</span><del>-PASS Valid: "for (a().l[4] in b) break"
</del><ins>+PASS Valid: "for (a().l[4] in b) break" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { for (a().l[4] in b) break }"
</span><del>-PASS Valid: "for (new a in b in c in d) break"
</del><ins>+PASS Valid: "for (new a in b in c in d) break" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { for (new a in b in c in d) break }"
</span><del>-PASS Valid: "for (new new new a in b) break"
</del><ins>+PASS Valid: "for (new new new a in b) break" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { for (new new new a in b) break }"
</span><span class="cx"> PASS Invalid: "for (delete new a() in b) break"
</span><span class="cx"> PASS Invalid: "function f() { for (delete new a() in b) break }"
</span><span class="cx"> PASS Invalid: "for (a * a in b) break"
</span><span class="cx"> PASS Invalid: "function f() { for (a * a in b) break }"
</span><del>-PASS Valid: "for ((a * a) in b) break"
</del><ins>+PASS Valid: "for ((a * a) in b) break" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { for ((a * a) in b) break }"
</span><span class="cx"> PASS Invalid: "for (a++ in b) break"
</span><span class="cx"> PASS Invalid: "function f() { for (a++ in b) break }"
</span><del>-PASS Valid: "for ((a++) in b) break"
</del><ins>+PASS Valid: "for ((a++) in b) break" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { for ((a++) in b) break }"
</span><span class="cx"> PASS Invalid: "for (++a in b) break"
</span><span class="cx"> PASS Invalid: "function f() { for (++a in b) break }"
</span><del>-PASS Valid: "for ((++a) in b) break"
</del><ins>+PASS Valid: "for ((++a) in b) break" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { for ((++a) in b) break }"
</span><span class="cx"> PASS Invalid: "for (a, b in c) break"
</span><span class="cx"> PASS Invalid: "function f() { for (a, b in c) break }"
</span><span class="cx"> PASS Invalid: "for (a,b in c ;;) break"
</span><span class="cx"> PASS Invalid: "function f() { for (a,b in c ;;) break }"
</span><del>-PASS Valid: "for (a,(b in c) ;;) break"
</del><ins>+PASS Valid: "for (a,(b in c) ;;) break" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { for (a,(b in c) ;;) break }"
</span><del>-PASS Valid: "for ((a, b) in c) break"
</del><ins>+PASS Valid: "for ((a, b) in c) break" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { for ((a, b) in c) break }"
</span><span class="cx"> PASS Invalid: "for (a ? b : c in c) break"
</span><span class="cx"> PASS Invalid: "function f() { for (a ? b : c in c) break }"
</span><del>-PASS Valid: "for ((a ? b : c) in c) break"
</del><ins>+PASS Valid: "for ((a ? b : c) in c) break" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { for ((a ? b : c) in c) break }"
</span><del>-PASS Valid: "for (var a in b in c) break"
</del><ins>+PASS Valid: "for (var a in b in c) break" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { for (var a in b in c) break }"
</span><del>-PASS Valid: "for (var a = 5 += 6 in b) break"
</del><ins>+PASS Valid: "for (var a = 5 += 6 in b) break" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { for (var a = 5 += 6 in b) break }"
</span><del>-PASS Valid: "for (var a = debug('should not be hit') in b) break"
</del><ins>+PASS Valid: "for (var a = debug('should not be hit') in b) break" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { for (var a = debug('should not be hit') in b) break }"
</span><span class="cx"> PASS Invalid: "for (var a += 5 in b) break"
</span><span class="cx"> PASS Invalid: "function f() { for (var a += 5 in b) break }"
</span><span class="lines">@@ -469,18 +469,18 @@
</span><span class="cx"> PASS Invalid: "function f() { for (var a = -6, b in b) break }"
</span><span class="cx"> PASS Invalid: "for (var a, b = 8 in b) break"
</span><span class="cx"> PASS Invalid: "function f() { for (var a, b = 8 in b) break }"
</span><del>-PASS Valid: "for (var a = (b in c) in d) break"
</del><ins>+PASS Valid: "for (var a = (b in c) in d) break" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { for (var a = (b in c) in d) break }"
</span><span class="cx"> PASS Invalid: "for (var a = (b in c in d) break"
</span><span class="cx"> PASS Invalid: "function f() { for (var a = (b in c in d) break }"
</span><span class="cx"> PASS Invalid: "for (var (a) in b) { }"
</span><span class="cx"> PASS Invalid: "function f() { for (var (a) in b) { } }"
</span><del>-PASS Valid: "for (var a = 7, b = c < d >= d ; f()[6]++ ; --i()[1]++ ) {}"
</del><ins>+PASS Valid: "for (var a = 7, b = c < d >= d ; f()[6]++ ; --i()[1]++ ) {}" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { for (var a = 7, b = c < d >= d ; f()[6]++ ; --i()[1]++ ) {} }"
</span><span class="cx"> try statement
</span><span class="cx"> PASS Invalid: "try { break } catch(e) {}"
</span><span class="cx"> PASS Invalid: "function f() { try { break } catch(e) {} }"
</span><del>-PASS Valid: "try {} finally { c++ }"
</del><ins>+PASS Valid: "try {} finally { c++ }" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { try {} finally { c++ } }"
</span><span class="cx"> PASS Valid: "try { with (x) { } } catch(e) {} finally { if (a) ; }"
</span><span class="cx"> PASS Valid: "function f() { try { with (x) { } } catch(e) {} finally { if (a) ; } }"
</span><span class="lines">@@ -508,7 +508,7 @@
</span><span class="cx"> PASS Invalid: "function f() { try {} catch {} }"
</span><span class="cx"> PASS Valid: "if (a) try {} finally {} else b;"
</span><span class="cx"> PASS Valid: "function f() { if (a) try {} finally {} else b; }"
</span><del>-PASS Valid: "if (--a()) do with(1) try {} catch(ke) { f() ; g() } while (a in b) else {}"
</del><ins>+PASS Valid: "if (--a()) do with(1) try {} catch(ke) { f() ; g() } while (a in b) else {}" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { if (--a()) do with(1) try {} catch(ke) { f() ; g() } while (a in b) else {} }"
</span><span class="cx"> PASS Invalid: "if (a) try {} else b; catch (e) { }"
</span><span class="cx"> PASS Invalid: "function f() { if (a) try {} else b; catch (e) { } }"
</span><span class="lines">@@ -527,7 +527,7 @@
</span><span class="cx"> PASS Invalid: "function f() { switch (a) b; }"
</span><span class="cx"> PASS Invalid: "switch (a) case 3: b;"
</span><span class="cx"> PASS Invalid: "function f() { switch (a) case 3: b; }"
</span><del>-PASS Valid: "switch (f()) { case 5 * f(): default: case '6' - 9: ++i }"
</del><ins>+PASS Valid: "switch (f()) { case 5 * f(): default: case '6' - 9: ++i }" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { switch (f()) { case 5 * f(): default: case '6' - 9: ++i } }"
</span><span class="cx"> PASS Invalid: "switch (true) { default: case 6: default: }"
</span><span class="cx"> PASS Invalid: "function f() { switch (true) { default: case 6: default: } }"
</span><span class="lines">@@ -535,7 +535,7 @@
</span><span class="cx"> PASS Invalid: "function f() { switch (l) { f(); } }"
</span><span class="cx"> PASS Invalid: "switch (l) { case 1: ; a: case 5: }"
</span><span class="cx"> PASS Invalid: "function f() { switch (l) { case 1: ; a: case 5: } }"
</span><del>-PASS Valid: "switch (g() - h[5].l) { case 1 + 6: a: b: c: ++f }"
</del><ins>+PASS Valid: "switch (g() - h[5].l) { case 1 + 6: a: b: c: ++f }" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { switch (g() - h[5].l) { case 1 + 6: a: b: c: ++f } }"
</span><span class="cx"> PASS Invalid: "switch (g) { case 1: a: }"
</span><span class="cx"> PASS Invalid: "function f() { switch (g) { case 1: a: } }"
</span><span class="lines">@@ -545,13 +545,13 @@
</span><span class="cx"> PASS Invalid: "function f() { switch g { case 1: l() } }"
</span><span class="cx"> PASS Invalid: "switch (g) { case 1:"
</span><span class="cx"> PASS Invalid: "function f() { switch (g) { case 1: }"
</span><del>-PASS Valid: "switch (l) { case a = b ? c : d : }"
</del><ins>+PASS Valid: "switch (l) { case a = b ? c : d : }" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { switch (l) { case a = b ? c : d : } }"
</span><del>-PASS Valid: "switch (sw) { case a ? b - 7[1] ? [c,,] : d = 6 : { } : }"
</del><ins>+PASS Valid: "switch (sw) { case a ? b - 7[1] ? [c,,] : d = 6 : { } : }" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { switch (sw) { case a ? b - 7[1] ? [c,,] : d = 6 : { } : } }"
</span><span class="cx"> PASS Invalid: "switch (l) { case b ? c : }"
</span><span class="cx"> PASS Invalid: "function f() { switch (l) { case b ? c : } }"
</span><del>-PASS Valid: "switch (l) { case 1: a: with(g) switch (g) { case 2: default: } default: }"
</del><ins>+PASS Valid: "switch (l) { case 1: a: with(g) switch (g) { case 2: default: } default: }" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { switch (l) { case 1: a: with(g) switch (g) { case 2: default: } default: } }"
</span><span class="cx"> PASS Invalid: "switch (4 - ) { }"
</span><span class="cx"> PASS Invalid: "function f() { switch (4 - ) { } }"
</span><span class="lines">@@ -575,6 +575,22 @@
</span><span class="cx"> PASS Valid: "function f() { 'use strict'; function __proto__(){} }"
</span><span class="cx"> PASS Valid: "'use strict'; (function __proto__(){})"
</span><span class="cx"> PASS Valid: "function f() { 'use strict'; (function __proto__(){}) }"
</span><ins>+PASS Valid: "'use strict'; function f1(a) { function f2(b) { return b; } return f2(a); } f1(5);"
+PASS Valid: "function f() { 'use strict'; function f1(a) { function f2(b) { return b; } return f2(a); } f1(5); }"
+PASS Valid: "'use strict'; function f1(a) { function f2(b) { function f3(c) { return c; } return f3(b); } return f2(a); } f1(5);"
+PASS Valid: "function f() { 'use strict'; function f1(a) { function f2(b) { function f3(c) { return c; } return f3(b); } return f2(a); } f1(5); }"
+PASS Invalid: "'use strict'; function f1(a) { if (a) { function f2(b) { return b; } return f2(a); } else return a; } f1(5);"
+PASS Invalid: "function f() { 'use strict'; function f1(a) { if (a) { function f2(b) { return b; } return f2(a); } else return a; } f1(5); }"
+PASS Invalid: "'use strict'; function f1(a) { function f2(b) { if (b) { function f3(c) { return c; } return f3(b); } else return b; } return f2(a); } f1(5);"
+PASS Invalid: "function f() { 'use strict'; function f1(a) { function f2(b) { if (b) { function f3(c) { return c; } return f3(b); } else return b; } return f2(a); } f1(5); }"
+PASS Valid: "var str = "'use strict'; function f1(a) { function f2(b) { return b; } return f2(a); } return f1(arguments[0]);"; var foo = new Function(str); foo(5);"
+PASS Valid: "function f() { var str = "'use strict'; function f1(a) { function f2(b) { return b; } return f2(a); } return f1(arguments[0]);"; var foo = new Function(str); foo(5); }"
+PASS Valid: "var str = "'use strict'; function f1(a) { function f2(b) { function f3(c) { return c; } return f3(b); } return f2(a); } return f1(arguments[0]);"; var foo = new Function(str); foo(5);"
+PASS Valid: "function f() { var str = "'use strict'; function f1(a) { function f2(b) { function f3(c) { return c; } return f3(b); } return f2(a); } return f1(arguments[0]);"; var foo = new Function(str); foo(5); }"
+PASS Invalid: "var str = "'use strict'; function f1(a) { if (a) { function f2(b) { return b; } return f2(a); } else return a; } return f1(arguments[0]);"; var foo = new Function(str); foo(5);"
+FAIL Invalid: "function f() { var str = "'use strict'; function f1(a) { if (a) { function f2(b) { return b; } return f2(a); } else return a; } return f1(arguments[0]);"; var foo = new Function(str); foo(5); }" but did not throw
+PASS Invalid: "var str = "'use strict'; function f1(a) { function f2(b) { if (b) { function f3(c) { return c; } return f3(b); } else return b; } return f2(a); } return f1(arguments[0]);"; var foo = new Function(str); foo(5);"
+FAIL Invalid: "function f() { var str = "'use strict'; function f1(a) { function f2(b) { if (b) { function f3(c) { return c; } return f3(b); } else return b; } return f2(a); } return f1(arguments[0]);"; var foo = new Function(str); foo(5); }" but did not throw
</ins><span class="cx"> PASS Valid: "if (0) $foo; "
</span><span class="cx"> PASS Valid: "function f() { if (0) $foo; }"
</span><span class="cx"> PASS Valid: "if (0) _foo; "
</span><span class="lines">@@ -605,11 +621,11 @@
</span><span class="cx"> PASS Invalid: "function f() { var a.b = c }"
</span><span class="cx"> PASS Invalid: "var a.b;"
</span><span class="cx"> PASS Invalid: "function f() { var a.b; }"
</span><del>-PASS Valid: "for (of of of){}"
</del><ins>+PASS Valid: "for (of of of){}" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { for (of of of){} }"
</span><del>-PASS Valid: "for (of; of; of){}"
</del><ins>+PASS Valid: "for (of; of; of){}" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { for (of; of; of){} }"
</span><del>-PASS Valid: "for (var of of of){}"
</del><ins>+PASS Valid: "for (var of of of){}" with TypeError
</ins><span class="cx"> PASS Valid: "function f() { for (var of of of){} }"
</span><span class="cx"> PASS Valid: "for (var of; of; of){}"
</span><span class="cx"> PASS Valid: "function f() { for (var of; of; of){} }"
</span><span class="lines">@@ -617,23 +633,23 @@
</span><span class="cx"> PASS Invalid: "function f() { for (var of.of of of){} }"
</span><span class="cx"> PASS Invalid: "for (var of[of] of of){}"
</span><span class="cx"> PASS Invalid: "function f() { for (var of[of] of of){} }"
</span><del>-PASS Valid: "for (of.of of of){}"
</del><ins>+PASS Valid: "for (of.of of of){}" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { for (of.of of of){} }"
</span><del>-PASS Valid: "for (of[of] of of){}"
</del><ins>+PASS Valid: "for (of[of] of of){}" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { for (of[of] of of){} }"
</span><del>-PASS Valid: "for (var [of] of of){}"
</del><ins>+PASS Valid: "for (var [of] of of){}" with TypeError
</ins><span class="cx"> PASS Valid: "function f() { for (var [of] of of){} }"
</span><del>-PASS Valid: "for (var {of} of of){}"
</del><ins>+PASS Valid: "for (var {of} of of){}" with TypeError
</ins><span class="cx"> PASS Valid: "function f() { for (var {of} of of){} }"
</span><del>-PASS Valid: "for (of in of){}"
</del><ins>+PASS Valid: "for (of in of){}" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { for (of in of){} }"
</span><span class="cx"> PASS Valid: "for (var of in of){}"
</span><span class="cx"> PASS Valid: "function f() { for (var of in of){} }"
</span><span class="cx"> PASS Invalid: "for (var of.of in of){}"
</span><span class="cx"> PASS Invalid: "function f() { for (var of.of in of){} }"
</span><del>-PASS Valid: "for (of.of in of){}"
</del><ins>+PASS Valid: "for (of.of in of){}" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { for (of.of in of){} }"
</span><del>-PASS Valid: "for (of[of] in of){}"
</del><ins>+PASS Valid: "for (of[of] in of){}" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { for (of[of] in of){} }"
</span><span class="cx"> PASS Invalid: "for (var of[of] in of){}"
</span><span class="cx"> PASS Invalid: "function f() { for (var of[of] in of){} }"
</span><span class="lines">@@ -641,9 +657,9 @@
</span><span class="cx"> PASS Valid: "function f() { for (var [of] in of){} }"
</span><span class="cx"> PASS Valid: "for (var {of} in of){}"
</span><span class="cx"> PASS Valid: "function f() { for (var {of} in of){} }"
</span><del>-PASS Valid: "for ([of] in of){}"
</del><ins>+PASS Valid: "for ([of] in of){}" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { for ([of] in of){} }"
</span><del>-PASS Valid: "for ({of} in of){}"
</del><ins>+PASS Valid: "for ({of} in of){}" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { for ({of} in of){} }"
</span><span class="cx"> PASS Invalid: "for (of of of of){}"
</span><span class="cx"> PASS Invalid: "function f() { for (of of of of){} }"
</span><span class="lines">@@ -662,17 +678,17 @@
</span><span class="cx"> PASS Invalid: "for (var of in){}"
</span><span class="cx"> PASS Invalid: "function f() { for (var of in){} }"
</span><span class="cx"> spread operator
</span><del>-PASS Valid: "foo(...bar)"
</del><ins>+PASS Valid: "foo(...bar)" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { foo(...bar) }"
</span><del>-PASS Valid: "o.foo(...bar)"
</del><ins>+PASS Valid: "o.foo(...bar)" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { o.foo(...bar) }"
</span><del>-PASS Valid: "o[foo](...bar)"
</del><ins>+PASS Valid: "o[foo](...bar)" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { o[foo](...bar) }"
</span><del>-PASS Valid: "new foo(...bar)"
</del><ins>+PASS Valid: "new foo(...bar)" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { new foo(...bar) }"
</span><del>-PASS Valid: "new o.foo(...bar)"
</del><ins>+PASS Valid: "new o.foo(...bar)" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { new o.foo(...bar) }"
</span><del>-PASS Valid: "new o[foo](...bar)"
</del><ins>+PASS Valid: "new o[foo](...bar)" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { new o[foo](...bar) }"
</span><span class="cx"> PASS Invalid: "foo(...)"
</span><span class="cx"> PASS Invalid: "function f() { foo(...) }"
</span><span class="lines">@@ -698,37 +714,37 @@
</span><span class="cx"> PASS Invalid: "function f() { o.foo(...bar, a) }"
</span><span class="cx"> PASS Invalid: "o[foo](...bar, a)"
</span><span class="cx"> PASS Invalid: "function f() { o[foo](...bar, a) }"
</span><del>-PASS Valid: "[...bar]"
</del><ins>+PASS Valid: "[...bar]" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { [...bar] }"
</span><del>-PASS Valid: "[a, ...bar]"
</del><ins>+PASS Valid: "[a, ...bar]" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { [a, ...bar] }"
</span><del>-PASS Valid: "[...bar, a]"
</del><ins>+PASS Valid: "[...bar, a]" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { [...bar, a] }"
</span><del>-PASS Valid: "[...bar,,,,]"
</del><ins>+PASS Valid: "[...bar,,,,]" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { [...bar,,,,] }"
</span><del>-PASS Valid: "[,,,,...bar]"
</del><ins>+PASS Valid: "[,,,,...bar]" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { [,,,,...bar] }"
</span><del>-PASS Valid: "({1: x})"
</del><ins>+PASS Valid: "({1: x})" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { ({1: x}) }"
</span><span class="cx"> PASS Valid: "({1: x}=1)"
</span><span class="cx"> PASS Valid: "function f() { ({1: x}=1) }"
</span><del>-PASS Valid: "({1: x}=null)"
</del><ins>+PASS Valid: "({1: x}=null)" with TypeError
</ins><span class="cx"> PASS Valid: "function f() { ({1: x}=null) }"
</span><span class="cx"> PASS Valid: "({1: x})"
</span><span class="cx"> PASS Valid: "function f() { ({1: x}) }"
</span><span class="cx"> PASS Valid: "({1: x}=1)"
</span><span class="cx"> PASS Valid: "function f() { ({1: x}=1) }"
</span><del>-PASS Valid: "({1: x}=null)"
</del><ins>+PASS Valid: "({1: x}=null)" with TypeError
</ins><span class="cx"> PASS Valid: "function f() { ({1: x}=null) }"
</span><del>-PASS Valid: "({a: b}=null)"
</del><ins>+PASS Valid: "({a: b}=null)" with TypeError
</ins><span class="cx"> PASS Valid: "function f() { ({a: b}=null) }"
</span><span class="cx"> PASS Valid: "'use strict'; ({1: x})"
</span><span class="cx"> PASS Valid: "function f() { 'use strict'; ({1: x}) }"
</span><span class="cx"> PASS Valid: "'use strict'; ({1: x}=1)"
</span><span class="cx"> PASS Valid: "function f() { 'use strict'; ({1: x}=1) }"
</span><del>-PASS Valid: "'use strict'; ({1: x}=null)"
</del><ins>+PASS Valid: "'use strict'; ({1: x}=null)" with TypeError
</ins><span class="cx"> PASS Valid: "function f() { 'use strict'; ({1: x}=null) }"
</span><del>-PASS Valid: "'use strict'; ({a: b}=null)"
</del><ins>+PASS Valid: "'use strict'; ({a: b}=null)" with TypeError
</ins><span class="cx"> PASS Valid: "function f() { 'use strict'; ({a: b}=null) }"
</span><span class="cx"> PASS Valid: "var {1:x}=1"
</span><span class="cx"> PASS Valid: "function f() { var {1:x}=1 }"
</span><span class="lines">@@ -742,17 +758,17 @@
</span><span class="cx"> PASS Valid: "function f() { delete ({a}=1) }"
</span><span class="cx"> PASS Valid: "delete ({a:a}=1)"
</span><span class="cx"> PASS Valid: "function f() { delete ({a:a}=1) }"
</span><del>-PASS Valid: "({a}=1)()"
</del><ins>+PASS Valid: "({a}=1)()" with TypeError
</ins><span class="cx"> PASS Valid: "function f() { ({a}=1)() }"
</span><del>-PASS Valid: "({a:a}=1)()"
</del><ins>+PASS Valid: "({a:a}=1)()" with TypeError
</ins><span class="cx"> PASS Valid: "function f() { ({a:a}=1)() }"
</span><del>-PASS Valid: "({a}=1)=1"
</del><ins>+PASS Valid: "({a}=1)=1" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { ({a}=1)=1 }"
</span><del>-PASS Valid: "({a:a}=1)=1"
</del><ins>+PASS Valid: "({a:a}=1)=1" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { ({a:a}=1)=1 }"
</span><del>-PASS Valid: "({a}=1=1)"
</del><ins>+PASS Valid: "({a}=1=1)" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { ({a}=1=1) }"
</span><del>-PASS Valid: "({a:a}=1=1)"
</del><ins>+PASS Valid: "({a:a}=1=1)" with ReferenceError
</ins><span class="cx"> PASS Valid: "function f() { ({a:a}=1=1) }"
</span><span class="cx"> PASS Invalid: "({get [x](){}})"
</span><span class="cx"> PASS Invalid: "function f() { ({get [x](){}}) }"
</span></span></pre></div>
<a id="trunkLayoutTestsjsscripttestsparsersyntaxcheckjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/script-tests/parser-syntax-check.js (170033 => 170034)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/script-tests/parser-syntax-check.js        2014-06-16 22:57:28 UTC (rev 170033)
+++ trunk/LayoutTests/js/script-tests/parser-syntax-check.js        2014-06-16 23:19:29 UTC (rev 170034)
</span><span class="lines">@@ -2,27 +2,32 @@
</span><span class="cx"> "This test checks that the following expressions or statements are valid ECMASCRIPT code or should throw parse error"
</span><span class="cx"> );
</span><span class="cx">
</span><del>-function runTest(_a, errorType)
</del><ins>+function runTest(_a, expectSyntaxError)
</ins><span class="cx"> {
</span><del>- var success;
</del><ins>+ var error;
+
</ins><span class="cx"> if (typeof _a != "string")
</span><span class="cx"> testFailed("runTest expects string argument: " + _a);
</span><span class="cx"> try {
</span><span class="cx"> eval(_a);
</span><del>- success = true;
</del><span class="cx"> } catch (e) {
</span><del>- success = !(e instanceof SyntaxError);
</del><ins>+ error = e;
</ins><span class="cx"> }
</span><del>- if ((!!errorType) == !success) {
- if (errorType)
</del><ins>+
+ if (expectSyntaxError) {
+ if (error && error instanceof SyntaxError)
</ins><span class="cx"> testPassed('Invalid: "' + _a + '"');
</span><ins>+ else if (error)
+ testFailed('Invalid: "' + _a + '" should throw SyntaxError but got ' + (error.name || error));
</ins><span class="cx"> else
</span><ins>+ testFailed('Invalid: "' + _a + '" but did not throw');
+ } else {
+ if (!error)
</ins><span class="cx"> testPassed('Valid: "' + _a + '"');
</span><del>- } else {
- if (errorType)
- testFailed('Invalid: "' + _a + '" should throw ' + errorType.name);
</del><ins>+ else if (!(error instanceof SyntaxError))
+ testPassed('Valid: "' + _a + '" with ' + (error.name || error));
</ins><span class="cx"> else
</span><del>- testFailed('Valid: "' + _a + '" should NOT throw ');
</del><ins>+ testFailed('Valid: "' + _a + '" should NOT throw but got ' + (error.name || error));
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -33,9 +38,8 @@
</span><span class="cx"> runTest("function f() { " + _a + " }", false);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-function invalid(_a, _type)
</del><ins>+function invalid(_a)
</ins><span class="cx"> {
</span><del>- _type = _type || SyntaxError;
</del><span class="cx"> // Test both the grammar and the syntax checker
</span><span class="cx"> runTest(_a, true);
</span><span class="cx"> runTest("function f() { " + _a + " }", true);
</span><span class="lines">@@ -366,6 +370,16 @@
</span><span class="cx"> valid("'use strict'; function __proto__(){}")
</span><span class="cx"> valid("'use strict'; (function __proto__(){})")
</span><span class="cx">
</span><ins>+valid("'use strict'; function f1(a) { function f2(b) { return b; } return f2(a); } f1(5);")
+valid("'use strict'; function f1(a) { function f2(b) { function f3(c) { return c; } return f3(b); } return f2(a); } f1(5);")
+invalid("'use strict'; function f1(a) { if (a) { function f2(b) { return b; } return f2(a); } else return a; } f1(5);")
+invalid("'use strict'; function f1(a) { function f2(b) { if (b) { function f3(c) { return c; } return f3(b); } else return b; } return f2(a); } f1(5);")
+
+valid("var str = \"'use strict'; function f1(a) { function f2(b) { return b; } return f2(a); } return f1(arguments[0]);\"; var foo = new Function(str); foo(5);")
+valid("var str = \"'use strict'; function f1(a) { function f2(b) { function f3(c) { return c; } return f3(b); } return f2(a); } return f1(arguments[0]);\"; var foo = new Function(str); foo(5);")
+invalid("var str = \"'use strict'; function f1(a) { if (a) { function f2(b) { return b; } return f2(a); } else return a; } return f1(arguments[0]);\"; var foo = new Function(str); foo(5);", SyntaxError, undefined)
+invalid("var str = \"'use strict'; function f1(a) { function f2(b) { if (b) { function f3(c) { return c; } return f3(b); } else return b; } return f2(a); } return f1(arguments[0]);\"; var foo = new Function(str); foo(5);", SyntaxError, undefined)
+
</ins><span class="cx"> valid("if (0) $foo; ")
</span><span class="cx"> valid("if (0) _foo; ")
</span><span class="cx"> valid("if (0) foo$; ")
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (170033 => 170034)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2014-06-16 22:57:28 UTC (rev 170033)
+++ trunk/Source/JavaScriptCore/ChangeLog        2014-06-16 23:19:29 UTC (rev 170034)
</span><span class="lines">@@ -1,3 +1,28 @@
</span><ins>+2014-06-16 Mark Lam <mark.lam@apple.com>
+
+ Parser statementDepth accounting needs to account for when a function body excludes its braces.
+ <https://webkit.org/b/133832>
+
+ Reviewed by Oliver Hunt.
+
+ In some cases (e.g. when a Function object is instantiated from a string), the
+ function body source may not include its braces. The parser needs to account
+ for this when calculating its statementDepth.
+
+ * bytecode/UnlinkedCodeBlock.cpp:
+ (JSC::generateFunctionCodeBlock):
+ (JSC::UnlinkedFunctionExecutable::codeBlockFor):
+ * bytecode/UnlinkedCodeBlock.h:
+ * parser/Parser.cpp:
+ (JSC::Parser<LexerType>::parseStatement):
+ - Also fixed the error message for declaring nested functions in strict mode
+ to be more accurate.
+ * parser/Parser.h:
+ (JSC::Parser<LexerType>::parse):
+ (JSC::parse):
+ * runtime/Executable.cpp:
+ (JSC::ScriptExecutable::newCodeBlockFor):
+
</ins><span class="cx"> 2014-06-16 Juergen Ributzka <juergen@apple.com>
</span><span class="cx">
</span><span class="cx"> Change the order of the alias analysis passes to align with the opt pipeline of LLVM
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeUnlinkedCodeBlockcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp (170033 => 170034)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp        2014-06-16 22:57:28 UTC (rev 170033)
+++ trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp        2014-06-16 23:19:29 UTC (rev 170034)
</span><span class="lines">@@ -49,9 +49,9 @@
</span><span class="cx"> const ClassInfo UnlinkedEvalCodeBlock::s_info = { "UnlinkedEvalCodeBlock", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(UnlinkedEvalCodeBlock) };
</span><span class="cx"> const ClassInfo UnlinkedFunctionCodeBlock::s_info = { "UnlinkedFunctionCodeBlock", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(UnlinkedFunctionCodeBlock) };
</span><span class="cx">
</span><del>-static UnlinkedFunctionCodeBlock* generateFunctionCodeBlock(VM& vm, UnlinkedFunctionExecutable* executable, const SourceCode& source, CodeSpecializationKind kind, DebuggerMode debuggerMode, ProfilerMode profilerMode, UnlinkedFunctionKind functionKind, ParserError& error)
</del><ins>+static UnlinkedFunctionCodeBlock* generateFunctionCodeBlock(VM& vm, UnlinkedFunctionExecutable* executable, const SourceCode& source, CodeSpecializationKind kind, DebuggerMode debuggerMode, ProfilerMode profilerMode, UnlinkedFunctionKind functionKind, bool bodyIncludesBraces, ParserError& error)
</ins><span class="cx"> {
</span><del>- RefPtr<FunctionBodyNode> body = parse<FunctionBodyNode>(&vm, source, executable->parameters(), executable->name(), executable->toStrictness(), JSParseFunctionCode, error);
</del><ins>+ RefPtr<FunctionBodyNode> body = parse<FunctionBodyNode>(&vm, source, executable->parameters(), executable->name(), executable->toStrictness(), JSParseFunctionCode, error, 0, bodyIncludesBraces);
</ins><span class="cx">
</span><span class="cx"> if (!body) {
</span><span class="cx"> ASSERT(error.m_type != ParserError::ErrorNone);
</span><span class="lines">@@ -152,7 +152,7 @@
</span><span class="cx"> return executable;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-UnlinkedFunctionCodeBlock* UnlinkedFunctionExecutable::codeBlockFor(VM& vm, const SourceCode& source, CodeSpecializationKind specializationKind, DebuggerMode debuggerMode, ProfilerMode profilerMode, ParserError& error)
</del><ins>+UnlinkedFunctionCodeBlock* UnlinkedFunctionExecutable::codeBlockFor(VM& vm, const SourceCode& source, CodeSpecializationKind specializationKind, DebuggerMode debuggerMode, ProfilerMode profilerMode, bool bodyIncludesBraces, ParserError& error)
</ins><span class="cx"> {
</span><span class="cx"> switch (specializationKind) {
</span><span class="cx"> case CodeForCall:
</span><span class="lines">@@ -165,7 +165,7 @@
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- UnlinkedFunctionCodeBlock* result = generateFunctionCodeBlock(vm, this, source, specializationKind, debuggerMode, profilerMode, isBuiltinFunction() ? UnlinkedBuiltinFunction : UnlinkedNormalFunction, error);
</del><ins>+ UnlinkedFunctionCodeBlock* result = generateFunctionCodeBlock(vm, this, source, specializationKind, debuggerMode, profilerMode, isBuiltinFunction() ? UnlinkedBuiltinFunction : UnlinkedNormalFunction, bodyIncludesBraces, error);
</ins><span class="cx">
</span><span class="cx"> if (error.m_type != ParserError::ErrorNone)
</span><span class="cx"> return 0;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeUnlinkedCodeBlockh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h (170033 => 170034)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h        2014-06-16 22:57:28 UTC (rev 170033)
+++ trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h        2014-06-16 23:19:29 UTC (rev 170034)
</span><span class="lines">@@ -128,7 +128,7 @@
</span><span class="cx">
</span><span class="cx"> String paramString() const;
</span><span class="cx">
</span><del>- UnlinkedFunctionCodeBlock* codeBlockFor(VM&, const SourceCode&, CodeSpecializationKind, DebuggerMode, ProfilerMode, ParserError&);
</del><ins>+ UnlinkedFunctionCodeBlock* codeBlockFor(VM&, const SourceCode&, CodeSpecializationKind, DebuggerMode, ProfilerMode, bool bodyIncludesBraces, ParserError&);
</ins><span class="cx">
</span><span class="cx"> static UnlinkedFunctionExecutable* fromGlobalCode(const Identifier&, ExecState*, Debugger*, const SourceCode&, JSObject** exception);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreparserParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/parser/Parser.cpp (170033 => 170034)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/parser/Parser.cpp        2014-06-16 22:57:28 UTC (rev 170033)
+++ trunk/Source/JavaScriptCore/parser/Parser.cpp        2014-06-16 23:19:29 UTC (rev 170034)
</span><span class="lines">@@ -1126,7 +1126,7 @@
</span><span class="cx"> case CONSTTOKEN:
</span><span class="cx"> return parseConstDeclaration(context);
</span><span class="cx"> case FUNCTION:
</span><del>- failIfFalseIfStrict(m_statementDepth == 1, "Nested functions cannot be declared in strict mode");
</del><ins>+ failIfFalseIfStrict(m_statementDepth == 1, "Strict mode does not allow function declarations in a lexically nested statement");
</ins><span class="cx"> return parseFunctionDeclaration(context);
</span><span class="cx"> case SEMICOLON: {
</span><span class="cx"> JSTokenLocation location(tokenLocation());
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreparserParserh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/parser/Parser.h (170033 => 170034)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/parser/Parser.h        2014-06-16 22:57:28 UTC (rev 170033)
+++ trunk/Source/JavaScriptCore/parser/Parser.h        2014-06-16 23:19:29 UTC (rev 170034)
</span><span class="lines">@@ -398,7 +398,7 @@
</span><span class="cx"> ~Parser();
</span><span class="cx">
</span><span class="cx"> template <class ParsedNode>
</span><del>- PassRefPtr<ParsedNode> parse(ParserError&);
</del><ins>+ PassRefPtr<ParsedNode> parse(ParserError&, bool needReparsingAdjustment);
</ins><span class="cx">
</span><span class="cx"> JSTextPosition positionBeforeLastNewline() const { return m_lexer->positionBeforeLastNewline(); }
</span><span class="cx"> const Vector<RefPtr<StringImpl>>&& closedVariables() { return std::move(m_closedVariables); }
</span><span class="lines">@@ -857,12 +857,12 @@
</span><span class="cx">
</span><span class="cx"> template <typename LexerType>
</span><span class="cx"> template <class ParsedNode>
</span><del>-PassRefPtr<ParsedNode> Parser<LexerType>::parse(ParserError& error)
</del><ins>+PassRefPtr<ParsedNode> Parser<LexerType>::parse(ParserError& error, bool needReparsingAdjustment)
</ins><span class="cx"> {
</span><span class="cx"> int errLine;
</span><span class="cx"> String errMsg;
</span><span class="cx">
</span><del>- if (ParsedNode::scopeIsFunction)
</del><ins>+ if (ParsedNode::scopeIsFunction && needReparsingAdjustment)
</ins><span class="cx"> m_lexer->setIsReparsing();
</span><span class="cx">
</span><span class="cx"> m_sourceElements = 0;
</span><span class="lines">@@ -937,14 +937,14 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> template <class ParsedNode>
</span><del>-PassRefPtr<ParsedNode> parse(VM* vm, const SourceCode& source, FunctionParameters* parameters, const Identifier& name, JSParserStrictness strictness, JSParserMode parserMode, ParserError& error, JSTextPosition* positionBeforeLastNewline = 0)
</del><ins>+PassRefPtr<ParsedNode> parse(VM* vm, const SourceCode& source, FunctionParameters* parameters, const Identifier& name, JSParserStrictness strictness, JSParserMode parserMode, ParserError& error, JSTextPosition* positionBeforeLastNewline = 0, bool needReparsingAdjustment = false)
</ins><span class="cx"> {
</span><span class="cx"> SamplingRegion samplingRegion("Parsing");
</span><span class="cx">
</span><span class="cx"> ASSERT(!source.provider()->source().isNull());
</span><span class="cx"> if (source.provider()->source().is8Bit()) {
</span><span class="cx"> Parser<Lexer<LChar>> parser(vm, source, parameters, name, strictness, parserMode);
</span><del>- RefPtr<ParsedNode> result = parser.parse<ParsedNode>(error);
</del><ins>+ RefPtr<ParsedNode> result = parser.parse<ParsedNode>(error, needReparsingAdjustment);
</ins><span class="cx"> if (positionBeforeLastNewline)
</span><span class="cx"> *positionBeforeLastNewline = parser.positionBeforeLastNewline();
</span><span class="cx"> if (strictness == JSParseBuiltin) {
</span><span class="lines">@@ -956,7 +956,7 @@
</span><span class="cx"> return result.release();
</span><span class="cx"> }
</span><span class="cx"> Parser<Lexer<UChar>> parser(vm, source, parameters, name, strictness, parserMode);
</span><del>- RefPtr<ParsedNode> result = parser.parse<ParsedNode>(error);
</del><ins>+ RefPtr<ParsedNode> result = parser.parse<ParsedNode>(error, needReparsingAdjustment);
</ins><span class="cx"> if (positionBeforeLastNewline)
</span><span class="cx"> *positionBeforeLastNewline = parser.positionBeforeLastNewline();
</span><span class="cx"> return result.release();
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeExecutablecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/Executable.cpp (170033 => 170034)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/Executable.cpp        2014-06-16 22:57:28 UTC (rev 170033)
+++ trunk/Source/JavaScriptCore/runtime/Executable.cpp        2014-06-16 23:19:29 UTC (rev 170034)
</span><span class="lines">@@ -223,7 +223,7 @@
</span><span class="cx"> ProfilerMode profilerMode = globalObject->hasProfiler() ? ProfilerOn : ProfilerOff;
</span><span class="cx"> UnlinkedFunctionCodeBlock* unlinkedCodeBlock =
</span><span class="cx"> executable->m_unlinkedExecutable->codeBlockFor(
</span><del>- *vm, executable->m_source, kind, debuggerMode, profilerMode, error);
</del><ins>+ *vm, executable->m_source, kind, debuggerMode, profilerMode, executable->bodyIncludesBraces(), error);
</ins><span class="cx"> recordParse(executable->m_unlinkedExecutable->features(), executable->m_unlinkedExecutable->hasCapturedVariables(), lineNo(), lastLine(), startColumn(), endColumn());
</span><span class="cx"> if (!unlinkedCodeBlock) {
</span><span class="cx"> exception = vm->throwException(
</span></span></pre>
</div>
</div>
</body>
</html>