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

Side by Side Diff: test/mjsunit/harmony/object-literals-method.js

Issue 1027283004: [es6] do not add caller/arguments to ES6 function definitions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 5 years, 8 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 | « test/mjsunit/harmony/computed-property-names-classes.js ('k') | test/mjsunit/strict-mode.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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-object-literals --allow-natives-syntax 5 // Flags: --harmony-object-literals --allow-natives-syntax
6 6
7 7
8 (function TestBasics() { 8 (function TestBasics() {
9 var object = { 9 var object = {
10 method() { 10 method() {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 }; 97 };
98 var f = object.method; 98 var f = object.method;
99 assertFalse(f.hasOwnProperty('prototype')); 99 assertFalse(f.hasOwnProperty('prototype'));
100 assertEquals(undefined, f.prototype); 100 assertEquals(undefined, f.prototype);
101 101
102 f.prototype = 42; 102 f.prototype = 42;
103 assertEquals(42, f.prototype); 103 assertEquals(42, f.prototype);
104 })(); 104 })();
105 105
106 106
107 (function TestNoRestrictedPropertiesStrict() {
108 var obj = {
109 method() { "use strict"; }
110 };
111 assertFalse(obj.method.hasOwnProperty("arguments"));
112 assertThrows(function() { return obj.method.arguments; }, TypeError);
113 assertThrows(function() { obj.method.arguments = {}; }, TypeError);
114
115 assertFalse(obj.method.hasOwnProperty("caller"));
116 assertThrows(function() { return obj.method.caller; }, TypeError);
117 assertThrows(function() { obj.method.caller = {}; }, TypeError);
118 })();
119
120
121 (function TestNoRestrictedPropertiesSloppy() {
122 var obj = {
123 method() {}
124 };
125 assertFalse(obj.method.hasOwnProperty("arguments"));
126 assertThrows(function() { return obj.method.arguments; }, TypeError);
127 assertThrows(function() { obj.method.arguments = {}; }, TypeError);
128
129 assertFalse(obj.method.hasOwnProperty("caller"));
130 assertThrows(function() { return obj.method.caller; }, TypeError);
131 assertThrows(function() { obj.method.caller = {}; }, TypeError);
132 })();
133
134
107 (function TestToString() { 135 (function TestToString() {
108 var object = { 136 var object = {
109 method() { 42; } 137 method() { 42; }
110 }; 138 };
111 assertEquals('method() { 42; }', object.method.toString()); 139 assertEquals('method() { 42; }', object.method.toString());
112 })(); 140 })();
113 141
114 142
115 (function TestOptimized() { 143 (function TestOptimized() {
116 var object = { 144 var object = {
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 var p = {}; 291 var p = {};
264 var object = { 292 var object = {
265 __proto__() { 293 __proto__() {
266 return 1; 294 return 1;
267 }, 295 },
268 __proto__: p 296 __proto__: p
269 }; 297 };
270 assertEquals(p, Object.getPrototypeOf(object)); 298 assertEquals(p, Object.getPrototypeOf(object));
271 assertEquals(1, object.__proto__()); 299 assertEquals(1, object.__proto__());
272 })(); 300 })();
OLDNEW
« no previous file with comments | « test/mjsunit/harmony/computed-property-names-classes.js ('k') | test/mjsunit/strict-mode.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698