Skip to content

Commit 3df3354

Browse files
committed
fix(compiler-core): check if expression is constant
closes #7973
1 parent 63ad77f commit 3df3354

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

packages/compiler-core/src/transforms/transformExpression.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,11 @@ export function processExpression(
128128
const isDestructureAssignment =
129129
parent && isInDestructureAssignment(parent, parentStack)
130130

131-
if (isConst(type) || localVars[raw]) {
131+
if (
132+
isConst(type) ||
133+
type === BindingTypes.SETUP_REACTIVE_CONST ||
134+
localVars[raw]
135+
) {
132136
return raw
133137
} else if (type === BindingTypes.SETUP_REF) {
134138
return `${raw}.value`
@@ -371,8 +375,6 @@ export function stringifyExpression(exp: ExpressionNode | string): string {
371375

372376
function isConst(type: unknown) {
373377
return (
374-
type === BindingTypes.SETUP_CONST ||
375-
type === BindingTypes.LITERAL_CONST ||
376-
type === BindingTypes.SETUP_REACTIVE_CONST
378+
type === BindingTypes.SETUP_CONST || type === BindingTypes.LITERAL_CONST
377379
)
378380
}

0 commit comments

Comments
 (0)