fix: ensure dynamic call expressions correctly generate output (#14345)

pull/14348/head
Dominic Gannaway 1 month ago committed by GitHub
parent 24ebbcbbc1
commit 1c454c236e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: ensure dynamic call expressions correctly generate output

@ -5,6 +5,7 @@ import { get_rune } from '../../scope.js';
import * as e from '../../../errors.js'; import * as e from '../../../errors.js';
import { get_parent, unwrap_optional } from '../../../utils/ast.js'; import { get_parent, unwrap_optional } from '../../../utils/ast.js';
import { is_pure, is_safe_identifier } from './shared/utils.js'; import { is_pure, is_safe_identifier } from './shared/utils.js';
import { mark_subtree_dynamic } from './shared/fragment.js';
/** /**
* @param {CallExpression} node * @param {CallExpression} node
@ -179,6 +180,7 @@ export function CallExpression(node, context) {
context.state.expression.has_call = true; context.state.expression.has_call = true;
context.state.expression.has_state = true; context.state.expression.has_state = true;
context.state.expression.can_inline = false; context.state.expression.can_inline = false;
mark_subtree_dynamic(context.path);
} }
} }
} }

@ -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>'
});

@ -0,0 +1,4 @@
<span class={(() => 'red')()}>A</span>
<div>
<span class={(() => 'red')()}>B</span>
</div>
Loading…
Cancel
Save