Skip to content

Commit ca61b6f

Browse files
committed
simplify
1 parent 2555bc1 commit ca61b6f

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

packages/svelte/src/compiler/phases/2-analyze/visitors/CallExpression.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ export function CallExpression(node, context) {
150150
break;
151151
}
152152

153-
if (context.state.expression && !is_known_safe_call(node, context)) {
153+
if (context.state.expression && !is_known_safe_call(node.callee, context)) {
154154
context.state.expression.has_call = true;
155155
context.state.expression.has_state = true;
156156
}

packages/svelte/src/compiler/phases/2-analyze/visitors/TaggedTemplateExpression.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { is_known_safe_call } from './shared/utils.js';
77
* @param {Context} context
88
*/
99
export function TaggedTemplateExpression(node, context) {
10-
if (context.state.expression && !is_known_safe_call(node, context)) {
10+
if (context.state.expression && !is_known_safe_call(node.tag, context)) {
1111
context.state.expression.has_call = true;
1212
context.state.expression.has_state = true;
1313
}

packages/svelte/src/compiler/phases/2-analyze/visitors/shared/utils.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,11 @@ export function is_safe_identifier(expression, scope) {
167167
}
168168

169169
/**
170-
* @param {TaggedTemplateExpression | CallExpression} node
170+
* @param {Expression | Super} callee
171171
* @param {Context} context
172172
* @returns {boolean}
173173
*/
174-
export function is_known_safe_call(node, context) {
175-
const callee = node.type === 'TaggedTemplateExpression' ? node.tag : node.callee;
176-
174+
export function is_known_safe_call(callee, context) {
177175
// String / Number / BigInt / Boolean casting calls
178176
if (callee.type === 'Identifier') {
179177
const name = callee.name;

0 commit comments

Comments
 (0)