code: function (shadowEntry) {
              var shadowScopeOrder = this._defaults._shadowScopeOrder,
                  index = _.findIndex(shadowScopeOrder, function (entry) {
                      return entry === shadowEntry;
                  }),
                  i = index + 1;
  
              // Find an appropriate scope of lower priority to add it before
              while (i < shadowScopeOrder.length) {
                  if (shadowScopeOrder[i].promise.state() === "pending" ||
                          shadowScopeOrder[i].promise.state() === "resolved") {
                      break;
                  }
                  i++;
              }
              switch (shadowScopeOrder[i].promise.state()) {
              case "pending":
                  // cannot decide now, lookup once pending promise is settled
                  shadowScopeOrder[i].promise.always(function () {
                      this._tryAddToScopeOrder(shadowEntry);
                  }.bind(this));
                  break;
              case "resolved":
                  this._pushToScopeOrder(shadowEntry.id, shadowScopeOrder[i].id);
                  this.trigger(SCOPEORDER_CHANGE, {
                      id: shadowEntry.id,
                      action: "added"
                  });
                  this._triggerChange({
                      ids: shadowEntry.scope.getKeys()
                  });
                  break;
              default:
                  throw new Error("Internal error: no scope found to add before. \"default\" is missing?..");
              }
  
          }
docs: @private
  
  Tries to add scope to the scopeOrder once it's resolved. It looks up
  context's _shadowScopeOrder to find an appropriate context to add it
  before.
  
  @param {Object} shadowEntry Shadow entry of the resolved scope