@@ -641,7 +641,7 @@ export const sucrose = (
641
641
const event = 'fn' in e ? e . fn : e
642
642
643
643
// parse can be either a function or string
644
- if ( typeof event !== " function" ) continue
644
+ if ( typeof event !== ' function' ) continue
645
645
646
646
const [ parameter , body , { isArrowReturn } ] = separateFunction (
647
647
event . toString ( )
@@ -651,15 +651,23 @@ export const sucrose = (
651
651
const mainParameter = extractMainParameter ( rootParameters )
652
652
653
653
if ( mainParameter ) {
654
- const aliases = findAlias ( mainParameter , body )
654
+ const aliases = findAlias ( mainParameter , body . slice ( 1 , - 1 ) )
655
655
aliases . splice ( 0 , - 1 , mainParameter )
656
656
657
- if ( ! isContextPassToFunction ( mainParameter , body , inference ) )
658
- inferBodyReference ( body , aliases , inference )
657
+ let code = body
658
+
659
+ if (
660
+ code . charCodeAt ( 0 ) === 123 &&
661
+ code . charCodeAt ( body . length - 1 ) === 125
662
+ )
663
+ code = code . slice ( 1 , - 1 )
664
+
665
+ if ( ! isContextPassToFunction ( mainParameter , code , inference ) )
666
+ inferBodyReference ( code , aliases , inference )
659
667
660
668
if (
661
669
! inference . query &&
662
- body . includes ( 'return ' + mainParameter + '.query' )
670
+ code . includes ( 'return ' + mainParameter + '.query' )
663
671
)
664
672
inference . query = true
665
673
}
@@ -676,6 +684,5 @@ export const sucrose = (
676
684
)
677
685
break
678
686
}
679
-
680
687
return inference
681
688
}
0 commit comments