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

Side by Side Diff: test/mjsunit/harmony/function-name.js

Issue 1518873004: [es6] Support Function name inference in variable declarations (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4 //
5 // Flags: --harmony-function-name
6
7 (function testVariableDeclarationsFunction() {
8 'use strict';
9 var a = function(){};
10 assertEquals('a', a.name);
11 let b = () => {};
12 assertEquals('b', b.name);
13 const c = ((function(){}));
14 assertEquals('c', c.name);
15
16 var x = function(){}, y = () => {}, z = function withName() {};
17 assertEquals('x', x.name);
18 assertEquals('y', y.name);
19 assertEquals('withName', z.name);
20 })();
21
22 (function testVariableDeclarationsClass() {
23 'use strict';
24 var a = class {};
25 assertEquals('a', a.name);
26 let b = ((class {}));
27 assertEquals('b', b.name);
28 // Should not overwrite name property.
29 const c = class { static name() { } }
30 assertEquals('function', typeof c.name);
31
32 var x = class {}, y = class NamedClass {};
33 assertEquals('x', x.name);
34 assertEquals('NamedClass', y.name);
35 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698