porffor 0.55.27 → 0.55.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compiler/builtins/__internal_object.ts +1 -1
- package/compiler/builtins/error.js +11 -15
- package/compiler/builtins_precompiled.js +1476 -1467
- package/compiler/codegen.js +17 -5
- package/compiler/cyclone.js +174 -113
- package/compiler/disassemble.js +1 -1
- package/compiler/index.js +3 -3
- package/compiler/types.js +8 -10
- package/compiler/wrap.js +1 -2
- package/package.json +1 -1
- package/r.cjs +252 -3
- package/runner/index.js +1 -1
package/r.cjs
CHANGED
@@ -1,8 +1,257 @@
|
|
1
|
-
function
|
2
|
-
|
1
|
+
Foo.prototype.baz = function baz() {};
|
2
|
+
|
3
|
+
function Foo() {
|
4
|
+
this.bar = 1;
|
3
5
|
}
|
4
6
|
|
5
|
-
|
7
|
+
Foo.prototype.bar = function bar() {};
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
// var EQUAL = 1;
|
12
|
+
// var NOT_EQUAL = -1;
|
13
|
+
// var UNKNOWN = 0;
|
14
|
+
|
15
|
+
// function setCache(cache, left, right, result) {
|
16
|
+
// var otherCache;
|
17
|
+
|
18
|
+
// otherCache = cache.get(left);
|
19
|
+
// if (!otherCache) cache.set(left, otherCache = new Map());
|
20
|
+
// otherCache.set(right, result);
|
21
|
+
|
22
|
+
// otherCache = cache.get(right);
|
23
|
+
// if (!otherCache) cache.set(right, otherCache = new Map());
|
24
|
+
// otherCache.set(left, result);
|
25
|
+
// }
|
26
|
+
|
27
|
+
// function getCache(cache, left, right) {
|
28
|
+
// var otherCache;
|
29
|
+
// var result;
|
30
|
+
|
31
|
+
// otherCache = cache.get(left);
|
32
|
+
// result = otherCache && otherCache.get(right);
|
33
|
+
// if (result) return result;
|
34
|
+
|
35
|
+
// otherCache = cache.get(right);
|
36
|
+
// result = otherCache && otherCache.get(left);
|
37
|
+
// if (result) return result;
|
38
|
+
|
39
|
+
// return UNKNOWN;
|
40
|
+
// }
|
41
|
+
|
42
|
+
// function cacheComparison(a, b, compare, cache) {
|
43
|
+
// var result = compare(a, b, cache);
|
44
|
+
// if (cache && (result === EQUAL || result === NOT_EQUAL)) {
|
45
|
+
// setCache(cache, a, b, result);
|
46
|
+
// }
|
47
|
+
// return result;
|
48
|
+
// }
|
49
|
+
|
50
|
+
// function isBoxed(value) {
|
51
|
+
// return value instanceof String
|
52
|
+
// || value instanceof Number
|
53
|
+
// || value instanceof Boolean
|
54
|
+
// || value instanceof Symbol;
|
55
|
+
// }
|
56
|
+
|
57
|
+
// function fail() {
|
58
|
+
// return NOT_EQUAL;
|
59
|
+
// }
|
60
|
+
|
61
|
+
// function compareIf(a, b, test, compare, cache) {
|
62
|
+
// return !test(a)
|
63
|
+
// ? !test(b) ? UNKNOWN : NOT_EQUAL
|
64
|
+
// : !test(b) ? NOT_EQUAL : cacheComparison(a, b, compare, cache);
|
65
|
+
// }
|
66
|
+
|
67
|
+
// function compareEquality(a, b, cache) {
|
68
|
+
// return compareIf(a, b, isOptional, compareOptionality)
|
69
|
+
// || compareIf(a, b, isPrimitiveEquatable, comparePrimitiveEquality)
|
70
|
+
// || compareIf(a, b, isObjectEquatable, compareObjectEquality, cache)
|
71
|
+
// || NOT_EQUAL;
|
72
|
+
// }
|
73
|
+
|
74
|
+
// function tryCompareStrictEquality(a, b) {
|
75
|
+
// return a === b ? EQUAL : UNKNOWN;
|
76
|
+
// }
|
77
|
+
|
78
|
+
// function tryCompareTypeOfEquality(a, b) {
|
79
|
+
// return typeof a !== typeof b ? NOT_EQUAL : UNKNOWN;
|
80
|
+
// }
|
81
|
+
|
82
|
+
// function tryCompareToStringTagEquality(a, b) {
|
83
|
+
// var aTag = Symbol.toStringTag in a ? a[Symbol.toStringTag] : undefined;
|
84
|
+
// var bTag = Symbol.toStringTag in b ? b[Symbol.toStringTag] : undefined;
|
85
|
+
// return aTag !== bTag ? NOT_EQUAL : UNKNOWN;
|
86
|
+
// }
|
87
|
+
|
88
|
+
// function isOptional(value) {
|
89
|
+
// return value === undefined
|
90
|
+
// || value === null;
|
91
|
+
// }
|
92
|
+
|
93
|
+
// function compareOptionality(a, b) {
|
94
|
+
// return tryCompareStrictEquality(a, b)
|
95
|
+
// || NOT_EQUAL;
|
96
|
+
// }
|
97
|
+
|
98
|
+
// function isPrimitiveEquatable(value) {
|
99
|
+
// switch (typeof value) {
|
100
|
+
// case 'string':
|
101
|
+
// case 'number':
|
102
|
+
// case 'boolean':
|
103
|
+
// case 'symbol':
|
104
|
+
// return true;
|
105
|
+
// default:
|
106
|
+
// return isBoxed(value);
|
107
|
+
// }
|
108
|
+
// }
|
109
|
+
|
110
|
+
// function comparePrimitiveEquality(a, b) {
|
111
|
+
// if (isBoxed(a)) a = a.valueOf();
|
112
|
+
// if (isBoxed(b)) b = b.valueOf();
|
113
|
+
|
114
|
+
// return tryCompareStrictEquality(a, b)
|
115
|
+
// || tryCompareTypeOfEquality(a, b)
|
116
|
+
// || compareIf(a, b, isNaNEquatable, compareNaNEquality)
|
117
|
+
// || NOT_EQUAL;
|
118
|
+
// }
|
119
|
+
|
120
|
+
// function isNaNEquatable(value) {
|
121
|
+
// return typeof value === 'number';
|
122
|
+
// }
|
123
|
+
|
124
|
+
// function compareNaNEquality(a, b) {
|
125
|
+
// return isNaN(a) && isNaN(b) ? EQUAL : NOT_EQUAL;
|
126
|
+
// }
|
127
|
+
|
128
|
+
// function isObjectEquatable(value) {
|
129
|
+
// return typeof value === 'object';
|
130
|
+
// }
|
131
|
+
|
132
|
+
// function compareObjectEquality(a, b, cache) {
|
133
|
+
// if (!cache) cache = new Map();
|
134
|
+
|
135
|
+
// return getCache(cache, a, b)
|
136
|
+
// || setCache(cache, a, b, EQUAL) // consider equal for now
|
137
|
+
// || cacheComparison(a, b, tryCompareStrictEquality, cache)
|
138
|
+
// || cacheComparison(a, b, tryCompareToStringTagEquality, cache)
|
139
|
+
// || compareIf(a, b, isValueOfEquatable, compareValueOfEquality)
|
140
|
+
// || compareIf(a, b, isToStringEquatable, compareToStringEquality)
|
141
|
+
// || compareIf(a, b, isArrayLikeEquatable, compareArrayLikeEquality, cache)
|
142
|
+
// || compareIf(a, b, isStructurallyEquatable, compareStructuralEquality, cache)
|
143
|
+
// || compareIf(a, b, isIterableEquatable, compareIterableEquality, cache)
|
144
|
+
// || cacheComparison(a, b, fail, cache);
|
145
|
+
// }
|
146
|
+
|
147
|
+
// function isValueOfEquatable(value) {
|
148
|
+
// return value instanceof Date;
|
149
|
+
// }
|
150
|
+
|
151
|
+
// function compareValueOfEquality(a, b) {
|
152
|
+
// return compareIf(a.valueOf(), b.valueOf(), isPrimitiveEquatable, comparePrimitiveEquality)
|
153
|
+
// || NOT_EQUAL;
|
154
|
+
// }
|
155
|
+
|
156
|
+
// function isToStringEquatable(value) {
|
157
|
+
// return value instanceof RegExp;
|
158
|
+
// }
|
159
|
+
|
160
|
+
// function compareToStringEquality(a, b) {
|
161
|
+
// return compareIf(a.toString(), b.toString(), isPrimitiveEquatable, comparePrimitiveEquality)
|
162
|
+
// || NOT_EQUAL;
|
163
|
+
// }
|
164
|
+
|
165
|
+
// function isArrayLikeEquatable(value) {
|
166
|
+
// return Array.isArray(value)
|
167
|
+
// || value instanceof Uint8Array
|
168
|
+
// || value instanceof Uint8ClampedArray
|
169
|
+
// || value instanceof Uint16Array
|
170
|
+
// || value instanceof Uint32Array
|
171
|
+
// || value instanceof Int8Array
|
172
|
+
// || value instanceof Int16Array
|
173
|
+
// || value instanceof Int32Array
|
174
|
+
// || value instanceof Float32Array
|
175
|
+
// || value instanceof Float64Array;
|
176
|
+
// }
|
177
|
+
|
178
|
+
// function compareArrayLikeEquality(a, b, cache) {
|
179
|
+
// if (a.length !== b.length) return NOT_EQUAL;
|
180
|
+
// for (var i = 0; i < a.length; i++) {
|
181
|
+
// if (compareEquality(a[i], b[i], cache) === NOT_EQUAL) {
|
182
|
+
// return NOT_EQUAL;
|
183
|
+
// }
|
184
|
+
// }
|
185
|
+
// return EQUAL;
|
186
|
+
// }
|
187
|
+
|
188
|
+
// function isStructurallyEquatable(value) {
|
189
|
+
// return !(value instanceof Promise // only comparable by reference
|
190
|
+
// || value instanceof WeakMap // only comparable by reference
|
191
|
+
// || value instanceof WeakSet // only comparable by reference
|
192
|
+
// || value instanceof Map // comparable via @@iterator
|
193
|
+
// || value instanceof Set); // comparable via @@iterator
|
194
|
+
// }
|
195
|
+
|
196
|
+
// function compareStructuralEquality(a, b, cache) {
|
197
|
+
// var aKeys = [];
|
198
|
+
// for (var key in a) aKeys.push(key);
|
199
|
+
|
200
|
+
// var bKeys = [];
|
201
|
+
// for (var key in b) bKeys.push(key);
|
202
|
+
|
203
|
+
// if (aKeys.length !== bKeys.length) {
|
204
|
+
// return NOT_EQUAL;
|
205
|
+
// }
|
206
|
+
|
207
|
+
// aKeys.sort();
|
208
|
+
// bKeys.sort();
|
209
|
+
|
210
|
+
// for (var i = 0; i < aKeys.length; i++) {
|
211
|
+
// var aKey = aKeys[i];
|
212
|
+
// var bKey = bKeys[i];
|
213
|
+
// if (compareEquality(aKey, bKey, cache) === NOT_EQUAL) {
|
214
|
+
// return NOT_EQUAL;
|
215
|
+
// }
|
216
|
+
// if (compareEquality(a[aKey], b[bKey], cache) === NOT_EQUAL) {
|
217
|
+
// return NOT_EQUAL;
|
218
|
+
// }
|
219
|
+
// }
|
220
|
+
|
221
|
+
// return EQUAL;
|
222
|
+
// }
|
223
|
+
|
224
|
+
// // hack: do iterables via for..of
|
225
|
+
// function isIterableEquatable(value) {
|
226
|
+
// try {
|
227
|
+
// for (const _ of value) { break; }
|
228
|
+
// return true;
|
229
|
+
// } catch {
|
230
|
+
// return false;
|
231
|
+
// }
|
232
|
+
// }
|
233
|
+
|
234
|
+
// function compareIterableEquality(a, b, cache) {
|
235
|
+
// let aValues = [];
|
236
|
+
// for (const x of a) aValues.push(x);
|
237
|
+
|
238
|
+
// let bValues = [];
|
239
|
+
// for (const x of b) bValues.push(x);
|
240
|
+
|
241
|
+
// return compareArrayLikeEquality(aValues, bValues, cache);
|
242
|
+
// }
|
243
|
+
|
244
|
+
// var __assert_deepEqual__compare = (a, b) => {
|
245
|
+
// return compareEquality(a, b) === EQUAL;
|
246
|
+
// };
|
247
|
+
|
248
|
+
// var __assert_deepEqual = (actual, expected) => {
|
249
|
+
// if (!assert.deepEqual._compare(actual, expected)) {
|
250
|
+
// throw new Test262Error('assert.deepEqual failed');
|
251
|
+
// }
|
252
|
+
// };
|
253
|
+
|
254
|
+
// __assert_deepEqual([], []);
|
6
255
|
|
7
256
|
// let x = {};
|
8
257
|
// x.__proto__ = { wow() { console.log(0); } };
|