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

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

Issue 1234433002: [es6] Sloppy functions in block (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add more tests and discover we do report wrong error Created 5 years, 5 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
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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 116
117 assertEquals(3, g2()); 117 assertEquals(3, g2());
118 assertEquals(3, eval("g2()")); 118 assertEquals(3, eval("g2()"));
119 // function scoped function declaration 119 // function scoped function declaration
120 function g2() { 120 function g2() {
121 return 3; 121 return 3;
122 } 122 }
123 } 123 }
124 f(); 124 f();
125 125
126 // Test that a function declaration introduces a block scoped variable.
127 TestAll('{ function k() { return 0; } }; k(); ');
128
129 // Test that a function declaration sees the scope it resides in. 126 // Test that a function declaration sees the scope it resides in.
130 function f2() { 127 function f2() {
131 let m, n, o, p; 128 let m, n, o, p;
132 { 129 {
133 m = g; 130 m = g;
134 function g() { 131 function g() {
135 return a; 132 return a;
136 } 133 }
137 let a = 1; 134 let a = 1;
138 } 135 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 } 176 }
180 eval("1 + 1"); 177 eval("1 + 1");
181 return x + inner(); 178 return x + inner();
182 } 179 }
183 180
184 let x = 1; 181 let x = 1;
185 return middle(); 182 return middle();
186 } 183 }
187 184
188 assertEquals(2, outer()); 185 assertEquals(2, outer());
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698