function resolve$Ref ($ref, path, $refs, options) {
debug('Resolving $ref pointer "%s" at %s', $ref.$ref, path);

var resolvedPath = url.resolve(path, $ref.$ref);
var withoutHash = url.stripHash(resolvedPath);

// Do we already have this $ref?
$ref = $refs._$refs[withoutHash];
if ($ref) {
  // We've already parsed this $ref, so use the existing value
  return Promise.resolve($ref.value);
}

// Parse the $referenced file/url
return parse(resolvedPath, $refs, options)
  .then(function (result) {
    // Crawl the parsed value
    debug('Resolving $ref pointers in %s', withoutHash);
    var promises = crawl(result, withoutHash + '#', $refs, options);
    return Promise.all(promises);
  });
}
Resolves the given JSON Reference, and then crawls the resulting value.

@param {{$ref: string}} $ref - The JSON Reference to resolve
@param {string} path - The full path of `$ref`, possibly with a JSON Pointer in the hash
@param {$Refs} $refs
@param {$RefParserOptions} options

@returns {Promise}
The promise resolves once all JSON references in the object have been resolved,
including nested references that are contained in externally-referenced files.