var mountOrder = 1;
export function Updater(instance, vnode) {
    //防止用户在构造器生成JSX
    this._mountOrder = mountOrder++;
    this._instance = instance;
    this._pendingCallbacks = [];
    this._pendingStates = [];
    this._currentElement = vnode;//用于DevTools工具中，通过实例找到生成它的那个虚拟DOM
    this._lifeStage = 0; //判断生命周期
    this._hostNode = null;
    vnode._instance = instance;
}

Updater.prototype = {
    isMounted: function(){
        return !!this._hostNode;
    },
    mergeStates: function(){
        let pendings = this.__pendingStates,
            n = pendings.length;
        if (n === 0) {
            return this.state;
        }
        let state = extend({}, this.state);//每次都返回新的state
        for (let i = 0; i < n; i++) {
            let pending = pendings[i];
            if (isFn(pending)) {
                pending = pending.call(this, state, props, context);
            }
            extend(state, pending);
        }
        pendings.length = 0;
        return state;
    }

};