MCPcopy
hub / github.com/vuejs/core / createIfBranch

Function createIfBranch

packages/compiler-core/src/transforms/vIf.ts:207–217  ·  view source on GitHub ↗
(node: ElementNode, dir: DirectiveNode)

Source from the content-addressed store, hash-verified

205}
206
207function createIfBranch(node: ElementNode, dir: DirectiveNode): IfBranchNode {
208 const isTemplateIf = node.tagType === ElementTypes.TEMPLATE
209 return {
210 type: NodeTypes.IF_BRANCH,
211 loc: node.loc,
212 condition: dir.name === 'else' ? undefined : dir.exp,
213 children: isTemplateIf && !findDir(node, 'for') ? node.children : [node],
214 userKey: findProp(node, `key`),
215 isTemplateIf,
216 }
217}
218
219function createCodegenNodeForBranch(
220 branch: IfBranchNode,

Callers 1

processIfFunction · 0.85

Calls 2

findDirFunction · 0.90
findPropFunction · 0.90

Tested by

no test coverage detected