From 3107b57e2e9726985adef8fe56281988c89d5cdb Mon Sep 17 00:00:00 2001 From: Evan You Date: Sat, 13 Jul 2024 21:07:45 +0800 Subject: [PATCH] refactor: isVNode -> isVOnce --- packages/compiler-core/src/ast.ts | 6 +++--- packages/compiler-core/src/codegen.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/compiler-core/src/ast.ts b/packages/compiler-core/src/ast.ts index 562e24e72e3..bbbb7f8a19d 100644 --- a/packages/compiler-core/src/ast.ts +++ b/packages/compiler-core/src/ast.ts @@ -416,7 +416,7 @@ export interface CacheExpression extends Node { type: NodeTypes.JS_CACHE_EXPRESSION index: number value: JSChildNode - isVNode: boolean + isVOnce: boolean } export interface MemoExpression extends CallExpression { @@ -771,13 +771,13 @@ export function createConditionalExpression( export function createCacheExpression( index: number, value: JSChildNode, - isVNode: boolean = false, + isVOnce: boolean = false, ): CacheExpression { return { type: NodeTypes.JS_CACHE_EXPRESSION, index, value, - isVNode, + isVOnce, loc: locStub, } } diff --git a/packages/compiler-core/src/codegen.ts b/packages/compiler-core/src/codegen.ts index 4dd51133ce7..392896d6082 100644 --- a/packages/compiler-core/src/codegen.ts +++ b/packages/compiler-core/src/codegen.ts @@ -1037,14 +1037,14 @@ function genConditionalExpression( function genCacheExpression(node: CacheExpression, context: CodegenContext) { const { push, helper, indent, deindent, newline } = context push(`_cache[${node.index}] || (`) - if (node.isVNode) { + if (node.isVOnce) { indent() push(`${helper(SET_BLOCK_TRACKING)}(-1),`) newline() } push(`_cache[${node.index}] = `) genNode(node.value, context) - if (node.isVNode) { + if (node.isVOnce) { push(`,`) newline() push(`${helper(SET_BLOCK_TRACKING)}(1),`)