refactor(compiler): better constant hoist/stringify checks

This commit is contained in:
Evan You
2020-11-20 19:26:07 -05:00
parent acba86ef45
commit 90bdf59f4c
22 changed files with 291 additions and 204 deletions

View File

@@ -21,7 +21,8 @@ import {
createVNodeCall,
AttributeNode,
locStub,
CacheExpression
CacheExpression,
ConstantTypes
} from '../ast'
import { createCompilerError, ErrorCodes } from '../errors'
import { processExpression } from './transformExpression'
@@ -227,7 +228,12 @@ function createChildrenCodegenNode(
const { helper } = context
const keyProperty = createObjectProperty(
`key`,
createSimpleExpression(`${keyIndex}`, false, locStub, true)
createSimpleExpression(
`${keyIndex}`,
false,
locStub,
ConstantTypes.CAN_HOIST
)
)
const { children } = branch
const firstChild = children[0]