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/harmony/destructuring.js

Issue 1308123007: [es6] conditionally ignore TDZ semantics for formals (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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/scopes.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 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 // Flags: --harmony-destructuring --harmony-arrow-functions 5 // Flags: --harmony-destructuring --harmony-arrow-functions
6 // Flags: --harmony-default-parameters --harmony-rest-parameters 6 // Flags: --harmony-default-parameters --harmony-rest-parameters
7 7
8 (function TestObjectLiteralPattern() { 8 (function TestObjectLiteralPattern() {
9 var { x : x, y : y } = { x : 1, y : 2 }; 9 var { x : x, y : y } = { x : 1, y : 2 };
10 assertEquals(1, x); 10 assertEquals(1, x);
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after
949 assertThrows("'use strict';function f(x, {x}){}", SyntaxError); 949 assertThrows("'use strict';function f(x, {x}){}", SyntaxError);
950 assertThrows("'use strict';var f = (x,x) => {};", SyntaxError); 950 assertThrows("'use strict';var f = (x,x) => {};", SyntaxError);
951 assertThrows("'use strict';var f = ({x,x}) => {};", SyntaxError); 951 assertThrows("'use strict';var f = ({x,x}) => {};", SyntaxError);
952 assertThrows("'use strict';var f = (x, {x}) => {};", SyntaxError); 952 assertThrows("'use strict';var f = (x, {x}) => {};", SyntaxError);
953 953
954 function ok1(x) { var x; return x; }; 954 function ok1(x) { var x; return x; };
955 assertEquals(1, ok1(1)); 955 assertEquals(1, ok1(1));
956 function ok2(x) { 'use strict'; { let x = 2; return x; } }; 956 function ok2(x) { 'use strict'; { let x = 2; return x; } };
957 assertEquals(2, ok2(1)); 957 assertEquals(2, ok2(1));
958 958
959 assertThrows("function f({x}) { var x; }; f({});", SyntaxError); 959 assertDoesNotThrow("function f({x}) { var x; }; f({});");
adamk 2015/09/09 00:07:02 So this is no longer an error, but yet function f
caitp (gmail) 2015/09/09 00:24:48 That's a known issue. I have two plans to fix it.
960 assertThrows("function f({x}) { { var x; } }; f({});", SyntaxError); 960 assertDoesNotThrow("function f({x}) { { var x; } }; f({});");
961 assertDoesNotThrow("'use strict'; function f({x}) { var x; }; f({});");
962 assertDoesNotThrow("'use strict'; function f({x}) { { var x; } }; f({});");
961 assertThrows("'use strict'; function f(x) { let x = 0; }; f({});", SyntaxError ); 963 assertThrows("'use strict'; function f(x) { let x = 0; }; f({});", SyntaxError );
962 assertThrows("'use strict'; function f({x}) { let x = 0; }; f({});", SyntaxErr or); 964 assertThrows("'use strict'; function f({x}) { let x = 0; }; f({});", SyntaxErr or);
963 }()); 965 }());
964 966
965 967
966 (function TestArgumentsForNonSimpleParameters() { 968 (function TestArgumentsForNonSimpleParameters() {
967 function f1({}, x) { arguments[1] = 0; return x } 969 function f1({}, x) { arguments[1] = 0; return x }
968 assertEquals(6, f1({}, 6)); 970 assertEquals(6, f1({}, 6));
969 function f2({}, x) { x = 2; return arguments[1] } 971 function f2({}, x) { x = 2; return arguments[1] }
970 assertEquals(7, f2({}, 7)); 972 assertEquals(7, f2({}, 7));
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 assertThrows(function(){ eval("({}) => {'use strict';}") }, SyntaxError); 1016 assertThrows(function(){ eval("({}) => {'use strict';}") }, SyntaxError);
1015 assertThrows( 1017 assertThrows(
1016 function(){ eval("(class{foo({}) {'use strict';}});") }, SyntaxError); 1018 function(){ eval("(class{foo({}) {'use strict';}});") }, SyntaxError);
1017 1019
1018 assertThrows( 1020 assertThrows(
1019 function(){ eval("function(a, {}){'use strict';}") }, SyntaxError); 1021 function(){ eval("function(a, {}){'use strict';}") }, SyntaxError);
1020 assertThrows(function(){ eval("(a, {}) => {'use strict';}") }, SyntaxError); 1022 assertThrows(function(){ eval("(a, {}) => {'use strict';}") }, SyntaxError);
1021 assertThrows( 1023 assertThrows(
1022 function(){ eval("(class{foo(a, {}) {'use strict';}});") }, SyntaxError); 1024 function(){ eval("(class{foo(a, {}) {'use strict';}});") }, SyntaxError);
1023 })(); 1025 })();
OLDNEW
« no previous file with comments | « src/scopes.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698