Skip to content

Commit

Permalink
Switch jvm-parser package to use prettyprinter library.
Browse files Browse the repository at this point in the history
Fixes #951.
  • Loading branch information
Brian Huffman committed Feb 4, 2021
1 parent f8449a1 commit 4f8c28d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
2 changes: 1 addition & 1 deletion deps/jvm-parser
4 changes: 0 additions & 4 deletions src/SAWScript/Crucible/JVM/MethodSpecIR.hs
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,6 @@ type instance MS.TypeName CJ.JVM = JIdent

type instance MS.ExtType CJ.JVM = J.Type

-- TODO: remove when jvm-parser switches to prettyprinter
instance PPL.Pretty J.Type where
pretty = PPL.viaShow

--------------------------------------------------------------------------------
-- *** JVMMethodId

Expand Down
7 changes: 3 additions & 4 deletions src/SAWScript/JavaPretty.hs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ prettyField :: Field -> Doc ann
prettyField f = hsep $
[ viaShow (fieldVisibility f) ] ++
attrs ++
[ viaShow (ppType (fieldType f)) -- TODO: Ick. Different PPs.
[ ppType (fieldType f)
, pretty (fieldName f)
]
where attrs = concat
Expand All @@ -67,12 +67,11 @@ prettyMethod :: Method -> Doc ann
prettyMethod m =
hsep $
(if methodIsStatic m then ["static"] else []) ++
[ maybe "void" prettyType ret
[ maybe "void" ppType ret
, pretty name
, (parens . commas . map prettyType) params
, (parens . commas . map ppType) params
]
where (MethodKey name params ret) = methodKey m
prettyType = viaShow . ppType -- TODO: Ick.

commas :: [Doc ann] -> Doc ann
commas = sep . punctuate comma

0 comments on commit 4f8c28d

Please sign in to comment.