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

Side by Side Diff: test/mjsunit/harmony/computed-property-names-classes.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/classes.js ('k') | test/mjsunit/harmony/object-literals-method.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 'use strict'; 5 'use strict';
6 6
7 // Flags: --harmony-computed-property-names --harmony-classes 7 // Flags: --harmony-computed-property-names --harmony-classes
8 8
9 9
10 function ID(x) { 10 function ID(x) {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 static ['d']() { return 'D'; } 76 static ['d']() { return 'D'; }
77 } 77 }
78 assertEquals('A', C.a()); 78 assertEquals('A', C.a());
79 assertEquals('B', C.b()); 79 assertEquals('B', C.b());
80 assertEquals('C', C.c()); 80 assertEquals('C', C.c());
81 assertEquals('D', C.d()); 81 assertEquals('D', C.d());
82 assertArrayEquals([], Object.keys(C)); 82 assertArrayEquals([], Object.keys(C));
83 // TODO(arv): It is not clear that we are adding the "standard" properties 83 // TODO(arv): It is not clear that we are adding the "standard" properties
84 // in the right order. As far as I can tell the spec adds them in alphabetical 84 // in the right order. As far as I can tell the spec adds them in alphabetical
85 // order. 85 // order.
86 assertArrayEquals(['length', 'name', 'arguments', 'caller', 'prototype', 86 assertArrayEquals(['length', 'name', 'prototype', 'a', 'b', 'c', 'd'],
87 'a', 'b', 'c', 'd'], 87 Object.getOwnPropertyNames(C));
88 Object.getOwnPropertyNames(C));
89 })(); 88 })();
90 89
91 90
92 (function TestStaticClassMethodNumber() { 91 (function TestStaticClassMethodNumber() {
93 class C { 92 class C {
94 static a() { return 'A'; } 93 static a() { return 'A'; }
95 static [1]() { return 'B'; } 94 static [1]() { return 'B'; }
96 static c() { return 'C'; } 95 static c() { return 'C'; }
97 static [2]() { return 'D'; } 96 static [2]() { return 'D'; }
98 } 97 }
99 assertEquals('A', C.a()); 98 assertEquals('A', C.a());
100 assertEquals('B', C[1]()); 99 assertEquals('B', C[1]());
101 assertEquals('C', C.c()); 100 assertEquals('C', C.c());
102 assertEquals('D', C[2]()); 101 assertEquals('D', C[2]());
103 // Array indexes first. 102 // Array indexes first.
104 assertArrayEquals([], Object.keys(C)); 103 assertArrayEquals([], Object.keys(C));
105 assertArrayEquals(['1', '2', 'length', 'name', 'arguments', 'caller', 104 assertArrayEquals(['1', '2', 'length', 'name', 'prototype', 'a', 'c'],
106 'prototype', 'a', 'c'], Object.getOwnPropertyNames(C)); 105 Object.getOwnPropertyNames(C));
107 })(); 106 })();
108 107
109 108
110 (function TestStaticClassMethodSymbol() { 109 (function TestStaticClassMethodSymbol() {
111 var sym1 = Symbol(); 110 var sym1 = Symbol();
112 var sym2 = Symbol(); 111 var sym2 = Symbol();
113 class C { 112 class C {
114 static a() { return 'A'; } 113 static a() { return 'A'; }
115 static [sym1]() { return 'B'; } 114 static [sym1]() { return 'B'; }
116 static c() { return 'C'; } 115 static c() { return 'C'; }
117 static [sym2]() { return 'D'; } 116 static [sym2]() { return 'D'; }
118 } 117 }
119 assertEquals('A', C.a()); 118 assertEquals('A', C.a());
120 assertEquals('B', C[sym1]()); 119 assertEquals('B', C[sym1]());
121 assertEquals('C', C.c()); 120 assertEquals('C', C.c());
122 assertEquals('D', C[sym2]()); 121 assertEquals('D', C[sym2]());
123 assertArrayEquals([], Object.keys(C)); 122 assertArrayEquals([], Object.keys(C));
124 assertArrayEquals(['length', 'name', 'arguments', 'caller', 'prototype', 123 assertArrayEquals(['length', 'name', 'prototype', 'a', 'c'],
125 'a', 'c'], 124 Object.getOwnPropertyNames(C));
126 Object.getOwnPropertyNames(C));
127 assertArrayEquals([sym1, sym2], Object.getOwnPropertySymbols(C)); 125 assertArrayEquals([sym1, sym2], Object.getOwnPropertySymbols(C));
128 })(); 126 })();
129 127
130 128
131 129
132 function assertIteratorResult(value, done, result) { 130 function assertIteratorResult(value, done, result) {
133 assertEquals({ value: value, done: done}, result); 131 assertEquals({ value: value, done: done}, result);
134 } 132 }
135 133
136 134
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 class C { 454 class C {
457 get [C]() { return 42; } 455 get [C]() { return 42; }
458 } 456 }
459 }, ReferenceError); 457 }, ReferenceError);
460 assertThrows(function() { 458 assertThrows(function() {
461 class C { 459 class C {
462 set [C](_) { } 460 set [C](_) { }
463 } 461 }
464 }, ReferenceError); 462 }, ReferenceError);
465 })(); 463 })();
OLDNEW
« no previous file with comments | « test/mjsunit/harmony/classes.js ('k') | test/mjsunit/harmony/object-literals-method.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698