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

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

Issue 1274193004: Let eval scope (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Changes for code review Created 5 years, 4 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/scopes.h ('k') | test/webkit/class-syntax-name.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 // 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 // Test for conflicting variable bindings. 5 // Test for conflicting variable bindings.
6 6
7 // Flags: --no-legacy-const --harmony-sloppy --harmony-sloppy-let 7 // Flags: --no-legacy-const --harmony-sloppy --harmony-sloppy-let
8 8
9 function CheckException(e) { 9 function CheckException(e) {
10 var string = e.toString(); 10 var string = e.toString();
(...skipping 26 matching lines...) Expand all
37 return eval("(function(){ {" + s + "} return " + e + "})")(); 37 return eval("(function(){ {" + s + "} return " + e + "})")();
38 } catch (x) { 38 } catch (x) {
39 return CheckException(x); 39 return CheckException(x);
40 } 40 }
41 } 41 }
42 42
43 function TestAll(expected,s,opt_e) { 43 function TestAll(expected,s,opt_e) {
44 var e = ""; 44 var e = "";
45 var msg = s; 45 var msg = s;
46 if (opt_e) { e = opt_e; msg += opt_e; } 46 if (opt_e) { e = opt_e; msg += opt_e; }
47 // TODO(littledan): https://code.google.com/p/v8/issues/detail?id=4288
48 // It is also not clear whether these tests makes sense in sloppy mode.
49 // TODO(littledan): Add tests using Realm.eval to ensure that global eval 47 // TODO(littledan): Add tests using Realm.eval to ensure that global eval
50 // works as expected. 48 // works as expected.
51 // assertEquals(expected === 'LocalConflict' ? 'NoConflict' : expected, 49 assertEquals(expected === 'LocalConflict' ? 'NoConflict' : expected,
52 // TestGlobal(s,e), "global:'" + msg + "'"); 50 TestGlobal(s,e), "global:'" + msg + "'");
53 assertEquals(expected === 'LocalConflict' ? 'NoConflict' : expected, 51 assertEquals(expected === 'LocalConflict' ? 'NoConflict' : expected,
54 TestFunction(s,e), "function:'" + msg + "'"); 52 TestFunction(s,e), "function:'" + msg + "'");
55 assertEquals(expected === 'LocalConflict' ? 'Conflict' : expected, 53 assertEquals(expected === 'LocalConflict' ? 'Conflict' : expected,
56 TestBlock(s,e), "block:'" + msg + "'"); 54 TestBlock(s,e), "block:'" + msg + "'");
57 } 55 }
58 56
59 57
60 function TestConflict(s) { 58 function TestConflict(s) {
61 TestAll('Conflict', s); 59 TestAll('Conflict', s);
62 // TODO(littledan): https://code.google.com/p/v8/issues/detail?id=4288 60 TestAll('Conflict', 'eval("' + s + '");');
63 // It is also not clear whether these tests makes sense in sloppy mode.
64 // TestAll('Conflict', 'eval("' + s + '");');
65 } 61 }
66 62
67 function TestNoConflict(s) { 63 function TestNoConflict(s) {
68 TestAll('NoConflict', s, "'NoConflict'"); 64 TestAll('NoConflict', s, "'NoConflict'");
69 // TODO(littledan): https://code.google.com/p/v8/issues/detail?id=4288 65 TestAll('NoConflict', 'eval("' + s + '");', "'NoConflict'");
70 // TestAll('NoConflict', 'eval("' + s + '");', "'NoConflict'");
71 } 66 }
72 67
73 function TestLocalConflict(s) { 68 function TestLocalConflict(s) {
74 TestAll('LocalConflict', s, "'NoConflict'"); 69 TestAll('LocalConflict', s, "'NoConflict'");
75 // TODO(littledan): https://code.google.com/p/v8/issues/detail?id=4288 70 TestAll('NoConflict', 'eval("' + s + '");', "'NoConflict'");
76 // It is also not clear whether these tests makes sense in sloppy mode.
77 // TestAll('NoConflict', 'eval("' + s + '");', "'NoConflict'");
78 } 71 }
79 72
80 var letbinds = [ "let x;", 73 var letbinds = [ "let x;",
81 "let x = 0;", 74 "let x = 0;",
82 "let x = undefined;", 75 "let x = undefined;",
83 "let x = function() {};", 76 "let x = function() {};",
84 "let x, y;", 77 "let x, y;",
85 "let y, x;", 78 "let y, x;",
86 "const x = 0;", 79 "const x = 0;",
87 "const x = undefined;", 80 "const x = undefined;",
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 // Test conflicting parameter/var bindings. 158 // Test conflicting parameter/var bindings.
166 for (var v = 0; v < varbinds.length; ++v) { 159 for (var v = 0; v < varbinds.length; ++v) {
167 TestNoConflict('(function (x) {' + varbinds[v] + '})();'); 160 TestNoConflict('(function (x) {' + varbinds[v] + '})();');
168 } 161 }
169 162
170 // Test conflicting catch/function bindings. 163 // Test conflicting catch/function bindings.
171 TestNoConflict('try {} catch(x) {' + funbind + '}'); 164 TestNoConflict('try {} catch(x) {' + funbind + '}');
172 165
173 // Test conflicting parameter/function bindings. 166 // Test conflicting parameter/function bindings.
174 TestNoConflict('(function (x) {' + funbind + '})();'); 167 TestNoConflict('(function (x) {' + funbind + '})();');
OLDNEW
« no previous file with comments | « src/scopes.h ('k') | test/webkit/class-syntax-name.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698