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

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

Issue 2567343004: [parser] Fix bug with non-static name method/property (Closed)
Patch Set: Created 4 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
« no previous file with comments | « src/parsing/parser-base.h ('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 (function testVariableDeclarationsFunction() { 5 (function testVariableDeclarationsFunction() {
6 'use strict'; 6 'use strict';
7 var a = function(){}; 7 var a = function(){};
8 assertEquals('a', a.name); 8 assertEquals('a', a.name);
9 let b = () => {}; 9 let b = () => {};
10 assertEquals('b', b.name); 10 assertEquals('b', b.name);
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 379
380 class A { } 380 class A { }
381 assertEquals(['length', 'prototype', 'name'], Object.getOwnPropertyNames(A)); 381 assertEquals(['length', 'prototype', 'name'], Object.getOwnPropertyNames(A));
382 382
383 class B { static foo() { } } 383 class B { static foo() { } }
384 assertEquals(['length', 'prototype', 'foo', 'name'], Object.getOwnPropertyName s(B)); 384 assertEquals(['length', 'prototype', 'foo', 'name'], Object.getOwnPropertyName s(B));
385 385
386 class C { static name() { } static foo() { } } 386 class C { static name() { } static foo() { } }
387 assertEquals(['length', 'prototype', 'name', 'foo'], Object.getOwnPropertyName s(C)); 387 assertEquals(['length', 'prototype', 'name', 'foo'], Object.getOwnPropertyName s(C));
388 })(); 388 })();
389
nickie 2016/12/13 22:14:44 Guys, please check that these two sets of tests ac
390 (function testStaticName() {
391 class C { static name() { return 42; } }
392 assertEquals(42, C.name());
393 assertEquals(undefined, new C().name);
394
395 class D { static get name() { return 17; } }
396 assertEquals(17, D.name);
397 assertEquals(undefined, new D().name);
398
399 var c = class { static name() { return 42; } }
400 assertEquals(42, c.name());
401 assertEquals(undefined, new c().name);
402
403 var d = class { static get name() { return 17; } }
404 assertEquals(17, d.name);
405 assertEquals(undefined, new d().name);
406 })();
407
408 (function testNonStaticName() {
409 class C { name() { return 42; } }
410 assertEquals('C', C.name);
411 assertEquals(42, new C().name());
412
413 class D { get name() { return 17; } }
414 assertEquals('D', D.name);
415 assertEquals(17, new D().name);
416
417 var c = class { name() { return 42; } }
418 assertEquals('c', c.name);
419 assertEquals(42, new c().name());
420
421 var d = class { get name() { return 17; } }
422 assertEquals('d', d.name);
423 assertEquals(17, new d().name);
424 })();
OLDNEW
« no previous file with comments | « src/parsing/parser-base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698