porffor 0.60.3 → 0.60.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/builtins/_internal_object.ts +5 -5
- package/compiler/builtins/array.ts +1 -1
- package/compiler/builtins/date.ts +1 -1
- package/compiler/builtins/json.ts +2 -2
- package/compiler/builtins/object.ts +1 -2
- package/compiler/builtins/object_hiddenPrototype.js +1 -2
- package/compiler/builtins/typedarray.js +3 -3
- package/compiler/builtins/z_ecma262.ts +4 -6
- package/compiler/builtins_precompiled.js +40 -40
- package/compiler/codegen.js +5 -27
- package/foo.js +9 -0
- package/package.json +1 -1
- package/runtime/index.js +1 -1
package/compiler/codegen.js
CHANGED
@@ -4292,8 +4292,6 @@ const generateUnary = (scope, decl) => {
|
|
4292
4292
|
if (object.type === 'Super') return internalThrow(scope, 'ReferenceError', 'Cannot delete super property', true);
|
4293
4293
|
|
4294
4294
|
const property = getProperty(decl.argument);
|
4295
|
-
if (property.value === 'length' || property.value === 'name') scope.noFastFuncMembers = true;
|
4296
|
-
|
4297
4295
|
const coctc = coctcOffset(decl.argument);
|
4298
4296
|
const objectTmp = coctc > 0 && localTmp(scope, '#coctc_object', Valtype.i32);
|
4299
4297
|
|
@@ -5808,19 +5806,7 @@ const generateMember = (scope, decl, _global, _name) => {
|
|
5808
5806
|
let final = [], finalEnd, extraBC = {};
|
5809
5807
|
let name = decl.object.name;
|
5810
5808
|
|
5811
|
-
// todo: handle globalThis.foo
|
5812
|
-
|
5813
|
-
// hack: .name
|
5814
|
-
if (decl.property.name === 'name' && hasFuncWithName(name) && !scope.noFastFuncMembers) {
|
5815
|
-
// function name can mismatch variable/access name
|
5816
|
-
name = funcByName(name)?.name ?? name;
|
5817
|
-
|
5818
|
-
// eg: __String_prototype_toLowerCase -> toLowerCase
|
5819
|
-
if (name.startsWith('__')) name = name.split('_').pop();
|
5820
|
-
if (name.startsWith('#')) name = '';
|
5821
|
-
|
5822
|
-
return withType(scope, makeString(scope, name, true), TYPES.bytestring);
|
5823
|
-
}
|
5809
|
+
// todo: handle globalThis.foo efficiently
|
5824
5810
|
|
5825
5811
|
const object = decl.object;
|
5826
5812
|
const property = getProperty(decl);
|
@@ -5837,16 +5823,6 @@ const generateMember = (scope, decl, _global, _name) => {
|
|
5837
5823
|
// hack: .length
|
5838
5824
|
if (decl.property.name === 'length') {
|
5839
5825
|
// todo: support optional
|
5840
|
-
|
5841
|
-
if (!scope.noFastFuncMembers) {
|
5842
|
-
const func = funcByName(name);
|
5843
|
-
if (func) return withType(scope, [ number(countLength(func, name)) ], TYPES.number);
|
5844
|
-
|
5845
|
-
if (Object.hasOwn(builtinFuncs, name)) return withType(scope, [ number(countLength(builtinFuncs[name], name)) ], TYPES.number);
|
5846
|
-
if (Object.hasOwn(importedFuncs, name)) return withType(scope, [ number(importedFuncs[name].params.length) ], TYPES.number);
|
5847
|
-
if (Object.hasOwn(internalConstrs, name)) return withType(scope, [ number(internalConstrs[name].length ?? 0) ], TYPES.number);
|
5848
|
-
}
|
5849
|
-
|
5850
5826
|
const out = [
|
5851
5827
|
...generate(scope, object),
|
5852
5828
|
Opcodes.i32_to_u
|
@@ -6257,7 +6233,8 @@ const generateAwait = (scope, decl) => {
|
|
6257
6233
|
const generateClass = (scope, decl) => {
|
6258
6234
|
const expr = decl.type === 'ClassExpression';
|
6259
6235
|
|
6260
|
-
|
6236
|
+
if (!decl.id) decl.id = { type: 'Identifier', name: `#anonymous${uniqId()}` };
|
6237
|
+
const name = decl.id.name;
|
6261
6238
|
if (!expr) hoist(scope, name, 2, true);
|
6262
6239
|
|
6263
6240
|
const body = decl.body.body;
|
@@ -6732,7 +6709,8 @@ const builtinFuncByName = name => {
|
|
6732
6709
|
const generateFunc = (scope, decl, forceNoExpr = false) => {
|
6733
6710
|
doNotMarkFuncRef = false;
|
6734
6711
|
|
6735
|
-
|
6712
|
+
if (!decl.id) decl.id = { type: 'Identifier', name: `#anonymous${uniqId()}` };
|
6713
|
+
const name = decl.id.name;
|
6736
6714
|
if (decl.type.startsWith('Class')) {
|
6737
6715
|
const out = generateClass(scope, {
|
6738
6716
|
...decl,
|
package/foo.js
ADDED
package/package.json
CHANGED