Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Side by Side Diff: test/mjsunit/harmony/block-let-declaration.js

Issue 8306025: Disallow function declarations in statement positions in harmony mode. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« src/parser.cc ('K') | « src/parser.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 "use strict"; 86 "use strict";
87 // Strict source element positions. 87 // Strict source element positions.
88 function h() { } 88 function h() { }
89 { 89 {
90 function h1() { } 90 function h1() { }
91 } 91 }
92 } 92 }
93 { 93 {
94 function g1() { } 94 function g1() { }
95 } 95 }
96 // Non-strict statement positions.
97 if (true) function g2() { }
98 if (true) {} else function g3() { }
99 do function g4() { } while (false)
100 while (false) function g5() { }
101 label: function g6() { }
102 for (;false;) function g7() { }
103 switch (true) { case true: function g8() { } }
104 switch (true) { default: function g9() { } }
105 } 96 }
106 f(); 97 f();
107 98
108 // Test function declarations in statement position in strict mode. 99 // Test function declarations in statement position in strict mode.
109 TestLocalThrows("function f() { 'use strict'; if (true) function g() {}", Syntax Error); 100 TestLocalThrows("function f() { if (true) function g() {}", SyntaxError);
110 TestLocalThrows("function f() { 'use strict'; if (true) {} else function g() {}" , SyntaxError); 101 TestLocalThrows("function f() { if (true) {} else function g() {}", SyntaxError) ;
111 TestLocalThrows("function f() { 'use strict'; do function g() {} while (false)", SyntaxError); 102 TestLocalThrows("function f() { do function g() {} while (false)", SyntaxError);
112 TestLocalThrows("function f() { 'use strict'; while (false) function g() {}", Sy ntaxError); 103 TestLocalThrows("function f() { while (false) function g() {}", SyntaxError);
113 TestLocalThrows("function f() { 'use strict'; label: function g() {}", SyntaxErr or); 104 TestLocalThrows("function f() { label: function g() {}", SyntaxError);
114 TestLocalThrows("function f() { 'use strict'; for (;false;) function g() {}", Sy ntaxError); 105 TestLocalThrows("function f() { for (;false;) function g() {}", SyntaxError);
115 TestLocalThrows("function f() { 'use strict'; switch (true) { case true: functio n g() {} }", SyntaxError); 106 TestLocalThrows("function f() { switch (true) { case true: function g() {} }", S yntaxError);
116 TestLocalThrows("function f() { 'use strict'; switch (true) { default: function g() {} }", SyntaxError); 107 TestLocalThrows("function f() { switch (true) { default: function g() {} }", Syn taxError);
OLDNEW
« src/parser.cc ('K') | « src/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698