code: function eval$ref(params, dataPath) {
    dataPath = dataPath.replace(this.refPrefixRegexp, '');
    var $ref = params.$ref;
    if ($ref.indexOf('0/') == 0) throw new Error('Cannot reference the same $ref instruction or child');
  
    var pathParsed = pointer.parse(dataPath);
    var absPointerParsed = util.toAbsolutePointer($ref, pathParsed);
    // N# pointer returns property/index
    if (typeof absPointerParsed == 'string') return absPointerParsed;
  
    if (!absPointerParsed) absPointerParsed = pointer.parse($ref);
  
    var i = 0; // find the root to be evaluated
    while (i < pathParsed.length
            && pathParsed[i] == absPointerParsed[i]) i++;
    if (i == pathParsed.length) throw new Error('Cannot reference the same $ref instruction or child');
  
    if (!isNaN(pathParsed[i]) && !isNaN(absPointerParsed[i]) && absPointerParsed[i] > pathParsed[i])
      throw new Error('cannot reference the next item from the previous item');
  
    var rootPointerParsed = absPointerParsed.slice(0, i+1);
    var rootPointer = pointer.compile(rootPointerParsed);
    var pointerFromRoot = pointer.compile(absPointerParsed.slice(i+1));
  
    if (this.evaluatedRefs[rootPointer])
      return getRefValue(this.script, rootPointer, pointerFromRoot);
  
    var self = this;
    var pendingRef = self.pendingRefs[rootPointer]
      = self.pendingRefs[rootPointer] || new PendingRef(rootPointer);
    return new Promise(function (resolve, reject) {
      pendingRef.addCallback(function () {
        resolve(getRefValue(self.script, rootPointer, pointerFromRoot));
      });
    });
  }
docs: resolve reference to the current script
  @this   Evaluation
  @param  {Object} params   instruction keywords ($ref)
  @param  {String} dataPath current path (JSON pointer)
  @return {Promise|Any} reolved reference