ppx_compare Csu

Reviewed By: cristianoc

Differential Revision: D4232368

fbshipit-source-id: 12f1a15
master
Josh Berdine 8 years ago committed by Facebook Github Bot
parent 6459ec4ff4
commit 5107815c18

@ -15,13 +15,15 @@ open! Utils;
type class_kind = type class_kind =
| CPP | CPP
| Java | Java
| Objc; | Objc
[@@deriving compare];
type t = type t =
| Class class_kind | Class class_kind
| Struct | Struct
| Union | Union
| Protocol; | Protocol
[@@deriving compare];
let name = let name =
fun fun
@ -30,26 +32,4 @@ let name =
| Union => "union" | Union => "union"
| Protocol => "protocol"; | Protocol => "protocol";
let class_kind_num =
fun
| CPP => 1
| Java => 2
| Objc => 3;
let class_kind_compare ck1 ck2 => class_kind_num ck1 - class_kind_num ck2;
let compare dstruct1 dstruct2 =>
switch (dstruct1, dstruct2) {
| (Class ck1, Class ck2) => class_kind_compare ck1 ck2
| (Class _, _) => (-1)
| (_, Class _) => 1
| (Struct, Struct) => 0
| (Struct, _) => (-1)
| (_, Struct) => 1
| (Union, Union) => 0
| (Union, _) => (-1)
| (_, Union) => 1
| (Protocol, Protocol) => 0
};
let equal tn1 tn2 => compare tn1 tn2 == 0; let equal tn1 tn2 => compare tn1 tn2 == 0;

@ -15,16 +15,16 @@ open! Utils;
type class_kind = type class_kind =
| CPP | CPP
| Java | Java
| Objc; | Objc
[@@deriving compare];
type t = type t =
| Class class_kind | Class class_kind
| Struct | Struct
| Union | Union
| Protocol; | Protocol
[@@deriving compare];
let name: t => string;
let compare: t => t => int;
let equal: t => t => bool; let equal: t => t => bool;
let name: t => string;

Loading…
Cancel
Save