Commit bc9f280a authored by Ben Gamari's avatar Ben Gamari 🐢
Browse files

Eliminate word-size dependence in HsDumpAst output

Fixes DumpTypecheckedAst output on 32-bit platforms.
parent ff6ee998
......@@ -18,6 +18,7 @@ module HsDumpAst (
import Data.Data hiding (Fixity)
import Data.List
import Bag
import BasicTypes
import FastString
import NameSet
import Name
......@@ -46,7 +47,7 @@ showAstData b = showAstData' 0
showAstData' n =
generic
`ext1Q` list
`extQ` string `extQ` fastString `extQ` srcSpan
`extQ` string `extQ` fastString `extQ` srcSpan `extQ` lit
`extQ` bytestring
`extQ` name `extQ` occName `extQ` moduleName `extQ` var
`extQ` dataCon
......@@ -76,6 +77,19 @@ showAstData b = showAstData' 0
++ intercalate "," (map (showAstData' (n+1)) l)
++ "]"
-- Eliminate word-size dependence
lit :: HsLit -> String
lit (HsWordPrim s x) = numericLit "HsWord{64}Prim" x s
lit (HsWord64Prim s x) = numericLit "HsWord{64}Prim" x s
lit (HsIntPrim s x) = numericLit "HsInt{64}Prim" x s
lit (HsInt64Prim s x) = numericLit "HsInt{64}Prim" x s
lit l = generic l
numericLit :: String -> Integer -> SourceText -> String
numericLit tag x s = indent n ++ unwords [ "{" ++ tag
, generic x
, generic s ++ "}" ]
name :: Name -> String
name = ("{Name: "++) . (++"}") . showSDocDebug_ . ppr
......
......@@ -21,14 +21,14 @@
({abstract:ConLike})))
({ <no location info> }
(HsLit
(HsWordPrim
(NoSourceText)
(14073232900889011755))))))
{HsWord{64}Prim
(14073232900889011755)
(NoSourceText)}))))
({ <no location info> }
(HsLit
(HsWordPrim
(NoSourceText)
(2739668351064589274))))))
{HsWord{64}Prim
(2739668351064589274)
(NoSourceText)}))))
({ <no location info> }
(HsVar
({ <no location info> }{Var: (main:DumpTypecheckedAst.$trModule{v} [lidx] :: ghc-prim:GHC.Types.Module{tc})})))))
......@@ -45,9 +45,9 @@
(NoSourceText) "Peano")))))))))
({ <no location info> }
(HsLit
(HsIntPrim
(SourceText "0")
(0))))))
{HsInt{64}Prim
(0)
(SourceText "0")}))))
({ <no location info> }
(HsVar
({ <no location info> }{Var: (ghc-prim:GHC.Types.krep$*{v} [gid] :: ghc-prim:GHC.Types.KindRep{tc})})))))
......@@ -71,14 +71,14 @@
({abstract:ConLike})))
({ <no location info> }
(HsLit
(HsWordPrim
(NoSourceText)
(13760111476013868540))))))
{HsWord{64}Prim
(13760111476013868540)
(NoSourceText)}))))
({ <no location info> }
(HsLit
(HsWordPrim
(NoSourceText)
(12314848029315386153))))))
{HsWord{64}Prim
(12314848029315386153)
(NoSourceText)}))))
({ <no location info> }
(HsVar
({ <no location info> }{Var: (main:DumpTypecheckedAst.$trModule{v} [lidx] :: ghc-prim:GHC.Types.Module{tc})})))))
......@@ -95,9 +95,9 @@
(NoSourceText) "'Zero")))))))))
({ <no location info> }
(HsLit
(HsIntPrim
(SourceText "0")
(0))))))
{HsInt{64}Prim
(0)
(SourceText "0")}))))
({ <no location info> }
(HsVar
({ <no location info> }{Var: ($krep{v} [lid] :: ghc-prim:GHC.Types.KindRep{tc})})))))
......@@ -121,14 +121,14 @@
({abstract:ConLike})))
({ <no location info> }
(HsLit
(HsWordPrim
(NoSourceText)
(1143980031331647856))))))
{HsWord{64}Prim
(1143980031331647856)
(NoSourceText)}))))
({ <no location info> }
(HsLit
(HsWordPrim
(NoSourceText)
(14802086722010293686))))))
{HsWord{64}Prim
(14802086722010293686)
(NoSourceText)}))))
({ <no location info> }
(HsVar
({ <no location info> }{Var: (main:DumpTypecheckedAst.$trModule{v} [lidx] :: ghc-prim:GHC.Types.Module{tc})})))))
......@@ -145,9 +145,9 @@
(NoSourceText) "'Succ")))))))))
({ <no location info> }
(HsLit
(HsIntPrim
(SourceText "0")
(0))))))
{HsInt{64}Prim
(0)
(SourceText "0")}))))
({ <no location info> }
(HsVar
({ <no location info> }{Var: ($krep{v} [lid] :: ghc-prim:GHC.Types.KindRep{tc})})))))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment