From 2e3a1ff3c3d46341e02e87865225a018bfefab85 Mon Sep 17 00:00:00 2001 From: Evan You Date: Thu, 26 Sep 2019 12:22:31 -0400 Subject: [PATCH] fix: do not use lookbehind regex yet --- packages/compiler-core/__tests__/transforms/vFor.spec.ts | 2 +- packages/compiler-core/src/transforms/vFor.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/compiler-core/__tests__/transforms/vFor.spec.ts b/packages/compiler-core/__tests__/transforms/vFor.spec.ts index 30f54dce..5dfcc068 100644 --- a/packages/compiler-core/__tests__/transforms/vFor.spec.ts +++ b/packages/compiler-core/__tests__/transforms/vFor.spec.ts @@ -259,7 +259,7 @@ describe('compiler: transform v-for', () => { }) test('de-structured value', () => { - const source = '' + const source = '' const forNode = parseWithForTransform(source) const valueIndex = source.indexOf('{ id, key }') diff --git a/packages/compiler-core/src/transforms/vFor.ts b/packages/compiler-core/src/transforms/vFor.ts index 04c6bf34..9c6b315e 100644 --- a/packages/compiler-core/src/transforms/vFor.ts +++ b/packages/compiler-core/src/transforms/vFor.ts @@ -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