mirror of https://github.com/vuejs/core.git
refactor: isVNode -> isVOnce
This commit is contained in:
parent
2815531fd5
commit
3107b57e2e
|
@ -416,7 +416,7 @@ export interface CacheExpression extends Node {
|
||||||
type: NodeTypes.JS_CACHE_EXPRESSION
|
type: NodeTypes.JS_CACHE_EXPRESSION
|
||||||
index: number
|
index: number
|
||||||
value: JSChildNode
|
value: JSChildNode
|
||||||
isVNode: boolean
|
isVOnce: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MemoExpression extends CallExpression {
|
export interface MemoExpression extends CallExpression {
|
||||||
|
@ -771,13 +771,13 @@ export function createConditionalExpression(
|
||||||
export function createCacheExpression(
|
export function createCacheExpression(
|
||||||
index: number,
|
index: number,
|
||||||
value: JSChildNode,
|
value: JSChildNode,
|
||||||
isVNode: boolean = false,
|
isVOnce: boolean = false,
|
||||||
): CacheExpression {
|
): CacheExpression {
|
||||||
return {
|
return {
|
||||||
type: NodeTypes.JS_CACHE_EXPRESSION,
|
type: NodeTypes.JS_CACHE_EXPRESSION,
|
||||||
index,
|
index,
|
||||||
value,
|
value,
|
||||||
isVNode,
|
isVOnce,
|
||||||
loc: locStub,
|
loc: locStub,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1037,14 +1037,14 @@ function genConditionalExpression(
|
||||||
function genCacheExpression(node: CacheExpression, context: CodegenContext) {
|
function genCacheExpression(node: CacheExpression, context: CodegenContext) {
|
||||||
const { push, helper, indent, deindent, newline } = context
|
const { push, helper, indent, deindent, newline } = context
|
||||||
push(`_cache[${node.index}] || (`)
|
push(`_cache[${node.index}] || (`)
|
||||||
if (node.isVNode) {
|
if (node.isVOnce) {
|
||||||
indent()
|
indent()
|
||||||
push(`${helper(SET_BLOCK_TRACKING)}(-1),`)
|
push(`${helper(SET_BLOCK_TRACKING)}(-1),`)
|
||||||
newline()
|
newline()
|
||||||
}
|
}
|
||||||
push(`_cache[${node.index}] = `)
|
push(`_cache[${node.index}] = `)
|
||||||
genNode(node.value, context)
|
genNode(node.value, context)
|
||||||
if (node.isVNode) {
|
if (node.isVOnce) {
|
||||||
push(`,`)
|
push(`,`)
|
||||||
newline()
|
newline()
|
||||||
push(`${helper(SET_BLOCK_TRACKING)}(1),`)
|
push(`${helper(SET_BLOCK_TRACKING)}(1),`)
|
||||||
|
|
Loading…
Reference in New Issue