Browse Source

refactor(compile-vapor): remove unused ifBranchCount and ifBranch properties (#14339)

edison 3 months ago
parent
commit
d2e7cd2d47

+ 1 - 4
packages/compiler-vapor/src/generators/template.ts

@@ -71,7 +71,6 @@ export function genChildren(
 
   let offset = 0
   let prev: [variable: string, elementIndex: number] | undefined
-  let ifBranchCount = 0
   let prependCount = 0
 
   for (const [index, child] of children.entries()) {
@@ -83,8 +82,6 @@ export function genChildren(
     }
     if (child.flags & DynamicFlag.NON_TEMPLATE) {
       offset--
-    } else if (child.ifBranch) {
-      ifBranchCount++
     }
 
     const id =
@@ -100,7 +97,7 @@ export function genChildren(
     }
 
     const elementIndex = index + offset
-    const logicalIndex = elementIndex - ifBranchCount + prependCount
+    const logicalIndex = elementIndex + prependCount
     // p for "placeholder" variables that are meant for possible reuse by
     // other access paths
     const variable =

+ 0 - 1
packages/compiler-vapor/src/ir/index.ts

@@ -268,7 +268,6 @@ export interface IRDynamicInfo {
   template?: number
   hasDynamicChild?: boolean
   operation?: OperationNode
-  ifBranch?: boolean
 }
 
 export interface IREffect {

+ 0 - 1
packages/compiler-vapor/src/transforms/vIf.ts

@@ -59,7 +59,6 @@ export function processIf(
   } else {
     // check the adjacent v-if
     const siblingIf = getSiblingIf(context, true)
-    context.dynamic.ifBranch = true
 
     const siblings = context.parent && context.parent.dynamic.children
     let lastIfNode