Commit d9d3edfb authored by simonpj's avatar simonpj
Browse files

[project @ 2003-07-11 08:53:25 by simonpj]

Fix the big-char-literal parsing issue in External Core, correctly this time
parent 6c2e1623
......@@ -26,7 +26,6 @@ import IdInfo
import Id ( idUnfolding )
import CoreTidy ( tidyExpr )
import VarEnv ( emptyTidyEnv )
import TysPrim ( intPrimTy )
import Literal
import Name
import CostCentre
......@@ -165,8 +164,8 @@ make_lit :: Literal -> C.Lit
make_lit l =
case l of
MachChar i | i <= 0xff -> C.Lchar (chr i) t
MachChar i | otherwise -> C.Lint (toEnum i) (make_ty intPrimTy)
-- For 'big' characters, use an integer
MachChar i | otherwise -> C.Lint (toEnum i) t
-- For big characters, use an integer literal with a character type sig
MachStr s -> C.Lstring (unpackFS s) t
MachNullAddr -> C.Lint 0 t
MachInt i -> C.Lint i t
......
......@@ -263,6 +263,7 @@ convIntLit :: Integer -> RdrNameHsType -> Literal
convIntLit i (HsTyVar n)
| n == intPrimRdrName = MachInt i
| n == wordPrimRdrName = MachWord i
| n == charPrimRdrName = MachChar (fromInteger i)
convIntLit i aty
= pprPanic "Unknown integer literal type" (ppr aty $$ ppr intPrimRdrName)
......@@ -277,6 +278,7 @@ convRatLit i aty
wordPrimRdrName, intPrimRdrName, floatPrimRdrName, doublePrimRdrName :: RdrName
wordPrimRdrName = nameRdrName wordPrimTyConName
intPrimRdrName = nameRdrName intPrimTyConName
charPrimRdrName = nameRdrName charPrimTyConName
floatPrimRdrName = nameRdrName floatPrimTyConName
doublePrimRdrName = nameRdrName doublePrimTyConName
......
Supports Markdown
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