forked from rollup/rollup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
105 lines (97 loc) · 3.96 KB
/
main.js
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
const boolean = true;
const valueOf1 = boolean.valueOf();
const valueOf2 = true.valueOf();
const valueOf3 = true.valueOf().valueOf();
const valueOf4 = true.valueOf().valueOf().valueOf();
// retained
true.valueOf().unknown.unknown();
true.valueOf()();
(1).valueOf().unknown.unknown();
(1).valueOf().unknown();
(1).valueOf()[globalThis.unknown]();
(1).valueOf()();
'ab'.charAt(1).unknown.unknown();
'ab'.charAt(1)();
null.unknown;
// number prototype
const _toExponential = (1).toExponential( 2 ).trim();
const _toFixed = (1).toFixed( 2 ).trim();
const _toLocaleString = (1).toLocaleString().trim();
const _toPrecision = (1).toPrecision( 2 ).trim();
const _numberValueOf = (1).valueOf().toExponential( 2 );
// inherited
const _numberHasOwnProperty = (1).hasOwnProperty( 'toString' ).valueOf();
const _numberIsPrototypeOf = (1).isPrototypeOf( 1 ).valueOf();
const _numberPropertyIsEnumerable = (1).propertyIsEnumerable( 'toString' ).valueOf();
const _numberToLocaleString = (1).toLocaleString().trim();
const _numberToString = (1).toString().trim();
// string prototype
const _at = 'ab'.at( 1 )
const _charAt = 'ab'.charAt( 1 ).trim();
const _charCodeAt = 'ab'.charCodeAt( 1 ).toExponential( 2 );
const _codePointAt = 'ab'.codePointAt( 1 );
const _concat = 'ab'.concat( 'c' ).trim();
const _includes = 'ab'.includes( 'a' ).valueOf();
const _endsWith = 'ab'.endsWith( 'a' ).valueOf();
const _indexOf = 'ab'.indexOf( 'a' ).toExponential( 2 );
const _lastIndexOf = 'ab'.lastIndexOf( 'a' ).toExponential( 2 );
const _localeCompare = 'ab'.localeCompare( 'a' ).toExponential( 2 );
const _match = 'ab'.match( /a/ )
const _matchAll = 'ab'.matchAll( /a/ )
const _normalize = 'ab'.normalize().trim();
const _padEnd = 'ab'.padEnd( 4, 'a' ).trim();
const _padStart = 'ab'.padStart( 4, 'a' ).trim();
const _repeat = 'ab'.repeat( 2 ).trim();
const _replace = 'ab'.replace( 'a', () => 'b' ).trim();
const _replaceEffect = 'ab'.replace( 'a', () => console.log( 1 ) || 'b' );
const _replaceAll = 'ab'.replaceAll( 'a', () => 'b' ).trim();
const _replaceAllEffect = 'ab'.replaceAll( 'a', () => console.log( 1 ) || 'b' );
const _search = 'ab'.search( /a/ ).toExponential( 2 );
const _slice = 'ab'.slice( 0, 1 ).trim();
const _split = 'ab'.split( 'a' );
const _startsWith = 'ab'.startsWith( 'a' ).valueOf();
const _substring = 'ab'.substring( 0, 1 ).trim();
const _toLocaleLowerCase = 'ab'.toLocaleLowerCase().trim();
const _toLocaleUpperCase = 'ab'.toLocaleUpperCase().trim();
const _toLowerCase = 'ab'.toLowerCase().trim();
const _toString = 'ab'.trim();
const _toUpperCase = 'ab'.toUpperCase().trim();
const _trim = 'ab'.trim().trim();
const _trimEnd = 'ab'.trimEnd().trim();
const _trimStart = 'ab'.trimStart().trim();
const _stringValueOf = 'ab'.valueOf().trim();
// DEPRECATED prototype methods
const _anchor = 'ab'.anchor().trim();
const _big = 'ab'.big().trim();
const _blink = 'ab'.blink().trim();
const _bold = 'ab'.bold().trim();
const _fixed = 'ab'.fixed().trim();
const _fontcolor = 'ab'.fontcolor().trim();
const _fontsize = 'ab'.fontsize().trim();
const _italics = 'ab'.italics().trim();
const _link = 'ab'.link().trim();
const _small = 'ab'.small().trim();
const _strike = 'ab'.strike().trim();
const _sub = 'ab'.sub().trim();
const _substr = 'ab'.substr(0, 1).trim();
const _sup = 'ab'.sup().trim();
const _trimLeft = 'ab'.trimLeft().trim();
const _trimRight = 'ab'.trimRight().trim();
// inherited
const _stringHasOwnProperty = 'ab'.hasOwnProperty( 'toString' ).valueOf();
const _stringIsPrototypeOf = 'ab'.isPrototypeOf( '' ).valueOf();
const _stringPropertyIsEnumerable = 'ab'.propertyIsEnumerable( 'toString' ).valueOf();
const _stringToLocaleString = 'ab'.toLocaleString().trim();
const _stringToString = 'ab'.toString().trim();
// property access is allowed
const accessBoolean = true.x;
const accessNumber = (1).x;
const accessString = 'ab'.x;
// deep property access is forbidden
const deepBoolean = true.x.y;
const deepNumber = (1).x.y;
const deepString = 'ab'.x.y;
// due to strict mode, extension is forbidden
true.x = 1;
(1).x = 1;
'ab'.x = 1;