@@ -29,7 +29,7 @@ export function genFor(
29
29
container,
30
30
} = oper
31
31
32
- let isDestructureAssignment = false
32
+ let isDestructure = false
33
33
let rawValue : string | null = null
34
34
const rawKey = key && key . content
35
35
const rawIndex = index && index . content
@@ -39,7 +39,7 @@ export function genFor(
39
39
let blockFn = genBlockFn ( )
40
40
const simpleIdMap : Record < string , null > = genSimpleIdMap ( )
41
41
42
- if ( isDestructureAssignment ) {
42
+ if ( isDestructure ) {
43
43
const idMap : Record < string , null > = { }
44
44
idsInValue . forEach ( id => ( idMap [ id ] = null ) )
45
45
if ( rawKey ) idMap [ rawKey ] = null
@@ -82,7 +82,7 @@ export function genFor(
82
82
const idsInValue = new Set < string > ( )
83
83
if ( value ) {
84
84
rawValue = value && value . content
85
- if ( ( isDestructureAssignment = ! ! value . ast ) ) {
85
+ if ( ( isDestructure = ! ! value . ast ) ) {
86
86
walkIdentifiers (
87
87
value . ast ,
88
88
( id , _ , __ , ___ , isLocal ) => {
@@ -103,12 +103,13 @@ export function genFor(
103
103
const idMap : Record < string , string | null > = { }
104
104
if ( context . options . prefixIdentifiers ) {
105
105
propsName = `_ctx${ depth } `
106
+ let suffix = isDestructure ? '' : '.value'
106
107
Array . from ( idsInValue ) . forEach (
107
- ( id , idIndex ) => ( idMap [ id ] = `${ propsName } [${ idIndex } ].value ` ) ,
108
+ ( id , idIndex ) => ( idMap [ id ] = `${ propsName } [${ idIndex } ]${ suffix } ` ) ,
108
109
)
109
- if ( rawKey ) idMap [ rawKey ] = `${ propsName } [${ idsInValue . size } ].value `
110
+ if ( rawKey ) idMap [ rawKey ] = `${ propsName } [${ idsInValue . size } ]${ suffix } `
110
111
if ( rawIndex )
111
- idMap [ rawIndex ] = `${ propsName } [${ idsInValue . size + 1 } ].value `
112
+ idMap [ rawIndex ] = `${ propsName } [${ idsInValue . size + 1 } ]${ suffix } `
112
113
} else {
113
114
propsName = `[${ [ rawValue || ( ( rawKey || rawIndex ) && '_' ) , rawKey || ( rawIndex && '__' ) , rawIndex ] . filter ( Boolean ) . join ( ', ' ) } ]`
114
115
}
0 commit comments