function resolveIf$Ref (pointer, options) {
// Is the value a JSON reference? (and allowed?)

if ($Ref.isAllowed$Ref(pointer.value, options)) {
  var $refPath = url.resolve(pointer.path, pointer.value.$ref);

  if ($refPath === pointer.path) {
    // The value is a reference to itself, so there's nothing to do.
    pointer.circular = true;
  }
  else {
    var resolved = pointer.$ref.$refs._resolve($refPath, options);
    pointer.indirections += resolved.indirections + 1;

    if ($Ref.isExtended$Ref(pointer.value)) {
      // This JSON reference "extends" the resolved value, rather than simply pointing to it.
      // So the resolved path does NOT change.  Just the value does.
      pointer.value = $Ref.dereference(pointer.value, resolved.value);
      return false;
    }
    else {
      // Resolve the reference
      pointer.$ref = resolved.$ref;
      pointer.path = resolved.path;
      pointer.value = resolved.value;
    }

    return true;
  }
}
}
If the given pointer's {@link Pointer#value} is a JSON reference,
then the reference is resolved and {@link Pointer#value} is replaced with the resolved value.
In addition, {@link Pointer#path} and {@link Pointer#$ref} are updated to reflect the
resolution path of the new value.

@param {Pointer} pointer
@param {$RefParserOptions} options
@returns {boolean} - Returns `true` if the resolution path changed