Skip to content

Commit

Permalink
small refactoring
Browse files Browse the repository at this point in the history
Summary:
Rename the function `genOCamlType'` and `genOCamlToJson` to `genOCamlTypeFromField` and `genOCamlToJsonFromField` to make sure they are called when processing  field types.

Some cases in `genOCamlToJson` and `genOCamlToJsonFromField` were duplicated.

This is in preparation of further changes (see task)

Reviewed By: donsbot

Differential Revision: D62968918

fbshipit-source-id: 8d9979ba9d8193b9909d795404a32e3cae2ffb1f
  • Loading branch information
Philippe Bidinger authored and facebook-github-bot committed Sep 19, 2024
1 parent c23c42b commit 62e1084
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions hphp/hack/src/typing/write_symbol_info/glean/fbthrift.ml
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ end = struct
| Id f -> Util.id f
| Key t -> Util.key (to_json_key t)

and to_json_key str = JSON_String str
and to_json_key x = JSON_String x
end

and EnumValueDef: sig
Expand Down Expand Up @@ -838,7 +838,7 @@ end = struct
| Id f -> Util.id f
| Key t -> Util.key (to_json_key t)

and to_json_key str = JSON_String str
and to_json_key x = JSON_String x
end

and StructType: sig
Expand Down Expand Up @@ -1234,7 +1234,7 @@ end = struct
| Id f -> Util.id f
| Key t -> Util.key (to_json_key t)

and to_json_key str = JSON_String str
and to_json_key x = JSON_String x
end

and ServiceDefinition: sig
Expand Down Expand Up @@ -1685,7 +1685,7 @@ end = struct
| Id f -> Util.id f
| Key t -> Util.key (to_json_key t)

and to_json_key str = JSON_String str
and to_json_key x = JSON_String x
end

and Namespace: sig
Expand Down
6 changes: 3 additions & 3 deletions hphp/hack/src/typing/write_symbol_info/glean/gencode.ml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ end = struct
| Id f -> Util.id f
| Key t -> Util.key (to_json_key t)

and to_json_key str = JSON_String str
and to_json_key x = JSON_String x
end

and GenCode: sig
Expand Down Expand Up @@ -133,7 +133,7 @@ end = struct
| Id f -> Util.id f
| Key t -> Util.key (to_json_key t)

and to_json_key str = JSON_String str
and to_json_key x = JSON_String x
end

and GenCodeBySource: sig
Expand Down Expand Up @@ -203,7 +203,7 @@ end = struct
| Id f -> Util.id f
| Key t -> Util.key (to_json_key t)

and to_json_key str = JSON_String str
and to_json_key x = JSON_String x
end


Expand Down
12 changes: 6 additions & 6 deletions hphp/hack/src/typing/write_symbol_info/glean/hack.ml
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,8 @@ end = struct
| Id f -> Util.id f
| Key t -> Util.key (to_json_key t)

and to_json_key str = JSON_String str
and to_json_value v = JSON_String (List.map ~f:Base64.encode_string v |> String.concat ~sep:"")
and to_json_key x = JSON_String x
and to_json_value x = JSON_String (List.map ~f:Base64.encode_string x|> String.concat ~sep:"")
end

and ClassDefinition: sig
Expand Down Expand Up @@ -513,7 +513,7 @@ end = struct
| Id f -> Util.id f
| Key t -> Util.key (to_json_key t)

and to_json_key str = JSON_String str
and to_json_key x = JSON_String x
end

and DeclarationLocation: sig
Expand Down Expand Up @@ -759,7 +759,7 @@ end = struct
| Id f -> Util.id f
| Key t -> Util.key (to_json_key t)

and to_json_key str = JSON_String str
and to_json_key x = JSON_String x
end

and MethodOccurrence: sig
Expand Down Expand Up @@ -2223,7 +2223,7 @@ end = struct
| Id f -> Util.id f
| Key t -> Util.key (to_json_key t)

and to_json_key str = JSON_String str
and to_json_key x = JSON_String x
end

and TargetUsesAbs: sig
Expand Down Expand Up @@ -2672,7 +2672,7 @@ end = struct
| Id f -> Util.id f
| Key t -> Util.key (to_json_key t)

and to_json_key str = JSON_String str
and to_json_key x = JSON_String x
end

and DeclarationTarget: sig
Expand Down
6 changes: 3 additions & 3 deletions hphp/hack/src/typing/write_symbol_info/glean/src.ml
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ end = struct
| Id f -> Util.id f
| Key t -> Util.key (to_json_key t)

and to_json_key str = JSON_String str
and to_json_key x = JSON_String x
end

and RangeContains: sig
Expand Down Expand Up @@ -288,7 +288,7 @@ end = struct
| Key t -> Util.key (to_json_key t)

and to_json_key x = File.to_json x
and to_json_value str = JSON_String str
and to_json_value x = JSON_String x
end


Expand Down Expand Up @@ -328,7 +328,7 @@ end = struct
type t = PackedByteSpansGroup.t list
[@@deriving ord]

let to_json l = JSON_Array (List.map ~f:(fun x -> PackedByteSpansGroup.to_json x) l)
let to_json x = JSON_Array (List.map ~f:(fun x -> PackedByteSpansGroup.to_json x) x)
end

and PackedByteSpansGroup: sig
Expand Down

0 comments on commit 62e1084

Please sign in to comment.