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