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

Function createCodegenNodeForBranch

packages/compiler-core/src/transforms/vIf.ts:219–238  ·  view source on GitHub ↗
(
  branch: IfBranchNode,
  keyIndex: number,
  context: TransformContext,
)

Source from the content-addressed store, hash-verified

217}
218
219function createCodegenNodeForBranch(
220 branch: IfBranchNode,
221 keyIndex: number,
222 context: TransformContext,
223): IfConditionalExpression | BlockCodegenNode | MemoExpression {
224 if (branch.condition) {
225 return createConditionalExpression(
226 branch.condition,
227 createChildrenCodegenNode(branch, keyIndex, context),
228 // make sure to pass in asBlock: true so that the comment node call
229 // closes the current block.
230 createCallExpression(context.helper(CREATE_COMMENT), [
231 __DEV__ ? '"v-if"' : '""',
232 'true',
233 ]),
234 ) as IfConditionalExpression
235 } else {
236 return createChildrenCodegenNode(branch, keyIndex, context)
237 }
238}
239
240function createChildrenCodegenNode(
241 branch: IfBranchNode,

Callers 1

vIf.tsFile · 0.85

Calls 4

createCallExpressionFunction · 0.90
helperMethod · 0.65

Tested by

no test coverage detected