Reviewed By: mbouaziz Differential Revision: D4737430 fbshipit-source-id: 4d6d20bmaster
parent
565ce2166d
commit
86534cd97f
@ -1,72 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
open! IStd;
|
||||
|
||||
let module F = Format;
|
||||
|
||||
|
||||
/** Named types. */
|
||||
type t =
|
||||
| TN_csu Csu.t Mangled.t
|
||||
[@@deriving compare];
|
||||
|
||||
let equal = [%compare.equal : t];
|
||||
|
||||
let to_string =
|
||||
fun
|
||||
| TN_csu csu name => Csu.name csu ^ " " ^ Mangled.to_string name;
|
||||
|
||||
let pp f typename => F.fprintf f "%s" (to_string typename);
|
||||
|
||||
let name =
|
||||
fun
|
||||
| TN_csu _ name => Mangled.to_string name;
|
||||
|
||||
let from_string_kind class_kind class_name_str =>
|
||||
TN_csu (Csu.Class class_kind) (Mangled.from_string class_name_str);
|
||||
|
||||
let is_class_kind class_kind =>
|
||||
fun
|
||||
| TN_csu (Class kind) _ when Csu.equal_class_kind class_kind kind => true
|
||||
| _ => false;
|
||||
|
||||
let module C = {
|
||||
let from_string name_str => TN_csu Csu.Struct (Mangled.from_string name_str);
|
||||
let union_from_string name_str => TN_csu Csu.Union (Mangled.from_string name_str);
|
||||
};
|
||||
|
||||
let module Java = {
|
||||
let from_string = from_string_kind Csu.Java;
|
||||
let from_package_class package_name class_name =>
|
||||
if (String.equal package_name "") {
|
||||
from_string class_name
|
||||
} else {
|
||||
from_string (package_name ^ "." ^ class_name)
|
||||
};
|
||||
let is_class = is_class_kind Csu.Java;
|
||||
let java_lang_object = from_string "java.lang.Object";
|
||||
let java_io_serializable = from_string "java.io.Serializable";
|
||||
let java_lang_cloneable = from_string "java.lang.Cloneable";
|
||||
};
|
||||
|
||||
let module Cpp = {
|
||||
let from_string = from_string_kind Csu.CPP;
|
||||
let is_class = is_class_kind Csu.CPP;
|
||||
};
|
||||
|
||||
let module Objc = {
|
||||
let from_string = from_string_kind Csu.Objc;
|
||||
let protocol_from_string name_str => TN_csu Csu.Protocol (Mangled.from_string name_str);
|
||||
let is_class = is_class_kind Csu.Objc;
|
||||
};
|
||||
|
||||
let module Set = Caml.Set.Make {
|
||||
type nonrec t = t;
|
||||
let compare = compare;
|
||||
};
|
@ -1,67 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
open! IStd;
|
||||
|
||||
|
||||
/** Named types. */
|
||||
type t =
|
||||
| TN_csu Csu.t Mangled.t
|
||||
[@@deriving compare];
|
||||
|
||||
|
||||
/** Equality for typenames */
|
||||
let equal: t => t => bool;
|
||||
|
||||
|
||||
/** convert the typename to a string */
|
||||
let to_string: t => string;
|
||||
|
||||
let pp: Format.formatter => t => unit;
|
||||
|
||||
|
||||
/** name of the typename without qualifier */
|
||||
let name: t => string;
|
||||
|
||||
let module C: {let from_string: string => t; let union_from_string: string => t;};
|
||||
|
||||
let module Java: {
|
||||
|
||||
/** Create a typename from a Java classname in the form "package.class" */
|
||||
let from_string: string => t;
|
||||
|
||||
/** Create a typename from a package name and a class name */
|
||||
let from_package_class: string => string => t;
|
||||
|
||||
/** [is_class name] holds if [name] names a Java class */
|
||||
let is_class: t => bool;
|
||||
let java_lang_object: t;
|
||||
let java_io_serializable: t;
|
||||
let java_lang_cloneable: t;
|
||||
};
|
||||
|
||||
let module Cpp: {
|
||||
|
||||
/** Create a typename from a C++ classname */
|
||||
let from_string: string => t;
|
||||
|
||||
/** [is_class name] holds if [name] names a C++ class */
|
||||
let is_class: t => bool;
|
||||
};
|
||||
|
||||
let module Objc: {
|
||||
|
||||
/** Create a typename from a Objc classname */
|
||||
let from_string: string => t;
|
||||
let protocol_from_string: string => t;
|
||||
|
||||
/** [is_class name] holds if [name] names a Objc class */
|
||||
let is_class: t => bool;
|
||||
};
|
||||
|
||||
let module Set: Caml.Set.S with type elt = t;
|
Loading…
Reference in new issue