(**
 * Copyright (c) 2015, Facebook, Inc.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the "hack" directory of this source tree. An additional grant
 * of patent rights can be found in the PATENTS file in the same directory.
 *
 *)

type kind =
  | Class
  | Function
  | Method of string * string
  | LocalVar
  | Property of string * string
  | ClassConst of string * string
  | Typeconst of string * string
  | GConst

type 'a t = {
  name:  string;
  type_: kind;
  (* Span of the symbol itself *)
  pos: 'a Pos.pos;
}

let to_absolute x = { x with
  pos = Pos.to_absolute x.pos;
}

(**
 * Copyright (c) 2015, Facebook, Inc.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the "hack" directory of this source tree. An additional grant
 * of patent rights can be found in the PATENTS file in the same directory.
 *
 *)

type kind =
  | Class
  | Function
  | Method of string * string
  | LocalVar
  | Property of string * string
  | ClassConst of string * string
  | Typeconst of string * string
  | GConst

type 'a t = {
  name:  string;
  type_: kind;
  (* Span of the symbol itself *)
  pos: 'a Pos.pos;
}

let to_absolute x = { x with
  pos = Pos.to_absolute x.pos;
}

let kind_to_string = function
  | Class -> "class"
  | Method _ -> "method"
  | Function -> "function"
  | LocalVar -> "local"
  | Property _ -> "property"
  | ClassConst _ -> "class_const"
  | Typeconst _ -> "typeconst"
  | GConst -> "global_const"

Merge code for readable printing of symbols in tests and in client
[hack] Merge code for readable printing of symbols in tests and in client

Summary:
We print them in hh_single_type_check and clientGetDefinition in different
ways for no particular reason.

Making:
   - ClientGetDefinition.print_readable the canonical method to print SymbolOccurence
   - FileOutline.print_def a canonical method to print SymbolDefinition
   - FileOutline.print a canonical method to print a collection of SymbolDefinitions

The tests are updated, and the things printed by the client are not intended to
be machine readable (as opposed to the --json version), so the change should be
safe.

Differential Revision: D4408138

fbshipit-source-id: e11089624559fb141199467430d5fea9a93a0f8b
