Permalink
Browse files

Add spaces between elements and braces in non empty collections for d…

…efault value pretty printing

Summary: Add spaces between elements and braces in non empty collections for default value pretty printing

Reviewed By: vladima

Differential Revision: D6887234

fbshipit-source-id: 94a89bd3658a89237a07de7c7b92f788be099ed4
  • Loading branch information...
oulgen authored and hhvm-bot committed Feb 3, 2018
1 parent 01a979d commit 242c07c91fa0e4a10deee1bc3134ec074ce7cff6
Showing with 5 additions and 2 deletions.
  1. +5 −2 hphp/hack/src/hhbc/hhbc_hhas.ml
@@ -1106,7 +1106,7 @@ and string_of_param_default_value ~env expr =
| A.Null -> "NULL"
| A.True -> "true"
| A.False -> "false"
(* For arrays and collections, we are making a concious decision to not
(* For arrays and collections, we are making a conscious decision to not
* match HHMV has HHVM's emitter has inconsistencies in the pretty printer
* https://fburl.com/tzom2qoe *)
| A.Array afl ->
@@ -1119,7 +1119,10 @@ and string_of_param_default_value ~env expr =
begin match name with
| "Set" | "Pair" | "Vector" | "Map"
| "ImmSet" | "ImmVector" | "ImmMap" ->
"HH\\\\" ^ name ^ " {" ^ string_of_afield_list ~env afl ^ "}"
let elems = string_of_afield_list ~env afl in
let elems =
if String.length elems <> 0 then " " ^ elems ^ " " else elems in
"HH\\\\" ^ name ^ " {" ^ elems ^ "}"
| _ ->
nyi ^ " - Default value for an unknown collection - " ^ name
end

0 comments on commit 242c07c

Please sign in to comment.