This repository was archived by the owner on Dec 25, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +24
-5
lines changed Expand file tree Collapse file tree 3 files changed +24
-5
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,8 @@ export function getIdentifierUsages(node?: Expression | TSType | SpreadElement |
6969 }
7070 else if ( node . type === 'MemberExpression' || node . type === 'OptionalMemberExpression' ) {
7171 getIdentifierUsages ( node . object , identifiers )
72+ if ( node . computed )
73+ getIdentifierUsages ( node . property , identifiers )
7274 }
7375 else if ( node . type === 'CallExpression' || node . type === 'OptionalCallExpression' ) {
7476 getIdentifierUsages ( node . callee as Expression , identifiers )
Original file line number Diff line number Diff line change @@ -810,24 +810,36 @@ export default __sfc_main;
810810exports[`transform fixtures test/fixtures/TemplateOptionalChaining.vue 1`] = `
811811" <template>
812812 <div @click=\\"callback?.()\\">
813- { { text?.length ?? textLengthDefault }}
813+ { { text?.length ?? textLengthDefault?.[index] }}
814814 { { classes?.[0] }}
815+ { { arrayObj.data.value[i] }}
815816 </div>
816817</template>
817818
818819<script lang =\\"ts\\">
820+ import { ref } from ' @vue/composition-api' ;
819821const __sfc_main = { } ;
820822
821823__sfc_main.setup = (__props, __ctx) => {
822824 const text = ' hello' ;
823- const textLengthDefault = 0 ;
825+ const textLengthDefault = ' ' ;
826+ const index = ref (0 );
824827 const callback = (undefined as undefined | (() => void ));
825828 const classes = (undefined as undefined | string []);
829+ const arrayObj = {
830+ data: {
831+ value: [1 , 2 , 3 ]
832+ }
833+ };
834+ const i = 0 ;
826835 return {
827836 text ,
828837 textLengthDefault ,
838+ index ,
829839 callback ,
830- classes
840+ classes ,
841+ arrayObj ,
842+ i
831843 };
832844} ;
833845
Original file line number Diff line number Diff line change 11<template >
22 <div @click =" callback?.()" >
3- {{ text?.length ?? textLengthDefault }}
3+ {{ text?.length ?? textLengthDefault?.[index] }}
44 {{ classes?.[0] }}
5+ {{ arrayObj.data.value[i] }}
56 </div >
67</template >
78
89<script setup lang="ts">
10+ import { ref } from ' @vue/composition-api'
911const text = ' hello'
10- const textLengthDefault = 0
12+ const textLengthDefault = ' '
13+ const index = ref (0 )
1114
1215const callback = undefined as undefined | (() => void )
1316const classes = undefined as undefined | string []
17+ const arrayObj = { data: { value: [1 , 2 , 3 ] } }
18+ const i = 0
1419 </script >
You can’t perform that action at this time.
0 commit comments