Skip to content

Commit 2344b40

Browse files
authored
fix: replace undefined with void(0) in CallExpressions (#16693)
* fix: replace `undefined` with `void(0)` in CallExpressions * tweak comment
1 parent be645b4 commit 2344b40

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.changeset/ninety-olives-report.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: replace `undefined` with `void(0)` in CallExpressions

packages/svelte/src/compiler/utils/builders.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,15 @@ export function call(callee, ...args) {
100100
if (typeof callee === 'string') callee = id(callee);
101101
args = args.slice();
102102

103-
// replacing missing arguments with `undefined`, unless they're at the end in which case remove them
103+
// replacing missing arguments with `void(0)`, unless they're at the end in which case remove them
104104
let i = args.length;
105105
let popping = true;
106106
while (i--) {
107107
if (!args[i]) {
108108
if (popping) {
109109
args.pop();
110110
} else {
111-
args[i] = id('undefined');
111+
args[i] = void0;
112112
}
113113
} else {
114114
popping = false;

0 commit comments

Comments
 (0)