Fixed it so that names beginning with an upper-case letter are prefixed by an underscore in the CHP backend

This commit is contained in:
Neil Brown 2008-11-27 09:24:31 +00:00
parent 769ed4f3ca
commit e79ccf1b46

View File

@ -88,7 +88,12 @@ withIndent :: CGen () -> CGen ()
withIndent f = pushIndent >> f >> popIndent
genName :: A.Name -> CGen ()
genName n = tell [[if c == '.' then '_' else c | c <- A.nameName n]]
genName n = let unders = [if c == '.' then '_' else c | c <- A.nameName n] in
-- Prefix underscore to anything beginning with upper-case:
if isUpper (head unders)
then tell ["_",unders]
else tell [unders]
genMissing = flip genMissing' ()