@next-core/cook 2.4.5 → 2.4.6
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/dist/cjs/cook.js +18 -0
- package/dist/cjs/cook.js.map +1 -1
- package/dist/esm/cook.js +18 -0
- package/dist/esm/cook.js.map +1 -1
- package/package.json +2 -2
package/dist/esm/cook.js
CHANGED
|
@@ -1361,6 +1361,11 @@ export function cook(rootAst, codeSource) {
|
|
|
1361
1361
|
value: lexicalThis ? Mode.LEXICAL : Mode.STRICT
|
|
1362
1362
|
}
|
|
1363
1363
|
});
|
|
1364
|
+
const len = ExpectedArgumentCount(sourceNode.params);
|
|
1365
|
+
Object.defineProperty(F, "length", {
|
|
1366
|
+
configurable: true,
|
|
1367
|
+
value: len
|
|
1368
|
+
});
|
|
1364
1369
|
if (debug || externalSourceForDebug) {
|
|
1365
1370
|
Object.defineProperty(F, DebuggerCall, {
|
|
1366
1371
|
value: function () {
|
|
@@ -1371,6 +1376,19 @@ export function cook(rootAst, codeSource) {
|
|
|
1371
1376
|
}
|
|
1372
1377
|
return F;
|
|
1373
1378
|
}
|
|
1379
|
+
function ExpectedArgumentCount(params) {
|
|
1380
|
+
let count = 0;
|
|
1381
|
+
for (const param of params) {
|
|
1382
|
+
switch (param.type) {
|
|
1383
|
+
case "AssignmentPattern":
|
|
1384
|
+
case "RestElement":
|
|
1385
|
+
return count;
|
|
1386
|
+
default:
|
|
1387
|
+
count++;
|
|
1388
|
+
}
|
|
1389
|
+
}
|
|
1390
|
+
return count;
|
|
1391
|
+
}
|
|
1374
1392
|
|
|
1375
1393
|
// Patterns initialization.
|
|
1376
1394
|
// https://tc39.es/ecma262/#sec-runtime-semantics-bindinginitialization
|