1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
// |jit-test| skip-if: isLcovEnabled()
// Guessed Atoms tests.
// Test String literals
var obj = {
["func"]: function() {return function() {} },
["arrowFunc"]: ()=>{return function() {} },
["method"]() {return function() {} },
["nonAnonymousFunc"]: function F() {return function() {} },
get ["getter"]() {return function() {} },
};
assertEq(displayName(obj.func()), "func/<");
assertEq(displayName(obj.arrowFunc()), "arrowFunc/<");
assertEq(displayName(obj.method()), "method/<");
assertEq(displayName(obj.nonAnonymousFunc()), "F/<");
// We don't support guessed name for accessor
assertEq(displayName(obj.getter), "");
let dummy = class {
["func"]() {return function() {} }
["arrowFunc"] = ()=>{return function() {} };
["method"]() {return function() {} }
get ["getter"]() {return function() {} }
};
dum = new dummy();
assertEq(displayName(dum.func()), "func/<");
// We don't support guessed name for class field with computed name
assertEq(displayName(dum.arrowFunc()), "dummy</</<");
assertEq(displayName(dum.method()), "method/<");
// We don't support guessed name for accessor
assertEq(displayName(dummy.prototype.getter), "dummy</<");
// Test numeric literals
var objN = {
[1]: function() {return function() {}},
[5]: ()=>{return function() {}},
[7] () {return function() {}},
[8]: class {},
[9]: function F() {return function() {}},
[10]: class C{},
get [11]() {return function() {}},
};
assertEq(displayName(objN[1]()), "1/<");
assertEq(displayName(objN[5]()), "5/<");
assertEq(displayName(objN[7]()), "7/<");
assertEq(displayName(objN[8]), "8");
assertEq(displayName(objN[9]()), "F/<");
assertEq(displayName(objN[10]), "C");
// We don't support guessed name for accessor
assertEq(displayName(objN[11]), "objN/<");
let foo = class {
[1] () {return function() {} }
[5] = ()=>{return function() {} };
[7] () {return function() {} }
get [11]() {return function() {} }
};
f = new foo();
assertEq(displayName(f[1]()), "1/<");
// We don't support guessed name for class field with computed name
assertEq(displayName(f[5]()), "foo</</<");
assertEq(displayName(f[7]()), "7/<");
assertEq(displayName(f[11]), "foo</<");
// Native built-in accessor name, which is lazily created.
assertEq(displayName(Object.getOwnPropertyDescriptor(Map.prototype, "size").get), "get size");
assertEq(displayName(Object.getOwnPropertyDescriptor(RegExp.prototype, "flags").get), "get flags");
|