refactor: use more explicit names for warning context

This commit is contained in:
Evan You 2018-10-15 12:43:21 -04:00
parent b0f3a67e29
commit e4e138197c
2 changed files with 9 additions and 9 deletions

View File

@ -25,7 +25,7 @@ import {
shouldUpdateFunctionalComponent shouldUpdateFunctionalComponent
} from './componentUtils' } from './componentUtils'
import { KeepAliveSymbol } from './optional/keepAlive' import { KeepAliveSymbol } from './optional/keepAlive'
import { pushContext, popContext } from './warning' import { pushWarningContext, popWarningContext } from './warning'
interface NodeOps { interface NodeOps {
createElement: (tag: string, isSVG?: boolean) => any createElement: (tag: string, isSVG?: boolean) => any
@ -206,7 +206,7 @@ export function createRenderer(options: RendererOptions) {
) { ) {
vnode.contextVNode = contextVNode vnode.contextVNode = contextVNode
if (__DEV__) { if (__DEV__) {
pushContext(vnode) pushWarningContext(vnode)
} }
const { flags } = vnode const { flags } = vnode
if (flags & VNodeFlags.COMPONENT_STATEFUL) { if (flags & VNodeFlags.COMPONENT_STATEFUL) {
@ -215,7 +215,7 @@ export function createRenderer(options: RendererOptions) {
mountFunctionalComponent(vnode, container, isSVG, endNode) mountFunctionalComponent(vnode, container, isSVG, endNode)
} }
if (__DEV__) { if (__DEV__) {
popContext() popWarningContext()
} }
} }
@ -454,7 +454,7 @@ export function createRenderer(options: RendererOptions) {
isSVG: boolean isSVG: boolean
) { ) {
if (__DEV__) { if (__DEV__) {
pushContext(nextVNode) pushWarningContext(nextVNode)
} }
nextVNode.contextVNode = contextVNode nextVNode.contextVNode = contextVNode
const { tag, flags } = nextVNode const { tag, flags } = nextVNode
@ -472,7 +472,7 @@ export function createRenderer(options: RendererOptions) {
) )
} }
if (__DEV__) { if (__DEV__) {
popContext() popWarningContext()
} }
} }
@ -1232,7 +1232,7 @@ export function createRenderer(options: RendererOptions) {
isSVG: boolean isSVG: boolean
) { ) {
if (__DEV__ && instance.$parentVNode) { if (__DEV__ && instance.$parentVNode) {
pushContext(instance.$parentVNode as VNode) pushWarningContext(instance.$parentVNode as VNode)
} }
const prevVNode = instance.$vnode const prevVNode = instance.$vnode
@ -1291,7 +1291,7 @@ export function createRenderer(options: RendererOptions) {
} }
if (__DEV__ && instance.$parentVNode) { if (__DEV__ && instance.$parentVNode) {
popContext() popWarningContext()
} }
} }

View File

@ -4,11 +4,11 @@ import { VNode } from './vdom'
let stack: VNode[] = [] let stack: VNode[] = []
export function pushContext(vnode: VNode) { export function pushWarningContext(vnode: VNode) {
stack.push(vnode) stack.push(vnode)
} }
export function popContext() { export function popWarningContext() {
stack.pop() stack.pop()
} }