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

Side by Side Diff: test/mjsunit/es6/block-eval-var-over-let.js

Issue 2112163002: Block-scoped functions in evals are now only conditionally hoisted out. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: more tests Created 4 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
« no previous file with comments | « src/parsing/parser.cc ('k') | test/mjsunit/es6/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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Var-let conflict in a function throws, even if the var is in an eval 5 // Var-let conflict in a function throws, even if the var is in an eval
6 6
7 // Throws at the top level of a function 7 // Throws at the top level of a function
8 assertThrows(function() { 8 assertThrows(function() {
9 let x = 1; 9 let x = 1;
10 eval('var x'); 10 eval('var x');
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 { 117 {
118 let x = 1; 118 let x = 1;
119 eval('function x() {}'); 119 eval('function x() {}');
120 } 120 }
121 })(); 121 })();
122 } catch (e) { 122 } catch (e) {
123 caught = true; 123 caught = true;
124 } 124 }
125 assertTrue(caught); 125 assertTrue(caught);
126 126
127 // TODO(littledan): Hoisting x out of the block should be
128 // prevented in this case BUG(v8:4479)
129 caught = false 127 caught = false
130 try { 128 try {
131 (function() { 129 (function() {
132 { 130 {
133 let x = 1; 131 let x = 1;
134 eval('{ function x() {} }'); 132 eval('{ function x() {} }');
135 } 133 }
136 })(); 134 })();
137 } catch (e) { 135 } catch (e) {
138 caught = true; 136 caught = true;
139 } 137 }
140 // TODO(littledan): switch to assertTrue when bug is fixed 138 assertFalse(caught);
141 assertTrue(caught);
OLDNEW
« no previous file with comments | « src/parsing/parser.cc ('k') | test/mjsunit/es6/block-sloppy-function.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698