porffor 0.47.8 → 0.48.0
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/codegen.js +5 -1
- package/package.json +1 -1
- package/runner/index.js +1 -1
package/compiler/codegen.js
CHANGED
@@ -3014,7 +3014,6 @@ const generateVarDstr = (scope, kind, pattern, init, defaultValue, global) => {
|
|
3014
3014
|
}
|
3015
3015
|
}
|
3016
3016
|
|
3017
|
-
|
3018
3017
|
const topLevel = scope.name === 'main';
|
3019
3018
|
|
3020
3019
|
if (typeof pattern === 'string') {
|
@@ -3036,6 +3035,11 @@ const generateVarDstr = (scope, kind, pattern, init, defaultValue, global) => {
|
|
3036
3035
|
}
|
3037
3036
|
}
|
3038
3037
|
|
3038
|
+
if (defaultValue && isFuncType(defaultValue.type)) {
|
3039
|
+
// set id as name, but do not use it as it is only default value
|
3040
|
+
if (!defaultValue.id) defaultValue.id = { name };
|
3041
|
+
}
|
3042
|
+
|
3039
3043
|
if (topLevel && Object.hasOwn(builtinVars, name)) {
|
3040
3044
|
// cannot redeclare
|
3041
3045
|
if (kind !== 'var') return internalThrow(scope, 'SyntaxError', `Identifier '${unhackName(name)}' has already been declared`);
|
package/package.json
CHANGED