]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix: do not use lookbehind regex yet
authorEvan You <yyx990803@gmail.com>
Thu, 26 Sep 2019 16:22:31 +0000 (12:22 -0400)
committerEvan You <yyx990803@gmail.com>
Thu, 26 Sep 2019 16:22:31 +0000 (12:22 -0400)
packages/compiler-core/__tests__/transforms/vFor.spec.ts
packages/compiler-core/src/transforms/vFor.ts

index 30f54dce4a912412352e8dd0348792f638d374fa..5dfcc0682ce24c1e2a78a2a25f6a48c477fec931 100644 (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 }')
index 04c6bf34dd3e553cfd7d62197cfde9f0fc35a480..9c6b315eba35c9a3da577d39f31032c17d71d917 100644 (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