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

Side by Side Diff: test/mjsunit/harmony/destructuring.js

Issue 1278783002: [es6] Use strict arguments objects for destructured parameters (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Doh 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.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 5 // Flags: --harmony-destructuring
6 // Flags: --harmony-arrow-functions --harmony-rest-parameters 6 // Flags: --harmony-arrow-functions --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 900 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 function ok2(x) { 'use strict'; { let x = 2; return x; } }; 911 function ok2(x) { 'use strict'; { let x = 2; return x; } };
912 assertEquals(2, ok2(1)); 912 assertEquals(2, ok2(1));
913 913
914 assertThrows("function f({x}) { var x; }; f({});", SyntaxError); 914 assertThrows("function f({x}) { var x; }; f({});", SyntaxError);
915 assertThrows("function f({x}) { { var x; } }; f({});", SyntaxError); 915 assertThrows("function f({x}) { { var x; } }; f({});", SyntaxError);
916 assertThrows("'use strict'; function f(x) { let x = 0; }; f({});", SyntaxError ); 916 assertThrows("'use strict'; function f(x) { let x = 0; }; f({});", SyntaxError );
917 assertThrows("'use strict'; function f({x}) { let x = 0; }; f({});", SyntaxErr or); 917 assertThrows("'use strict'; function f({x}) { let x = 0; }; f({});", SyntaxErr or);
918 }()); 918 }());
919 919
920 920
921 (function TestArgumentsForNonSimpleParameters() {
922 function f1({}, x) { arguments[1] = 0; return x }
923 assertEquals(6, f1({}, 6));
924 function f2({}, x) { x = 2; return arguments[1] }
925 assertEquals(7, f2({}, 7));
926 function f3(x, {}) { arguments[0] = 0; return x }
927 assertEquals(6, f3(6, {}));
928 function f4(x, {}) { x = 2; return arguments[0] }
929 assertEquals(7, f4(7, {}));
930 function f5(x, ...a) { arguments[0] = 0; return x }
931 assertEquals(6, f5(6, {}));
932 function f6(x, ...a) { x = 2; return arguments[0] }
933 assertEquals(6, f6(6, {}));
934 function f7({a: x}) { x = 2; return arguments[0].a }
935 assertEquals(5, f7({a: 5}));
936 function f8(x, ...a) { a = []; return arguments[1] }
937 assertEquals(6, f8(5, 6));
938 // TODO(caitp, rossberg): add cases for default parameters.
939 }());
940
941
921 (function TestForInOfTDZ() { 942 (function TestForInOfTDZ() {
922 assertThrows("'use strict'; let x = {}; for (let [x, y] of {x});", ReferenceEr ror); 943 assertThrows("'use strict'; let x = {}; for (let [x, y] of {x});", ReferenceEr ror);
923 assertThrows("'use strict'; let x = {}; for (let [y, x] of {x});", ReferenceEr ror); 944 assertThrows("'use strict'; let x = {}; for (let [y, x] of {x});", ReferenceEr ror);
924 assertThrows("'use strict'; let x = {}; for (let [x, y] in {x});", ReferenceEr ror); 945 assertThrows("'use strict'; let x = {}; for (let [x, y] in {x});", ReferenceEr ror);
925 assertThrows("'use strict'; let x = {}; for (let [y, x] in {x});", ReferenceEr ror); 946 assertThrows("'use strict'; let x = {}; for (let [y, x] in {x});", ReferenceEr ror);
926 }()); 947 }());
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