(node: ElementNode, dir: DirectiveNode)
| 205 | } |
| 206 | |
| 207 | function 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 | |
| 219 | function createCodegenNodeForBranch( |
| 220 | branch: IfBranchNode, |