From 4f8c28d8d4730704a8aff09f2e984c9a01e9b3e5 Mon Sep 17 00:00:00 2001 From: Brian Huffman Date: Tue, 2 Feb 2021 11:49:17 -0800 Subject: [PATCH] Switch jvm-parser package to use prettyprinter library. Fixes #951. --- deps/jvm-parser | 2 +- src/SAWScript/Crucible/JVM/MethodSpecIR.hs | 4 ---- src/SAWScript/JavaPretty.hs | 7 +++---- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/deps/jvm-parser b/deps/jvm-parser index d440e6bc91..af447d7210 160000 --- a/deps/jvm-parser +++ b/deps/jvm-parser @@ -1 +1 @@ -Subproject commit d440e6bc91c9ba7d48f04e3a7cbf3086d9720b1e +Subproject commit af447d7210f10af62c8b2c63c6a74233a725d317 diff --git a/src/SAWScript/Crucible/JVM/MethodSpecIR.hs b/src/SAWScript/Crucible/JVM/MethodSpecIR.hs index 815f8feccf..9b0ba26534 100644 --- a/src/SAWScript/Crucible/JVM/MethodSpecIR.hs +++ b/src/SAWScript/Crucible/JVM/MethodSpecIR.hs @@ -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 diff --git a/src/SAWScript/JavaPretty.hs b/src/SAWScript/JavaPretty.hs index 2efb246874..1cdf406d34 100644 --- a/src/SAWScript/JavaPretty.hs +++ b/src/SAWScript/JavaPretty.hs @@ -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 @@ -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