fix: do not use lookbehind regex yet

This commit is contained in:
Evan You 2019-09-26 12:22:31 -04:00
parent 7c030ee899
commit 2e3a1ff3c3
2 changed files with 5 additions and 5 deletions

View File

@ -259,7 +259,7 @@ describe('compiler: transform v-for', () => {
})
test('de-structured value', () => {
const source = '<span v-for="( { id, key })in items" />'
const source = '<span v-for="( { id, key }) in items" />'
const forNode = parseWithForTransform(source)
const valueIndex = source.indexOf('{ id, key }')

View File

@ -13,10 +13,6 @@ import { getInnerRange } from '../utils'
import { RENDER_LIST } from '../runtimeConstants'
import { processExpression } from './transformExpression'
const forAliasRE = /([\s\S]*?)(?:(?<=\))|\s+)(?:in|of)\s+([\s\S]*)/
const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/
const stripParensRE = /^\(|\)$/g
export const transformFor = createStructuralDirectiveTransform(
'for',
(node, dir, context) => {
@ -64,6 +60,10 @@ export const transformFor = createStructuralDirectiveTransform(
}
)
const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/
const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/
const stripParensRE = /^\(|\)$/g
interface ForParseResult {
source: ExpressionNode
value: ExpressionNode | undefined