@@ -46,10 +46,6 @@ import { BindingTypes } from '../options'
4646
4747const isLiteralWhitelisted = /*#__PURE__*/ makeMap ( 'true,false,null,this' )
4848
49- // a heuristic safeguard to bail constant expressions on presence of
50- // likely function invocation and member access
51- const constantBailRE = / \w \s * \( | \. [ ^ \d ] /
52-
5349export const transformExpression : NodeTransform = ( node , context ) => {
5450 if ( node . type === NodeTypes . INTERPOLATION ) {
5551 node . content = processExpression (
@@ -226,8 +222,6 @@ export function processExpression(
226222
227223 // fast path if expression is a simple identifier.
228224 const rawExp = node . content
229- // bail constant on parens (function invocation) and dot (member access)
230- const bailConstant = constantBailRE . test ( rawExp )
231225
232226 let ast = node . ast
233227
@@ -317,7 +311,7 @@ export function processExpression(
317311 } else {
318312 // The identifier is considered constant unless it's pointing to a
319313 // local scope variable (a v-for alias, or a v-slot prop)
320- if ( ! ( needPrefix && isLocal ) && ! bailConstant ) {
314+ if ( ! ( needPrefix && isLocal ) ) {
321315 ; ( node as QualifiedId ) . isConstant = true
322316 }
323317 // also generate sub-expressions for other identifiers for better
@@ -371,9 +365,7 @@ export function processExpression(
371365 ret . ast = ast
372366 } else {
373367 ret = node
374- ret . constType = bailConstant
375- ? ConstantTypes . NOT_CONSTANT
376- : ConstantTypes . CAN_STRINGIFY
368+ ret . constType = ConstantTypes . CAN_STRINGIFY
377369 }
378370 ret . identifiers = Object . keys ( knownIds )
379371 return ret
0 commit comments