feat(compiler-core): more hoisting optimizations (#276)

This commit is contained in:
HcySunYang
2019-10-15 23:41:24 +08:00
committed by Evan You
parent 9a37c4b2c3
commit 68a3879b88
11 changed files with 373 additions and 15 deletions

View File

@@ -564,9 +564,12 @@ function parseAttribute(
)
let content = match[2]
let isStatic = true
// Non-dynamic arg is a constant.
let isConstant = true
if (content.startsWith('[')) {
isStatic = false
isConstant = false
if (!content.endsWith(']')) {
emitError(
@@ -582,6 +585,7 @@ function parseAttribute(
type: NodeTypes.SIMPLE_EXPRESSION,
content,
isStatic,
isConstant,
loc
}
}
@@ -607,6 +611,8 @@ function parseAttribute(
type: NodeTypes.SIMPLE_EXPRESSION,
content: value.content,
isStatic: false,
// Set `isConstant` to false by default and will decide in transformExpression
isConstant: false,
loc: value.loc
},
arg,
@@ -713,6 +719,8 @@ function parseInterpolation(
content: {
type: NodeTypes.SIMPLE_EXPRESSION,
isStatic: false,
// Set `isConstant` to false by default and will decide in transformExpression
isConstant: false,
content,
loc: getSelection(context, innerStart, innerEnd)
},