@@ -322,9 +322,9 @@ instance Pretty AltType where
322322 AlgAlt tc -> text " AlgAlt" <+> ppTyConName tc
323323
324324pprAlt :: Id -> Int -> Alt -> Doc
325- pprAlt scrutId idx (Alt con bndrs rhs) =
325+ pprAlt ( Id scrutBinder) idx (Alt con bndrs rhs) =
326326 (hsep (pretty con : map (pprBinder) bndrs) <+> text " -> do" ) <$$>
327- indent 2 (withStgPoint (SP_AltExpr scrutId idx) $ pprExpr rhs)
327+ indent 2 (withStgPoint (SP_AltExpr (binderToStgId scrutBinder) idx) $ pprExpr rhs)
328328
329329pprArg :: Arg -> Doc
330330pprArg = \ case
@@ -409,19 +409,19 @@ pprExpr exp = do
409409 annotate stgPoint $ case exp of
410410 StgLit l -> pretty l
411411 StgCase x b at [Alt AltDefault [] rhs] -> sep
412- [ withStgPoint (SP_CaseScrutineeExpr $ Id b) $
412+ [ withStgPoint (SP_CaseScrutineeExpr $ binderToStgId b) $
413413 pprBinder b <+> text " <-" <+> nest 2 (pprExpr x)
414- , withStgPoint (SP_AltExpr (Id b) 0 ) $
414+ , withStgPoint (SP_AltExpr (binderToStgId b) 0 ) $
415415 pprExpr rhs
416416 ]
417417 StgCase x b at [Alt con bndrs rhs] -> sep
418- [ withStgPoint (SP_CaseScrutineeExpr $ Id b) $
418+ [ withStgPoint (SP_CaseScrutineeExpr $ binderToStgId b) $
419419 pprBinder b <+> text " @" <+> parens (hsep $ pretty con : map (pprBinder) bndrs) <+> text " <-" <+> nest 2 (pprExpr x)
420- , withStgPoint (SP_AltExpr (Id b) 0 ) $
420+ , withStgPoint (SP_AltExpr (binderToStgId b) 0 ) $
421421 pprExpr rhs
422422 ]
423423 StgCase x b at alts -> sep
424- [ withStgPoint (SP_CaseScrutineeExpr $ Id b) $
424+ [ withStgPoint (SP_CaseScrutineeExpr $ binderToStgId b) $
425425 pprBinder b <+> text " <-" <+> nest 2 (pprExpr x)
426426 , text " case" <+> pprVar b <+> text " of"
427427 , indent 2 $ vcat $ putDefaultLast alts [pprAlt (Id b) idx a | (idx, a) <- zip [0 .. ] alts]
@@ -437,7 +437,7 @@ pprExpr exp = do
437437 StgTick tickish e -> do
438438 Config {.. } <- speConfig <$> askEnv
439439 if cfgPrintTickish
440- then vsep [pretty tickish, pprExpr e]
440+ then vsep [annotate ( SP_Tickish stgPoint) $ pretty tickish, pprExpr e]
441441 else pprExpr e
442442
443443instance Pretty Expr where
@@ -456,9 +456,10 @@ pprSrcSpan = \case
456456 RealSrcSpan sp _ -> text "-- src-loc:" <+> pretty sp
457457-}
458458pprRhs :: Id -> Rhs -> Doc
459- pprRhs rhsId@ (Id rhsBinder) = \ case
460- StgRhsClosure _ u bs e -> pprBinder rhsBinder <+> hsep (map pprBinder bs) <+> text " = do" <> (newline <> (indent 2 $ withStgPoint (SP_RhsClosureExpr rhsId) $ pprExpr e))
461- StgRhsCon dc vs -> annotate (SP_RhsCon rhsId) $ do
459+ pprRhs (Id rhsBinder) = \ case
460+ StgRhsClosure _ u bs e -> annotate (SP_Binding $ binderToStgId rhsBinder) $ do
461+ pprBinder rhsBinder <+> hsep (map pprBinder bs) <+> text " = do" <> (newline <> (indent 2 $ withStgPoint (SP_RhsClosureExpr $ binderToStgId rhsBinder) $ pprExpr e))
462+ StgRhsCon dc vs -> annotate (SP_RhsCon $ binderToStgId rhsBinder) $ do
462463 pprBinder rhsBinder <+> text " =" <+> addUnboxedCommentIfNecessary dc (pprDataConName dc <+> (hsep $ map (pprArg) vs))
463464
464465pprBinding :: Binding -> Doc
0 commit comments