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

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

Issue 1332873003: Implement sloppy-mode block-defined functions (Annex B 3.3) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Improve type clarity Created 5 years, 3 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
« no previous file with comments | « src/typing-asm.cc ('k') | test/mjsunit/harmony/block-sloppy-function.js » ('j') | 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 120
121 assertEquals(3, g2()); 121 assertEquals(3, g2());
122 assertEquals(3, eval("g2()")); 122 assertEquals(3, eval("g2()"));
123 // function scoped function declaration 123 // function scoped function declaration
124 function g2() { 124 function g2() {
125 return 3; 125 return 3;
126 } 126 }
127 } 127 }
128 f(); 128 f();
129 129
130 // Test that a function declaration introduces a block scoped variable. 130 // Test that a function declaration introduces a block scoped variable
131 TestAll('{ function k() { return 0; } }; k(); '); 131 // and no function hoisting if there is a conflict.
132 TestFunctionLocal('{ function k() { return 0; } }; k(); let k;');
132 133
133 // Test that a function declaration sees the scope it resides in. 134 // Test that a function declaration sees the scope it resides in.
134 function f2() { 135 function f2() {
135 let m, n, o, p; 136 let m, n, o, p;
136 { 137 {
137 m = g; 138 m = g;
138 function g() { 139 function g() {
139 return a; 140 return a;
140 } 141 }
141 let a = 1; 142 let a = 1;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 } 184 }
184 eval("1 + 1"); 185 eval("1 + 1");
185 return x + inner(); 186 return x + inner();
186 } 187 }
187 188
188 let x = 1; 189 let x = 1;
189 return middle(); 190 return middle();
190 } 191 }
191 192
192 assertEquals(2, outer()); 193 assertEquals(2, outer());
OLDNEW
« no previous file with comments | « src/typing-asm.cc ('k') | test/mjsunit/harmony/block-sloppy-function.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698