fix(compiler-core): fix hoisting logic for elements with cached handlers + other bindings
fix #4327
This commit is contained in:
@@ -335,16 +335,17 @@ function getGeneratedPropsConstantType(
|
||||
if (keyType < returnType) {
|
||||
returnType = keyType
|
||||
}
|
||||
if (value.type !== NodeTypes.SIMPLE_EXPRESSION) {
|
||||
let valueType: ConstantTypes
|
||||
if (value.type === NodeTypes.SIMPLE_EXPRESSION) {
|
||||
valueType = getConstantType(value, context)
|
||||
} else if (value.type === NodeTypes.JS_CALL_EXPRESSION) {
|
||||
// some helper calls can be hoisted,
|
||||
// such as the `normalizeProps` generated by the compiler for pre-normalize class,
|
||||
// in this case we need to respect the ConstanType of the helper's argments
|
||||
if (value.type === NodeTypes.JS_CALL_EXPRESSION) {
|
||||
return getConstantTypeOfHelperCall(value, context)
|
||||
}
|
||||
return ConstantTypes.NOT_CONSTANT
|
||||
valueType = getConstantTypeOfHelperCall(value, context)
|
||||
} else {
|
||||
valueType = ConstantTypes.NOT_CONSTANT
|
||||
}
|
||||
const valueType = getConstantType(value, context)
|
||||
if (valueType === ConstantTypes.NOT_CONSTANT) {
|
||||
return valueType
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user