Chromium Code Reviews| 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 (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 Loading... | |
| 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 })(); | |
| OLD | NEW |