]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
refactor: tweak arguments
authorEvan You <yyx990803@gmail.com>
Mon, 15 Oct 2018 16:41:18 +0000 (12:41 -0400)
committerEvan You <yyx990803@gmail.com>
Mon, 15 Oct 2018 16:41:18 +0000 (12:41 -0400)
packages/core/src/componentUtils.ts
packages/core/src/createRenderer.ts

index 04a8808b5d854b81b9b92ef7f05bd459c5767d6d..bb91a6b1974831203a73386f551d3c6ee5563123 100644 (file)
@@ -23,12 +23,11 @@ import { handleError, ErrorTypes } from './errorHandling'
 import { warn } from './warning'
 
 let currentVNode: VNode | null = null
-let currentContextVNode: MountedVNode | null = null
+let currentContextVNode: VNode | null = null
 
 export function createComponentInstance(
   vnode: VNode,
-  Component: ComponentClass,
-  contextVNode: MountedVNode | null
+  Component: ComponentClass
 ): ComponentInstance {
   // component instance creation is done in two steps.
   // first, `initializeComponentInstance` is called inside base component
@@ -38,7 +37,7 @@ export function createComponentInstance(
   // we are storing the vnodes in variables here so that there's no need to
   // always pass args in super()
   currentVNode = vnode
-  currentContextVNode = contextVNode
+  currentContextVNode = vnode.contextVNode
   const instance = (vnode.children = new Component() as ComponentInstance)
   // then we finish the initialization by collecting properties set on the
   // instance
index 1362402334178b470bc3f1058b9ed8f620abbd4e..357c9b87dc5dc3f0e07ba3e1512265c066958f00 100644 (file)
@@ -210,9 +210,9 @@ export function createRenderer(options: RendererOptions) {
     }
     const { flags } = vnode
     if (flags & VNodeFlags.COMPONENT_STATEFUL) {
-      mountStatefulComponent(vnode, container, contextVNode, isSVG, endNode)
+      mountStatefulComponent(vnode, container, isSVG, endNode)
     } else {
-      mountFunctionalComponent(vnode, container, contextVNode, isSVG, endNode)
+      mountFunctionalComponent(vnode, container, isSVG, endNode)
     }
     if (__DEV__) {
       popContext()
@@ -222,7 +222,6 @@ export function createRenderer(options: RendererOptions) {
   function mountStatefulComponent(
     vnode: VNode,
     container: RenderNode | null,
-    contextVNode: MountedVNode | null,
     isSVG: boolean,
     endNode: RenderNode | null
   ) {
@@ -234,7 +233,6 @@ export function createRenderer(options: RendererOptions) {
         vnode,
         vnode.tag as ComponentClass,
         container,
-        contextVNode,
         isSVG,
         endNode
       )
@@ -244,7 +242,6 @@ export function createRenderer(options: RendererOptions) {
   function mountFunctionalComponent(
     vnode: VNode,
     container: RenderNode | null,
-    contextVNode: MountedVNode | null,
     isSVG: boolean,
     endNode: RenderNode | null
   ) {
@@ -1156,7 +1153,6 @@ export function createRenderer(options: RendererOptions) {
     vnode: VNode,
     Component: ComponentClass,
     container: RenderNode | null,
-    contextVNode: MountedVNode | null,
     isSVG: boolean,
     endNode: RenderNode | null
   ): RenderNode {
@@ -1164,7 +1160,7 @@ export function createRenderer(options: RendererOptions) {
     // new Vue()
     const instance =
       (__COMPAT__ && (vnode.children as ComponentInstance)) ||
-      createComponentInstance(vnode, Component, contextVNode)
+      createComponentInstance(vnode, Component)
 
     // inject platform-specific unmount to keep-alive container
     if ((Component as any)[KeepAliveSymbol] === true) {