@@ -634,24 +634,17 @@ module.exports = {
634634 if ( watcher . type === 'object' ) {
635635 const property = watcher . property
636636 if ( property . kind === 'init' ) {
637- /** @type {Expression | null } */
638- let handlerValueNode = null
639- if ( property . value . type === 'ObjectExpression' ) {
640- const handler = utils . findProperty ( property . value , 'handler' )
641- if ( handler ) {
642- handlerValueNode = handler . value
643- }
644- } else {
645- handlerValueNode = property . value
646- }
647- if (
648- handlerValueNode &&
649- ( handlerValueNode . type === 'Literal' ||
650- handlerValueNode . type === 'TemplateLiteral' )
651- ) {
652- const name = utils . getStringLiteralValue ( handlerValueNode )
653- if ( name != null ) {
654- watcherUsedProperties . add ( name )
637+ for ( const handlerValueNode of utils . iterateWatchHandlerValues (
638+ property
639+ ) ) {
640+ if (
641+ handlerValueNode . type === 'Literal' ||
642+ handlerValueNode . type === 'TemplateLiteral'
643+ ) {
644+ const name = utils . getStringLiteralValue ( handlerValueNode )
645+ if ( name != null ) {
646+ watcherUsedProperties . add ( name )
647+ }
655648 }
656649 }
657650 }
@@ -699,11 +692,11 @@ module.exports = {
699692 if (
700693 utils . getStaticPropertyName ( parentParentProperty ) !==
701694 'computed' ||
702- utils . getStaticPropertyName ( property ) !== 'handler '
695+ utils . getStaticPropertyName ( property ) !== 'get '
703696 ) {
704697 return
705698 }
706- // check { computed: { foo: { handler : (vm ) => vm.prop } } }
699+ // check { computed: { foo: { get : () => vm.prop } } }
707700 } else {
708701 return
709702 }
0 commit comments