refactor(compiler): use shorter helpers for text and comment nodes

This commit is contained in:
Evan You
2019-10-24 17:55:00 -04:00
parent eb20730a67
commit 1c0a2c6d41
19 changed files with 126 additions and 108 deletions

View File

@@ -30,10 +30,10 @@ import { processExpression } from './transformExpression'
import {
OPEN_BLOCK,
CREATE_BLOCK,
COMMENT,
FRAGMENT,
WITH_DIRECTIVES,
CREATE_VNODE
CREATE_VNODE,
CREATE_COMMENT
} from '../runtimeHelpers'
import { injectProp } from '../utils'
@@ -152,9 +152,7 @@ function createCodegenNodeForBranch(
return createConditionalExpression(
branch.condition,
createChildrenCodegenNode(branch, index, context),
createCallExpression(context.helper(CREATE_BLOCK), [
context.helper(COMMENT)
])
createCallExpression(context.helper(CREATE_COMMENT))
) as IfConditionalExpression
} else {
return createChildrenCodegenNode(branch, index, context) as BlockCodegenNode