( Ctor, propsData, data, context, children )
| 3057 | } |
| 3058 | |
| 3059 | function createFunctionalComponent ( |
| 3060 | Ctor, |
| 3061 | propsData, |
| 3062 | data, |
| 3063 | context, |
| 3064 | children |
| 3065 | ) { |
| 3066 | var props = {}; |
| 3067 | var propOptions = Ctor.options.props; |
| 3068 | if (propOptions) { |
| 3069 | for (var key in propOptions) { |
| 3070 | props[key] = validateProp(key, propOptions, propsData); |
| 3071 | } |
| 3072 | } |
| 3073 | // ensure the createElement function in functional components |
| 3074 | // gets a unique context - this is necessary for correct named slot check |
| 3075 | var _context = Object.create(context); |
| 3076 | var h = function (a, b, c, d) { return createElement(_context, a, b, c, d, true); }; |
| 3077 | var vnode = Ctor.options.render.call(null, h, { |
| 3078 | props: props, |
| 3079 | data: data, |
| 3080 | parent: context, |
| 3081 | children: children, |
| 3082 | slots: function () { return resolveSlots(children, context); } |
| 3083 | }); |
| 3084 | if (vnode instanceof VNode) { |
| 3085 | vnode.functionalContext = context; |
| 3086 | if (data.slot) { |
| 3087 | (vnode.data || (vnode.data = {})).slot = data.slot; |
| 3088 | } |
| 3089 | } |
| 3090 | return vnode |
| 3091 | } |
| 3092 | |
| 3093 | function createComponentInstanceForVnode ( |
| 3094 | vnode, // we know it's MountedComponentVNode but flow doesn't |
no test coverage detected