@@ -413,6 +413,16 @@ export function buildProps(
413
413
let hasVnodeHook = false
414
414
const dynamicPropNames : string [ ] = [ ]
415
415
416
+ const pushMergeArg = ( arg ?: PropsExpression ) => {
417
+ if ( properties . length ) {
418
+ mergeArgs . push (
419
+ createObjectExpression ( dedupeProperties ( properties ) , elementLoc )
420
+ )
421
+ properties = [ ]
422
+ }
423
+ if ( arg ) mergeArgs . push ( arg )
424
+ }
425
+
416
426
const analyzePatchFlag = ( { key, value } : Property ) => {
417
427
if ( isStaticExp ( key ) ) {
418
428
const name = key . content
@@ -590,13 +600,9 @@ export function buildProps(
590
600
if ( ! arg && ( isVBind || isVOn ) ) {
591
601
hasDynamicKeys = true
592
602
if ( exp ) {
593
- if ( properties . length ) {
594
- mergeArgs . push (
595
- createObjectExpression ( dedupeProperties ( properties ) , elementLoc )
596
- )
597
- properties = [ ]
598
- }
599
603
if ( isVBind ) {
604
+ // have to merge early for compat build check
605
+ pushMergeArg ( )
600
606
if ( __COMPAT__ ) {
601
607
// 2.x v-bind object order compat
602
608
if ( __DEV__ ) {
@@ -643,7 +649,7 @@ export function buildProps(
643
649
mergeArgs . push ( exp )
644
650
} else {
645
651
// v-on="obj" -> toHandlers(obj)
646
- mergeArgs . push ( {
652
+ pushMergeArg ( {
647
653
type : NodeTypes . JS_CALL_EXPRESSION ,
648
654
loc,
649
655
callee : context . helper ( TO_HANDLERS ) ,
@@ -669,13 +675,7 @@ export function buildProps(
669
675
const { props, needRuntime } = directiveTransform ( prop , node , context )
670
676
! ssr && props . forEach ( analyzePatchFlag )
671
677
if ( isVOn && arg && ! isStaticExp ( arg ) ) {
672
- if ( properties . length ) {
673
- mergeArgs . push (
674
- createObjectExpression ( dedupeProperties ( properties ) , elementLoc )
675
- )
676
- properties = [ ]
677
- }
678
- mergeArgs . push ( createObjectExpression ( props , elementLoc ) )
678
+ pushMergeArg ( createObjectExpression ( props , elementLoc ) )
679
679
} else {
680
680
properties . push ( ...props )
681
681
}
@@ -701,11 +701,8 @@ export function buildProps(
701
701
702
702
// has v-bind="object" or v-on="object", wrap with mergeProps
703
703
if ( mergeArgs . length ) {
704
- if ( properties . length ) {
705
- mergeArgs . push (
706
- createObjectExpression ( dedupeProperties ( properties ) , elementLoc )
707
- )
708
- }
704
+ // close up any not-yet-merged props
705
+ pushMergeArg ( )
709
706
if ( mergeArgs . length > 1 ) {
710
707
propsExpression = createCallExpression (
711
708
context . helper ( MERGE_PROPS ) ,
0 commit comments