porffor 0.17.0-b598eb7bb → 0.17.0-b92c546cf
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.
@@ -26,7 +26,12 @@ export const ${name}$constructor = (arg: any): ${name} => {
|
|
26
26
|
|
27
27
|
out.length = len;
|
28
28
|
return out;
|
29
|
-
}
|
29
|
+
};
|
30
|
+
|
31
|
+
export const __${name}_prototype_byteLength$get = (_this: ${name}) => {
|
32
|
+
return _this.length * ${name}.BYTES_PER_ELEMENT;
|
33
|
+
};
|
34
|
+
`;
|
30
35
|
|
31
36
|
constr('Uint8Array');
|
32
37
|
constr('Int8Array');
|
package/compiler/codegen.js
CHANGED
@@ -3901,7 +3901,7 @@ const generateMember = (scope, decl, _global, _name) => {
|
|
3901
3901
|
}
|
3902
3902
|
|
3903
3903
|
// todo: generate this array procedurally during builtinFuncs creation
|
3904
|
-
if (['size', 'description'].includes(decl.property.name)) {
|
3904
|
+
if (['size', 'description', 'byteLength'].includes(decl.property.name)) {
|
3905
3905
|
const bc = {};
|
3906
3906
|
const cands = Object.keys(builtinFuncs).filter(x => x.startsWith('__') && x.endsWith('_prototype_' + decl.property.name + '$get'));
|
3907
3907
|
|
@@ -4107,7 +4107,7 @@ const objectHack = node => {
|
|
4107
4107
|
if (!objectName) objectName = objectHack(node.object)?.name?.slice?.(2);
|
4108
4108
|
|
4109
4109
|
// if .name or .length, give up (hack within a hack!)
|
4110
|
-
if (['name', 'length', 'size', 'description'].includes(node.property.name)) {
|
4110
|
+
if (['name', 'length', 'size', 'description', 'byteLength'].includes(node.property.name)) {
|
4111
4111
|
node.object = objectHack(node.object);
|
4112
4112
|
return;
|
4113
4113
|
}
|
@@ -2213,6 +2213,15 @@ export const BuiltinFuncs = function() {
|
|
2213
2213
|
locals: [124,124,124,124,127,127,127,124,127,124,127,127,124],
|
2214
2214
|
localNames: ["arg","arg#type","out","len","type","i","forof_base_pointer","forof_length","forof_counter","x","x#type","__member_setter_val_tmp","#last_type","#typeswitch_tmp","__length_setter_tmp"],
|
2215
2215
|
};
|
2216
|
+
this.__Uint8Array_prototype_byteLength$get = {
|
2217
|
+
wasm: (scope, {}) => [[32,0],[252,3],[40,1,0],[184],[68,0,0,0,0,0,0,240,63],[162],[65,0],[15]],
|
2218
|
+
params: [124,127],
|
2219
|
+
typedParams: true,
|
2220
|
+
returns: [124,127],
|
2221
|
+
typedReturns: true,
|
2222
|
+
locals: [],
|
2223
|
+
localNames: ["_this","_this#type"],
|
2224
|
+
};
|
2216
2225
|
this.Int8Array = {
|
2217
2226
|
wasm: (scope, {internalThrow,}) => [...internalThrow(scope, 'TypeError', `Constructor Int8Array requires 'new'`),[68,0,0,0,0,0,0,0,0],[65,3],[15]],
|
2218
2227
|
params: [],
|
@@ -2231,6 +2240,15 @@ export const BuiltinFuncs = function() {
|
|
2231
2240
|
locals: [124,124,124,124,127,127,127,124,127,124,127,127,124],
|
2232
2241
|
localNames: ["arg","arg#type","out","len","type","i","forof_base_pointer","forof_length","forof_counter","x","x#type","__member_setter_val_tmp","#last_type","#typeswitch_tmp","__length_setter_tmp"],
|
2233
2242
|
};
|
2243
|
+
this.__Int8Array_prototype_byteLength$get = {
|
2244
|
+
wasm: (scope, {}) => [[32,0],[252,3],[40,1,0],[184],[68,0,0,0,0,0,0,240,63],[162],[65,0],[15]],
|
2245
|
+
params: [124,127],
|
2246
|
+
typedParams: true,
|
2247
|
+
returns: [124,127],
|
2248
|
+
typedReturns: true,
|
2249
|
+
locals: [],
|
2250
|
+
localNames: ["_this","_this#type"],
|
2251
|
+
};
|
2234
2252
|
this.Uint8ClampedArray = {
|
2235
2253
|
wasm: (scope, {internalThrow,}) => [...internalThrow(scope, 'TypeError', `Constructor Uint8ClampedArray requires 'new'`),[68,0,0,0,0,0,0,0,0],[65,3],[15]],
|
2236
2254
|
params: [],
|
@@ -2249,6 +2267,15 @@ export const BuiltinFuncs = function() {
|
|
2249
2267
|
locals: [124,124,124,124,127,127,127,124,127,124,127,127,124],
|
2250
2268
|
localNames: ["arg","arg#type","out","len","type","i","forof_base_pointer","forof_length","forof_counter","x","x#type","__member_setter_val_tmp","#last_type","#typeswitch_tmp","__length_setter_tmp"],
|
2251
2269
|
};
|
2270
|
+
this.__Uint8ClampedArray_prototype_byteLength$get = {
|
2271
|
+
wasm: (scope, {}) => [[32,0],[252,3],[40,1,0],[184],[68,0,0,0,0,0,0,240,63],[162],[65,0],[15]],
|
2272
|
+
params: [124,127],
|
2273
|
+
typedParams: true,
|
2274
|
+
returns: [124,127],
|
2275
|
+
typedReturns: true,
|
2276
|
+
locals: [],
|
2277
|
+
localNames: ["_this","_this#type"],
|
2278
|
+
};
|
2252
2279
|
this.Uint16Array = {
|
2253
2280
|
wasm: (scope, {internalThrow,}) => [...internalThrow(scope, 'TypeError', `Constructor Uint16Array requires 'new'`),[68,0,0,0,0,0,0,0,0],[65,3],[15]],
|
2254
2281
|
params: [],
|
@@ -2267,6 +2294,15 @@ export const BuiltinFuncs = function() {
|
|
2267
2294
|
locals: [124,124,124,124,127,127,127,124,127,124,127,127,124],
|
2268
2295
|
localNames: ["arg","arg#type","out","len","type","i","forof_base_pointer","forof_length","forof_counter","x","x#type","__member_setter_val_tmp","#last_type","#typeswitch_tmp","__length_setter_tmp"],
|
2269
2296
|
};
|
2297
|
+
this.__Uint16Array_prototype_byteLength$get = {
|
2298
|
+
wasm: (scope, {}) => [[32,0],[252,3],[40,1,0],[184],[68,0,0,0,0,0,0,0,64],[162],[65,0],[15]],
|
2299
|
+
params: [124,127],
|
2300
|
+
typedParams: true,
|
2301
|
+
returns: [124,127],
|
2302
|
+
typedReturns: true,
|
2303
|
+
locals: [],
|
2304
|
+
localNames: ["_this","_this#type"],
|
2305
|
+
};
|
2270
2306
|
this.Int16Array = {
|
2271
2307
|
wasm: (scope, {internalThrow,}) => [...internalThrow(scope, 'TypeError', `Constructor Int16Array requires 'new'`),[68,0,0,0,0,0,0,0,0],[65,3],[15]],
|
2272
2308
|
params: [],
|
@@ -2285,6 +2321,15 @@ export const BuiltinFuncs = function() {
|
|
2285
2321
|
locals: [124,124,124,124,127,127,127,124,127,124,127,127,124],
|
2286
2322
|
localNames: ["arg","arg#type","out","len","type","i","forof_base_pointer","forof_length","forof_counter","x","x#type","__member_setter_val_tmp","#last_type","#typeswitch_tmp","__length_setter_tmp"],
|
2287
2323
|
};
|
2324
|
+
this.__Int16Array_prototype_byteLength$get = {
|
2325
|
+
wasm: (scope, {}) => [[32,0],[252,3],[40,1,0],[184],[68,0,0,0,0,0,0,0,64],[162],[65,0],[15]],
|
2326
|
+
params: [124,127],
|
2327
|
+
typedParams: true,
|
2328
|
+
returns: [124,127],
|
2329
|
+
typedReturns: true,
|
2330
|
+
locals: [],
|
2331
|
+
localNames: ["_this","_this#type"],
|
2332
|
+
};
|
2288
2333
|
this.Uint32Array = {
|
2289
2334
|
wasm: (scope, {internalThrow,}) => [...internalThrow(scope, 'TypeError', `Constructor Uint32Array requires 'new'`),[68,0,0,0,0,0,0,0,0],[65,3],[15]],
|
2290
2335
|
params: [],
|
@@ -2303,6 +2348,15 @@ export const BuiltinFuncs = function() {
|
|
2303
2348
|
locals: [124,124,124,124,127,127,127,124,127,124,127,127,124],
|
2304
2349
|
localNames: ["arg","arg#type","out","len","type","i","forof_base_pointer","forof_length","forof_counter","x","x#type","__member_setter_val_tmp","#last_type","#typeswitch_tmp","__length_setter_tmp"],
|
2305
2350
|
};
|
2351
|
+
this.__Uint32Array_prototype_byteLength$get = {
|
2352
|
+
wasm: (scope, {}) => [[32,0],[252,3],[40,1,0],[184],[68,0,0,0,0,0,0,16,64],[162],[65,0],[15]],
|
2353
|
+
params: [124,127],
|
2354
|
+
typedParams: true,
|
2355
|
+
returns: [124,127],
|
2356
|
+
typedReturns: true,
|
2357
|
+
locals: [],
|
2358
|
+
localNames: ["_this","_this#type"],
|
2359
|
+
};
|
2306
2360
|
this.Int32Array = {
|
2307
2361
|
wasm: (scope, {internalThrow,}) => [...internalThrow(scope, 'TypeError', `Constructor Int32Array requires 'new'`),[68,0,0,0,0,0,0,0,0],[65,3],[15]],
|
2308
2362
|
params: [],
|
@@ -2321,6 +2375,15 @@ export const BuiltinFuncs = function() {
|
|
2321
2375
|
locals: [124,124,124,124,127,127,127,124,127,124,127,127,124],
|
2322
2376
|
localNames: ["arg","arg#type","out","len","type","i","forof_base_pointer","forof_length","forof_counter","x","x#type","__member_setter_val_tmp","#last_type","#typeswitch_tmp","__length_setter_tmp"],
|
2323
2377
|
};
|
2378
|
+
this.__Int32Array_prototype_byteLength$get = {
|
2379
|
+
wasm: (scope, {}) => [[32,0],[252,3],[40,1,0],[184],[68,0,0,0,0,0,0,16,64],[162],[65,0],[15]],
|
2380
|
+
params: [124,127],
|
2381
|
+
typedParams: true,
|
2382
|
+
returns: [124,127],
|
2383
|
+
typedReturns: true,
|
2384
|
+
locals: [],
|
2385
|
+
localNames: ["_this","_this#type"],
|
2386
|
+
};
|
2324
2387
|
this.Float32Array = {
|
2325
2388
|
wasm: (scope, {internalThrow,}) => [...internalThrow(scope, 'TypeError', `Constructor Float32Array requires 'new'`),[68,0,0,0,0,0,0,0,0],[65,3],[15]],
|
2326
2389
|
params: [],
|
@@ -2339,6 +2402,15 @@ export const BuiltinFuncs = function() {
|
|
2339
2402
|
locals: [124,124,124,124,127,127,127,124,127,124,127,127,124],
|
2340
2403
|
localNames: ["arg","arg#type","out","len","type","i","forof_base_pointer","forof_length","forof_counter","x","x#type","__member_setter_val_tmp","#last_type","#typeswitch_tmp","__length_setter_tmp"],
|
2341
2404
|
};
|
2405
|
+
this.__Float32Array_prototype_byteLength$get = {
|
2406
|
+
wasm: (scope, {}) => [[32,0],[252,3],[40,1,0],[184],[68,0,0,0,0,0,0,16,64],[162],[65,0],[15]],
|
2407
|
+
params: [124,127],
|
2408
|
+
typedParams: true,
|
2409
|
+
returns: [124,127],
|
2410
|
+
typedReturns: true,
|
2411
|
+
locals: [],
|
2412
|
+
localNames: ["_this","_this#type"],
|
2413
|
+
};
|
2342
2414
|
this.Float64Array = {
|
2343
2415
|
wasm: (scope, {internalThrow,}) => [...internalThrow(scope, 'TypeError', `Constructor Float64Array requires 'new'`),[68,0,0,0,0,0,0,0,0],[65,3],[15]],
|
2344
2416
|
params: [],
|
@@ -2357,6 +2429,15 @@ export const BuiltinFuncs = function() {
|
|
2357
2429
|
locals: [124,124,124,124,127,127,127,124,127,124,127,127,124],
|
2358
2430
|
localNames: ["arg","arg#type","out","len","type","i","forof_base_pointer","forof_length","forof_counter","x","x#type","__member_setter_val_tmp","#last_type","#typeswitch_tmp","__length_setter_tmp"],
|
2359
2431
|
};
|
2432
|
+
this.__Float64Array_prototype_byteLength$get = {
|
2433
|
+
wasm: (scope, {}) => [[32,0],[252,3],[40,1,0],[184],[68,0,0,0,0,0,0,32,64],[162],[65,0],[15]],
|
2434
|
+
params: [124,127],
|
2435
|
+
typedParams: true,
|
2436
|
+
returns: [124,127],
|
2437
|
+
typedReturns: true,
|
2438
|
+
locals: [],
|
2439
|
+
localNames: ["_this","_this#type"],
|
2440
|
+
};
|
2360
2441
|
this.__ecma262_ToIntegerOrInfinity = {
|
2361
2442
|
wasm: (scope, {builtin,}) => [[32,0],[16, builtin('Number')],[34,2],[16, builtin('__Number_isNaN')],[252,3],[4,64],[68,0,0,0,0,0,0,0,0],[15],[11],[32,2],[16, builtin('__Number_isFinite')],[68,0,0,0,0,0,0,0,0],[97],[4,64],[32,2],[15],[11],[32,2],[16, builtin('__Math_trunc')],[34,2],[68,0,0,0,0,0,0,0,0],[97],[4,64],[68,0,0,0,0,0,0,0,0],[15],[11],[32,2],[15]],
|
2362
2443
|
params: [124,127],
|
package/package.json
CHANGED