( vnode: VNode, parent: ComponentInternalInstance | null, suspense: SuspenseBoundary | null, )
| 612 | let uid = 0 |
| 613 | |
| 614 | export function createComponentInstance( |
| 615 | vnode: VNode, |
| 616 | parent: ComponentInternalInstance | null, |
| 617 | suspense: SuspenseBoundary | null, |
| 618 | ): ComponentInternalInstance { |
| 619 | const type = vnode.type as ConcreteComponent |
| 620 | // inherit parent app context - or - if root, adopt from root vnode |
| 621 | const appContext = |
| 622 | (parent ? parent.appContext : vnode.appContext) || emptyAppContext |
| 623 | |
| 624 | const instance: ComponentInternalInstance = { |
| 625 | uid: uid++, |
| 626 | vnode, |
| 627 | type, |
| 628 | parent, |
| 629 | appContext, |
| 630 | root: null!, // to be immediately set |
| 631 | next: null, |
| 632 | subTree: null!, // will be set synchronously right after creation |
| 633 | effect: null!, |
| 634 | update: null!, // will be set synchronously right after creation |
| 635 | job: null!, |
| 636 | scope: new EffectScope(true /* detached */), |
| 637 | render: null, |
| 638 | proxy: null, |
| 639 | exposed: null, |
| 640 | exposeProxy: null, |
| 641 | withProxy: null, |
| 642 | |
| 643 | provides: parent ? parent.provides : Object.create(appContext.provides), |
| 644 | ids: parent ? parent.ids : ['', 0, 0], |
| 645 | accessCache: null!, |
| 646 | renderCache: [], |
| 647 | |
| 648 | // local resolved assets |
| 649 | components: null, |
| 650 | directives: null, |
| 651 | |
| 652 | // resolved props and emits options |
| 653 | propsOptions: normalizePropsOptions(type, appContext), |
| 654 | emitsOptions: normalizeEmitsOptions(type, appContext), |
| 655 | |
| 656 | // emit |
| 657 | emit: null!, // to be set immediately |
| 658 | emitted: null, |
| 659 | |
| 660 | // props default value |
| 661 | propsDefaults: EMPTY_OBJ, |
| 662 | |
| 663 | // inheritAttrs |
| 664 | inheritAttrs: type.inheritAttrs, |
| 665 | |
| 666 | // state |
| 667 | ctx: EMPTY_OBJ, |
| 668 | data: EMPTY_OBJ, |
| 669 | props: EMPTY_OBJ, |
| 670 | attrs: EMPTY_OBJ, |
| 671 | slots: EMPTY_OBJ, |
no test coverage detected