Skip to content
Permalink
Browse files

fix: fix function expression regex (#9922)

fix #9920
  • Loading branch information...
Justineo authored and yyx990803 committed Apr 25, 2019
1 parent ab50e8e commit 569b728ab19d1956bf935a98c9c65a03d92ac85f
Showing with 6 additions and 1 deletion.
  1. +1 −1 src/compiler/codegen/events.js
  2. +5 −0 test/unit/modules/compiler/codegen.spec.js
@@ -1,6 +1,6 @@
/* @flow */

const fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function\s*(?:[\w$]+)?\s*\(/
const fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/
const fnInvokeRE = /\([^)]*?\);*$/
const simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/

@@ -345,6 +345,11 @@ describe('codegen', () => {
`<input @input="onInput(');[\\'());');">`,
`with(this){return _c('input',{on:{"input":function($event){onInput(');[\\'());');}}})}`
)
// function name including a `function` part (#9920)
assertCodegen(
'<input @input="functionName()">',
`with(this){return _c('input',{on:{"input":function($event){return functionName()}}})}`
)
})

it('generate events with multiple statements', () => {

0 comments on commit 569b728

Please sign in to comment.
You can’t perform that action at this time.