|
@@ -10,9 +10,9 @@ import {
|
|
|
import { capitalize } from '@vue/shared'
|
|
import { capitalize } from '@vue/shared'
|
|
|
import { createCompilerError, ErrorCodes } from '../errors'
|
|
import { createCompilerError, ErrorCodes } from '../errors'
|
|
|
import { processExpression } from './transformExpression'
|
|
import { processExpression } from './transformExpression'
|
|
|
|
|
+import { isMemberExpression } from '../utils'
|
|
|
|
|
|
|
|
const fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/
|
|
const fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/
|
|
|
-const simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/
|
|
|
|
|
|
|
|
|
|
// v-on without arg is handled directly in ./element.ts due to it affecting
|
|
// v-on without arg is handled directly in ./element.ts due to it affecting
|
|
|
// codegen for the entire props object. This transform here is only for v-on
|
|
// codegen for the entire props object. This transform here is only for v-on
|
|
@@ -49,7 +49,7 @@ export const transformOn: DirectiveTransform = (dir, node, context) => {
|
|
|
// skipped by transformExpression as a special case.
|
|
// skipped by transformExpression as a special case.
|
|
|
let exp: ExpressionNode = dir.exp as SimpleExpressionNode
|
|
let exp: ExpressionNode = dir.exp as SimpleExpressionNode
|
|
|
const isInlineStatement = !(
|
|
const isInlineStatement = !(
|
|
|
- simplePathRE.test(exp.content) || fnExpRE.test(exp.content)
|
|
|
|
|
|
|
+ isMemberExpression(exp.content) || fnExpRE.test(exp.content)
|
|
|
)
|
|
)
|
|
|
// process the expression since it's been skipped
|
|
// process the expression since it's been skipped
|
|
|
if (!__BROWSER__ && context.prefixIdentifiers) {
|
|
if (!__BROWSER__ && context.prefixIdentifiers) {
|