Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch jvm-parser package to use prettyprinter library. #1059

Merged
merged 1 commit into from
Feb 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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