Skip to content

Commit

Permalink
fix: ensure dynamic call expressions correctly generate output (#14345)
Browse files Browse the repository at this point in the history
  • Loading branch information
trueadm authored Nov 18, 2024
1 parent 24ebbcb commit 1c454c2
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/moody-bears-change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte': patch
---

fix: ensure dynamic call expressions correctly generate output
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { get_rune } from '../../scope.js';
import * as e from '../../../errors.js';
import { get_parent, unwrap_optional } from '../../../utils/ast.js';
import { is_pure, is_safe_identifier } from './shared/utils.js';
import { mark_subtree_dynamic } from './shared/fragment.js';

/**
* @param {CallExpression} node
Expand Down Expand Up @@ -179,6 +180,7 @@ export function CallExpression(node, context) {
context.state.expression.has_call = true;
context.state.expression.has_state = true;
context.state.expression.can_inline = false;
mark_subtree_dynamic(context.path);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { test } from '../../test';

export default test({
html: '<span class="red">A</span>\n<div><span class="red">B</span></div>'
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<span class={(() => 'red')()}>A</span>
<div>
<span class={(() => 'red')()}>B</span>
</div>

0 comments on commit 1c454c2

Please sign in to comment.