porffor 0.56.2 → 0.56.4
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/2c.js +32 -19
- package/compiler/allocator.js +2 -0
- package/compiler/builtins/_internal_object.ts +7 -4
- package/compiler/builtins/array.ts +39 -0
- package/compiler/builtins/{z_map.ts → map.ts} +26 -29
- package/compiler/builtins/object.ts +1 -0
- package/compiler/builtins/porffor.d.ts +1 -0
- package/compiler/builtins/set.ts +8 -92
- package/compiler/builtins/{z_weakmap.ts → weakmap.ts} +5 -9
- package/compiler/builtins/{z_weakset.ts → weakset.ts} +3 -7
- package/compiler/builtins_precompiled.js +537 -541
- package/compiler/codegen.js +96 -98
- package/package.json +1 -1
- package/r.cjs +1 -281
- package/runner/index.js +1 -1
package/compiler/codegen.js
CHANGED
@@ -506,9 +506,8 @@ const lookup = (scope, name, failEarly = false) => {
|
|
506
506
|
const lookupOrError = (scope, name, failEarly) => lookup(scope, name, failEarly)
|
507
507
|
?? internalThrow(scope, 'ReferenceError', `${unhackName(name)} is not defined`, true);
|
508
508
|
|
509
|
-
const generateIdent = (scope, decl) =>
|
510
|
-
|
511
|
-
};
|
509
|
+
const generateIdent = (scope, decl) =>
|
510
|
+
lookupOrError(scope, decl.name, scope.identFailEarly);
|
512
511
|
|
513
512
|
const generateYield = (scope, decl) => {
|
514
513
|
let arg = decl.argument ?? DEFAULT_VALUE();
|
@@ -761,21 +760,19 @@ const performLogicOp = (scope, op, left, right, leftType, rightType) => {
|
|
761
760
|
];
|
762
761
|
};
|
763
762
|
|
764
|
-
const concatStrings = (scope, left, right, leftType, rightType) =>
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
...leftType,
|
763
|
+
const concatStrings = (scope, left, right, leftType, rightType) => [
|
764
|
+
...left,
|
765
|
+
...(valtypeBinary === Valtype.i32 ? [ [ Opcodes.f64_convert_i32_s ] ] : []),
|
766
|
+
...leftType,
|
769
767
|
|
770
|
-
|
771
|
-
|
772
|
-
|
768
|
+
...right,
|
769
|
+
...(valtypeBinary === Valtype.i32 ? [ [ Opcodes.f64_convert_i32_s ] ] : []),
|
770
|
+
...rightType,
|
773
771
|
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
};
|
772
|
+
[ Opcodes.call, includeBuiltin(scope, '__Porffor_concatStrings').index ],
|
773
|
+
...setLastType(scope),
|
774
|
+
...(valtypeBinary === Valtype.i32 ? [ Opcodes.i32_trunc_sat_f64_u ] : []),
|
775
|
+
];
|
779
776
|
|
780
777
|
const compareStrings = (scope, left, right, leftType, rightType, noConv = false) => {
|
781
778
|
if (noConv) return [
|
@@ -1239,89 +1236,87 @@ const generateBinaryExp = (scope, decl) => {
|
|
1239
1236
|
return out;
|
1240
1237
|
};
|
1241
1238
|
|
1242
|
-
const asmFuncToAsm = (scope, func, extra) => {
|
1243
|
-
|
1244
|
-
|
1245
|
-
|
1246
|
-
|
1247
|
-
|
1248
|
-
|
1249
|
-
|
1250
|
-
|
1251
|
-
}
|
1239
|
+
const asmFuncToAsm = (scope, func, extra) => func(scope, {
|
1240
|
+
Valtype, Opcodes, TYPES, TYPE_NAMES, usedTypes, typeSwitch, makeString, internalThrow,
|
1241
|
+
getNodeType, generate, generateIdent,
|
1242
|
+
builtin: (n, offset = false) => {
|
1243
|
+
let idx = funcIndex[n] ?? importedFuncs[n];
|
1244
|
+
if (idx == null && builtinFuncs[n]) {
|
1245
|
+
includeBuiltin(scope, n);
|
1246
|
+
idx = funcIndex[n];
|
1247
|
+
}
|
1252
1248
|
|
1253
|
-
|
1254
|
-
|
1249
|
+
scope.includes ??= new Set();
|
1250
|
+
scope.includes.add(n);
|
1255
1251
|
|
1256
|
-
|
1257
|
-
|
1252
|
+
if (idx == null) throw new Error(`builtin('${n}') failed: could not find func (from ${scope.name})`);
|
1253
|
+
if (offset) idx -= importedFuncs.length;
|
1258
1254
|
|
1259
|
-
|
1260
|
-
|
1261
|
-
|
1262
|
-
|
1263
|
-
|
1264
|
-
|
1265
|
-
|
1255
|
+
return idx;
|
1256
|
+
},
|
1257
|
+
hasFunc: x => funcIndex[x] != null,
|
1258
|
+
funcRef: name => {
|
1259
|
+
if (funcIndex[name] == null && builtinFuncs[name]) {
|
1260
|
+
includeBuiltin(scope, name);
|
1261
|
+
}
|
1266
1262
|
|
1267
|
-
|
1268
|
-
|
1269
|
-
|
1270
|
-
|
1271
|
-
|
1272
|
-
|
1273
|
-
|
1274
|
-
|
1275
|
-
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1263
|
+
const func = funcByName(name);
|
1264
|
+
return funcRef(func);
|
1265
|
+
},
|
1266
|
+
glbl: (opcode, name, type) => {
|
1267
|
+
const globalName = '#porf#' + name; // avoid potential name clashing with user js
|
1268
|
+
if (!globals[globalName]) {
|
1269
|
+
const idx = globals['#ind']++;
|
1270
|
+
globals[globalName] = { idx, type };
|
1271
|
+
|
1272
|
+
const tmpIdx = globals['#ind']++;
|
1273
|
+
globals[globalName + '#glbl_inited'] = { idx: tmpIdx, type: Valtype.i32 };
|
1274
|
+
}
|
1279
1275
|
|
1280
|
-
|
1281
|
-
|
1282
|
-
|
1276
|
+
const out = [
|
1277
|
+
[ opcode, globals[globalName].idx ]
|
1278
|
+
];
|
1283
1279
|
|
1284
|
-
|
1285
|
-
|
1286
|
-
|
1287
|
-
|
1288
|
-
|
1289
|
-
|
1290
|
-
|
1291
|
-
|
1292
|
-
|
1293
|
-
|
1294
|
-
|
1295
|
-
|
1296
|
-
|
1280
|
+
scope.initedGlobals ??= new Set();
|
1281
|
+
if (!scope.initedGlobals.has(name)) {
|
1282
|
+
scope.initedGlobals.add(name);
|
1283
|
+
if (scope.globalInits[name]) out.unshift(
|
1284
|
+
[ Opcodes.global_get, globals[globalName + '#glbl_inited'].idx ],
|
1285
|
+
[ Opcodes.i32_eqz ],
|
1286
|
+
[ Opcodes.if, Blocktype.void ],
|
1287
|
+
...asmFuncToAsm(scope, scope.globalInits[name]),
|
1288
|
+
number(1, Valtype.i32),
|
1289
|
+
[ Opcodes.global_set, globals[globalName + '#glbl_inited'].idx ],
|
1290
|
+
[ Opcodes.end ]
|
1291
|
+
);
|
1292
|
+
}
|
1297
1293
|
|
1298
|
-
|
1299
|
-
|
1300
|
-
|
1301
|
-
|
1302
|
-
|
1303
|
-
|
1304
|
-
|
1294
|
+
return out;
|
1295
|
+
},
|
1296
|
+
loc: (name, type) => {
|
1297
|
+
if (!scope.locals[name]) {
|
1298
|
+
const idx = scope.localInd++;
|
1299
|
+
scope.locals[name] = { idx, type };
|
1300
|
+
}
|
1305
1301
|
|
1306
|
-
|
1307
|
-
|
1308
|
-
|
1309
|
-
|
1310
|
-
|
1311
|
-
|
1312
|
-
|
1313
|
-
|
1314
|
-
|
1315
|
-
|
1316
|
-
|
1317
|
-
|
1318
|
-
|
1319
|
-
|
1320
|
-
|
1321
|
-
|
1322
|
-
|
1323
|
-
|
1324
|
-
};
|
1302
|
+
return scope.locals[name].idx;
|
1303
|
+
},
|
1304
|
+
t: (types, wasm) => {
|
1305
|
+
if (types.some(x => usedTypes.has(x))) {
|
1306
|
+
return wasm();
|
1307
|
+
} else {
|
1308
|
+
return [ [ null, () => {
|
1309
|
+
if (types.some(x => usedTypes.has(x))) return wasm();
|
1310
|
+
return [];
|
1311
|
+
} ] ];
|
1312
|
+
}
|
1313
|
+
},
|
1314
|
+
i32ify: wasm => {
|
1315
|
+
wasm.push(Opcodes.i32_to_u);
|
1316
|
+
return wasm;
|
1317
|
+
},
|
1318
|
+
allocPage: (scope, name) => allocPage({ scope, pages }, name)
|
1319
|
+
}, extra);
|
1325
1320
|
|
1326
1321
|
const asmFunc = (name, { wasm, params = [], typedParams = false, locals: localTypes = [], globals: globalTypes = [], globalInits = [], returns = [], returnType, localNames = [], globalNames = [], table = false, constr = false, hasRestArgument = false, usesTag = false, usesImports = false, usedTypes = [] } = {}) => {
|
1327
1322
|
if (wasm == null) { // called with no built-in
|
@@ -1393,9 +1388,8 @@ const includeBuiltin = (scope, builtin) => {
|
|
1393
1388
|
return asmFunc(builtin, builtinFuncs[builtin]);
|
1394
1389
|
};
|
1395
1390
|
|
1396
|
-
const generateLogicExp = (scope, decl) =>
|
1397
|
-
|
1398
|
-
};
|
1391
|
+
const generateLogicExp = (scope, decl) =>
|
1392
|
+
performLogicOp(scope, decl.operator, generate(scope, decl.left), generate(scope, decl.right), getNodeType(scope, decl.left), getNodeType(scope, decl.right));
|
1399
1393
|
|
1400
1394
|
const isExistingProtoFunc = name => {
|
1401
1395
|
if (name.startsWith('__Array_prototype')) return !!prototypeFuncs[TYPES.array][name.slice(18)];
|
@@ -3201,7 +3195,7 @@ const setDefaultFuncName = (decl, name) => {
|
|
3201
3195
|
const generateVarDstr = (scope, kind, pattern, init, defaultValue, global) => {
|
3202
3196
|
// statically analyzed ffi dlopen hack to let 2c handle it
|
3203
3197
|
if (init && init.type === 'CallExpression' && init.callee.name === '__Porffor_dlopen') {
|
3204
|
-
if (Prefs.target !== 'native' && !Prefs.native) throw new Error('Porffor.dlopen is only supported for native target (use --native)');
|
3198
|
+
if (Prefs.target !== 'native' && Prefs.target !== 'c' && !Prefs.native) throw new Error('Porffor.dlopen is only supported for native target (use --native)');
|
3205
3199
|
|
3206
3200
|
// disable pgo if using ffi (lol)
|
3207
3201
|
Prefs.pgo = false;
|
@@ -5319,9 +5313,7 @@ const generateTry = (scope, decl) => {
|
|
5319
5313
|
return out;
|
5320
5314
|
};
|
5321
5315
|
|
5322
|
-
const generateEmpty = (scope, decl) =>
|
5323
|
-
return [ number(UNDEFINED) ];
|
5324
|
-
};
|
5316
|
+
const generateEmpty = (scope, decl) => [ number(UNDEFINED) ];
|
5325
5317
|
|
5326
5318
|
const generateMeta = (scope, decl) => {
|
5327
5319
|
if (decl.meta.name === 'new' && decl.property.name === 'target') {
|
@@ -6328,6 +6320,12 @@ const generateTaggedTemplate = (scope, decl, global = false, name = undefined, v
|
|
6328
6320
|
return out;
|
6329
6321
|
},
|
6330
6322
|
|
6323
|
+
__Porffor_c: str => {
|
6324
|
+
return [
|
6325
|
+
[ null, 'c', str ]
|
6326
|
+
];
|
6327
|
+
},
|
6328
|
+
|
6331
6329
|
__Porffor_bs: str => makeString(scope, str, true),
|
6332
6330
|
__Porffor_s: str => makeString(scope, str, false)
|
6333
6331
|
};
|
package/package.json
CHANGED
package/r.cjs
CHANGED
@@ -1,284 +1,4 @@
|
|
1
|
-
|
2
|
-
wow() {}
|
3
|
-
};
|
4
|
-
|
5
|
-
console.log(obj.wow.prototype);
|
6
|
-
|
7
|
-
// var EQUAL = 1;
|
8
|
-
// var NOT_EQUAL = -1;
|
9
|
-
// var UNKNOWN = 0;
|
10
|
-
|
11
|
-
// function setCache(cache, left, right, result) {
|
12
|
-
// var otherCache;
|
13
|
-
|
14
|
-
// otherCache = cache.get(left);
|
15
|
-
// if (!otherCache) cache.set(left, otherCache = new Map());
|
16
|
-
// otherCache.set(right, result);
|
17
|
-
|
18
|
-
// otherCache = cache.get(right);
|
19
|
-
// if (!otherCache) cache.set(right, otherCache = new Map());
|
20
|
-
// otherCache.set(left, result);
|
21
|
-
// }
|
22
|
-
|
23
|
-
// function getCache(cache, left, right) {
|
24
|
-
// var otherCache;
|
25
|
-
// var result;
|
26
|
-
|
27
|
-
// otherCache = cache.get(left);
|
28
|
-
// result = otherCache && otherCache.get(right);
|
29
|
-
// if (result) return result;
|
30
|
-
|
31
|
-
// otherCache = cache.get(right);
|
32
|
-
// result = otherCache && otherCache.get(left);
|
33
|
-
// if (result) return result;
|
34
|
-
|
35
|
-
// return UNKNOWN;
|
36
|
-
// }
|
37
|
-
|
38
|
-
// function cacheComparison(a, b, compare, cache) {
|
39
|
-
// var result = compare(a, b, cache);
|
40
|
-
// if (cache && (result === EQUAL || result === NOT_EQUAL)) {
|
41
|
-
// setCache(cache, a, b, result);
|
42
|
-
// }
|
43
|
-
// return result;
|
44
|
-
// }
|
45
|
-
|
46
|
-
// function isBoxed(value) {
|
47
|
-
// return value instanceof String
|
48
|
-
// || value instanceof Number
|
49
|
-
// || value instanceof Boolean
|
50
|
-
// || value instanceof Symbol;
|
51
|
-
// }
|
52
|
-
|
53
|
-
// function fail() {
|
54
|
-
// return NOT_EQUAL;
|
55
|
-
// }
|
56
|
-
|
57
|
-
// function compareIf(a, b, test, compare, cache) {
|
58
|
-
// return !test(a)
|
59
|
-
// ? !test(b) ? UNKNOWN : NOT_EQUAL
|
60
|
-
// : !test(b) ? NOT_EQUAL : cacheComparison(a, b, compare, cache);
|
61
|
-
// }
|
62
|
-
|
63
|
-
// function compareEquality(a, b, cache) {
|
64
|
-
// return compareIf(a, b, isOptional, compareOptionality)
|
65
|
-
// || compareIf(a, b, isPrimitiveEquatable, comparePrimitiveEquality)
|
66
|
-
// || compareIf(a, b, isObjectEquatable, compareObjectEquality, cache)
|
67
|
-
// || NOT_EQUAL;
|
68
|
-
// }
|
69
|
-
|
70
|
-
// function tryCompareStrictEquality(a, b) {
|
71
|
-
// return a === b ? EQUAL : UNKNOWN;
|
72
|
-
// }
|
73
|
-
|
74
|
-
// function tryCompareTypeOfEquality(a, b) {
|
75
|
-
// return typeof a !== typeof b ? NOT_EQUAL : UNKNOWN;
|
76
|
-
// }
|
77
|
-
|
78
|
-
// function tryCompareToStringTagEquality(a, b) {
|
79
|
-
// var aTag = Symbol.toStringTag in a ? a[Symbol.toStringTag] : undefined;
|
80
|
-
// var bTag = Symbol.toStringTag in b ? b[Symbol.toStringTag] : undefined;
|
81
|
-
// return aTag !== bTag ? NOT_EQUAL : UNKNOWN;
|
82
|
-
// }
|
83
|
-
|
84
|
-
// function isOptional(value) {
|
85
|
-
// return value === undefined
|
86
|
-
// || value === null;
|
87
|
-
// }
|
88
|
-
|
89
|
-
// function compareOptionality(a, b) {
|
90
|
-
// return tryCompareStrictEquality(a, b)
|
91
|
-
// || NOT_EQUAL;
|
92
|
-
// }
|
93
|
-
|
94
|
-
// function isPrimitiveEquatable(value) {
|
95
|
-
// switch (typeof value) {
|
96
|
-
// case 'string':
|
97
|
-
// case 'number':
|
98
|
-
// case 'boolean':
|
99
|
-
// case 'symbol':
|
100
|
-
// return true;
|
101
|
-
// default:
|
102
|
-
// return isBoxed(value);
|
103
|
-
// }
|
104
|
-
// }
|
105
|
-
|
106
|
-
// function comparePrimitiveEquality(a, b) {
|
107
|
-
// if (isBoxed(a)) a = a.valueOf();
|
108
|
-
// if (isBoxed(b)) b = b.valueOf();
|
109
|
-
|
110
|
-
// return tryCompareStrictEquality(a, b)
|
111
|
-
// || tryCompareTypeOfEquality(a, b)
|
112
|
-
// || compareIf(a, b, isNaNEquatable, compareNaNEquality)
|
113
|
-
// || NOT_EQUAL;
|
114
|
-
// }
|
115
|
-
|
116
|
-
// function isNaNEquatable(value) {
|
117
|
-
// return typeof value === 'number';
|
118
|
-
// }
|
119
|
-
|
120
|
-
// function compareNaNEquality(a, b) {
|
121
|
-
// return isNaN(a) && isNaN(b) ? EQUAL : NOT_EQUAL;
|
122
|
-
// }
|
123
|
-
|
124
|
-
// function isObjectEquatable(value) {
|
125
|
-
// return typeof value === 'object';
|
126
|
-
// }
|
127
|
-
|
128
|
-
// function compareObjectEquality(a, b, cache) {
|
129
|
-
// if (!cache) cache = new Map();
|
130
|
-
|
131
|
-
// return getCache(cache, a, b)
|
132
|
-
// || setCache(cache, a, b, EQUAL) // consider equal for now
|
133
|
-
// || cacheComparison(a, b, tryCompareStrictEquality, cache)
|
134
|
-
// || cacheComparison(a, b, tryCompareToStringTagEquality, cache)
|
135
|
-
// || compareIf(a, b, isValueOfEquatable, compareValueOfEquality)
|
136
|
-
// || compareIf(a, b, isToStringEquatable, compareToStringEquality)
|
137
|
-
// || compareIf(a, b, isArrayLikeEquatable, compareArrayLikeEquality, cache)
|
138
|
-
// || compareIf(a, b, isStructurallyEquatable, compareStructuralEquality, cache)
|
139
|
-
// || compareIf(a, b, isIterableEquatable, compareIterableEquality, cache)
|
140
|
-
// || cacheComparison(a, b, fail, cache);
|
141
|
-
// }
|
142
|
-
|
143
|
-
// function isValueOfEquatable(value) {
|
144
|
-
// return value instanceof Date;
|
145
|
-
// }
|
146
|
-
|
147
|
-
// function compareValueOfEquality(a, b) {
|
148
|
-
// return compareIf(a.valueOf(), b.valueOf(), isPrimitiveEquatable, comparePrimitiveEquality)
|
149
|
-
// || NOT_EQUAL;
|
150
|
-
// }
|
151
|
-
|
152
|
-
// function isToStringEquatable(value) {
|
153
|
-
// return value instanceof RegExp;
|
154
|
-
// }
|
155
|
-
|
156
|
-
// function compareToStringEquality(a, b) {
|
157
|
-
// return compareIf(a.toString(), b.toString(), isPrimitiveEquatable, comparePrimitiveEquality)
|
158
|
-
// || NOT_EQUAL;
|
159
|
-
// }
|
160
|
-
|
161
|
-
// function isArrayLikeEquatable(value) {
|
162
|
-
// return Array.isArray(value)
|
163
|
-
// || value instanceof Uint8Array
|
164
|
-
// || value instanceof Uint8ClampedArray
|
165
|
-
// || value instanceof Uint16Array
|
166
|
-
// || value instanceof Uint32Array
|
167
|
-
// || value instanceof Int8Array
|
168
|
-
// || value instanceof Int16Array
|
169
|
-
// || value instanceof Int32Array
|
170
|
-
// || value instanceof Float32Array
|
171
|
-
// || value instanceof Float64Array;
|
172
|
-
// }
|
173
|
-
|
174
|
-
// function compareArrayLikeEquality(a, b, cache) {
|
175
|
-
// if (a.length !== b.length) return NOT_EQUAL;
|
176
|
-
// for (var i = 0; i < a.length; i++) {
|
177
|
-
// if (compareEquality(a[i], b[i], cache) === NOT_EQUAL) {
|
178
|
-
// return NOT_EQUAL;
|
179
|
-
// }
|
180
|
-
// }
|
181
|
-
// return EQUAL;
|
182
|
-
// }
|
183
|
-
|
184
|
-
// function isStructurallyEquatable(value) {
|
185
|
-
// return !(value instanceof Promise // only comparable by reference
|
186
|
-
// || value instanceof WeakMap // only comparable by reference
|
187
|
-
// || value instanceof WeakSet // only comparable by reference
|
188
|
-
// || value instanceof Map // comparable via @@iterator
|
189
|
-
// || value instanceof Set); // comparable via @@iterator
|
190
|
-
// }
|
191
|
-
|
192
|
-
// function compareStructuralEquality(a, b, cache) {
|
193
|
-
// var aKeys = [];
|
194
|
-
// for (var key in a) aKeys.push(key);
|
195
|
-
|
196
|
-
// var bKeys = [];
|
197
|
-
// for (var key in b) bKeys.push(key);
|
198
|
-
|
199
|
-
// if (aKeys.length !== bKeys.length) {
|
200
|
-
// return NOT_EQUAL;
|
201
|
-
// }
|
202
|
-
|
203
|
-
// aKeys.sort();
|
204
|
-
// bKeys.sort();
|
205
|
-
|
206
|
-
// for (var i = 0; i < aKeys.length; i++) {
|
207
|
-
// var aKey = aKeys[i];
|
208
|
-
// var bKey = bKeys[i];
|
209
|
-
// if (compareEquality(aKey, bKey, cache) === NOT_EQUAL) {
|
210
|
-
// return NOT_EQUAL;
|
211
|
-
// }
|
212
|
-
// if (compareEquality(a[aKey], b[bKey], cache) === NOT_EQUAL) {
|
213
|
-
// return NOT_EQUAL;
|
214
|
-
// }
|
215
|
-
// }
|
216
|
-
|
217
|
-
// return EQUAL;
|
218
|
-
// }
|
219
|
-
|
220
|
-
// // hack: do iterables via for..of
|
221
|
-
// function isIterableEquatable(value) {
|
222
|
-
// try {
|
223
|
-
// for (const _ of value) { break; }
|
224
|
-
// return true;
|
225
|
-
// } catch {
|
226
|
-
// return false;
|
227
|
-
// }
|
228
|
-
// }
|
229
|
-
|
230
|
-
// function compareIterableEquality(a, b, cache) {
|
231
|
-
// let aValues = [];
|
232
|
-
// for (const x of a) aValues.push(x);
|
233
|
-
|
234
|
-
// let bValues = [];
|
235
|
-
// for (const x of b) bValues.push(x);
|
236
|
-
|
237
|
-
// return compareArrayLikeEquality(aValues, bValues, cache);
|
238
|
-
// }
|
239
|
-
|
240
|
-
// var __assert_deepEqual__compare = (a, b) => {
|
241
|
-
// return compareEquality(a, b) === EQUAL;
|
242
|
-
// };
|
243
|
-
|
244
|
-
// var __assert_deepEqual = (actual, expected) => {
|
245
|
-
// if (!assert.deepEqual._compare(actual, expected)) {
|
246
|
-
// throw new Test262Error('assert.deepEqual failed');
|
247
|
-
// }
|
248
|
-
// };
|
249
|
-
|
250
|
-
// __assert_deepEqual([], []);
|
251
|
-
|
252
|
-
// let x = {};
|
253
|
-
// x.__proto__ = { wow() { console.log(0); } };
|
254
|
-
// Object.defineProperty(x, '__proto__', { value: { wow() { console.log(1); } } });
|
255
|
-
// // x.__proto__ = { wow() { console.log(2); } };
|
256
|
-
// x.wow();
|
257
|
-
|
258
|
-
// var stringSet;
|
259
|
-
|
260
|
-
// class C {
|
261
|
-
// get #_() { console.log('get'); return 'get string'; }
|
262
|
-
// set #_(param) { console.log('set', param); stringSet = param; }
|
263
|
-
|
264
|
-
// getPrivateReference() {
|
265
|
-
// return this.#_;
|
266
|
-
// }
|
267
|
-
|
268
|
-
// setPrivateReference(value) {
|
269
|
-
// this.#_ = value;
|
270
|
-
// }
|
271
|
-
// };
|
272
|
-
|
273
|
-
// var inst = new C();
|
274
|
-
// console.log(inst.getPrivateReference());
|
275
|
-
// inst.setPrivateReference('set string');
|
276
|
-
// console.log(stringSet);
|
277
|
-
|
278
|
-
// let o = { set foo(x) { console.log('set foo', x); }, __proto__: { set bar(x) { console.log('set bar', x); } } };
|
279
|
-
|
280
|
-
// o.foo = 1;
|
281
|
-
// o.bar = 2;
|
1
|
+
Porffor.printString(TypeError('foo').toString());
|
282
2
|
|
283
3
|
// class C {
|
284
4
|
// // static #method = () => 1;
|