@@ -57,24 +57,7 @@ export function createComponent (
5757
5858 // functional component
5959 if ( Ctor . options . functional ) {
60- const props = { }
61- const propOptions = Ctor . options . props
62- if ( propOptions ) {
63- Object . keys ( propOptions ) . forEach ( key => {
64- props [ key ] = validateProp ( key , propOptions , propsData )
65- } )
66- }
67- return Ctor . options . render . call (
68- null ,
69- context . $createElement ,
70- {
71- props,
72- data,
73- parent : context ,
74- children : normalizeChildren ( children ) ,
75- slots : ( ) => resolveSlots ( children )
76- }
77- )
60+ return createFunctionalComponent ( Ctor , propsData , data , context , children )
7861 }
7962
8063 // extract listeners, since these needs to be treated as
@@ -102,6 +85,27 @@ export function createComponent (
10285 return vnode
10386}
10487
88+ function createFunctionalComponent ( Ctor , propsData , data , context , children ) {
89+ const props = { }
90+ const propOptions = Ctor . options . props
91+ if ( propOptions ) {
92+ for ( const key in propOptions ) {
93+ props [ key ] = validateProp ( key , propOptions , propsData )
94+ }
95+ }
96+ return Ctor . options . render . call (
97+ null ,
98+ context . $createElement ,
99+ {
100+ props,
101+ data,
102+ parent : context ,
103+ children : normalizeChildren ( children ) ,
104+ slots : ( ) => resolveSlots ( children )
105+ }
106+ )
107+ }
108+
105109export function createComponentInstanceForVnode (
106110 vnode : any , // we know it's MountedComponentVNode but flow doesn't
107111 parent : any // activeInstance in lifecycle state
0 commit comments