@@ -46,10 +46,6 @@ import { BindingTypes } from '../options'
46
46
47
47
const isLiteralWhitelisted = /*#__PURE__*/ makeMap ( 'true,false,null,this' )
48
48
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
-
53
49
export const transformExpression : NodeTransform = ( node , context ) => {
54
50
if ( node . type === NodeTypes . INTERPOLATION ) {
55
51
node . content = processExpression (
@@ -226,8 +222,6 @@ export function processExpression(
226
222
227
223
// fast path if expression is a simple identifier.
228
224
const rawExp = node . content
229
- // bail constant on parens (function invocation) and dot (member access)
230
- const bailConstant = constantBailRE . test ( rawExp )
231
225
232
226
let ast = node . ast
233
227
@@ -317,7 +311,7 @@ export function processExpression(
317
311
} else {
318
312
// The identifier is considered constant unless it's pointing to a
319
313
// local scope variable (a v-for alias, or a v-slot prop)
320
- if ( ! ( needPrefix && isLocal ) && ! bailConstant ) {
314
+ if ( ! ( needPrefix && isLocal ) ) {
321
315
; ( node as QualifiedId ) . isConstant = true
322
316
}
323
317
// also generate sub-expressions for other identifiers for better
@@ -371,9 +365,7 @@ export function processExpression(
371
365
ret . ast = ast
372
366
} else {
373
367
ret = node
374
- ret . constType = bailConstant
375
- ? ConstantTypes . NOT_CONSTANT
376
- : ConstantTypes . CAN_STRINGIFY
368
+ ret . constType = ConstantTypes . CAN_STRINGIFY
377
369
}
378
370
ret . identifiers = Object . keys ( knownIds )
379
371
return ret
0 commit comments