OLD | NEW |
---|---|
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-function-name | 5 // Flags: --harmony-function-name |
6 | 6 |
7 (function testVariableDeclarationsFunction() { | 7 (function testVariableDeclarationsFunction() { |
8 'use strict'; | 8 'use strict'; |
9 var a = function(){}; | 9 var a = function(){}; |
10 assertEquals('a', a.name); | 10 assertEquals('a', a.name); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
113 static [sym2]() { } | 113 static [sym2]() { } |
114 } | 114 } |
115 | 115 |
116 // Should be 'a' | 116 // Should be 'a' |
117 assertEquals('', C.prototype[a].name); | 117 assertEquals('', C.prototype[a].name); |
118 // Should be '[1]' | 118 // Should be '[1]' |
119 assertEquals('', C.prototype[sym1].name); | 119 assertEquals('', C.prototype[sym1].name); |
120 // Should be '[2]' | 120 // Should be '[2]' |
121 assertEquals('', C[sym2].name); | 121 assertEquals('', C[sym2].name); |
122 })(); | 122 })(); |
123 | |
124 | |
125 (function testAssignment() { | |
126 var basicFn, arrowFn, generatorFn, classLit; | |
127 | |
128 basicFn = function() { return true; }; | |
adamk
2016/01/13 22:45:09
Please also add a case where the function has a na
caitp (gmail)
2016/01/13 22:53:46
Done.
| |
129 assertEquals('basicFn', basicFn.name); | |
130 var basicFn2 = basicFn; | |
131 assertEquals('basicFn', basicFn2.name); | |
132 | |
133 arrowFn = x => x; | |
134 assertEquals('arrowFn', arrowFn.name); | |
135 var arrowFn2 = arrowFn; | |
136 assertEquals('arrowFn', arrowFn2.name); | |
137 | |
138 generatorFn = function*() { yield true; }; | |
139 assertEquals('generatorFn', generatorFn.name); | |
140 var generatorFn2 = generatorFn; | |
141 assertEquals('generatorFn', generatorFn2.name); | |
142 | |
143 classLit = class { constructor() {} }; | |
adamk
2016/01/13 22:45:09
Can you also add a case where the class is named,
caitp (gmail)
2016/01/13 22:53:46
Done.
| |
144 assertEquals('classLit', classLit.name); | |
145 var classLit2 = classLit; | |
146 assertEquals('classLit', classLit2.name); | |
147 })(); | |
OLD | NEW |