diff options
author | Joel Burget <joel@khanacademy.org> | 2014-10-07 08:51:13 -0500 |
---|---|---|
committer | Austin Seipp <austin@well-typed.com> | 2014-10-07 08:51:14 -0500 |
commit | 9ebbdf3fa5d0d34d8b42fbd3e79ac2a1cfa9272d (patch) | |
tree | 15155af3bf73952f54d7cb526fe22f483f16dac5 /compiler/ghci/ByteCodeLink.lhs | |
parent | 1f924208b3d85ed115c16f40ad9fc2f729fbb344 (diff) | |
download | haskell-9ebbdf3fa5d0d34d8b42fbd3e79ac2a1cfa9272d.tar.gz |
Clean up and remove todo.
Summary:
The code is equivalent, just formatted nicely and without the
enthusiastic message to clean it up.
Test Plan: None
Reviewers: austin
Reviewed By: austin
Subscribers: simonmar, ezyang, carter, thomie
Differential Revision: https://phabricator.haskell.org/D307
Diffstat (limited to 'compiler/ghci/ByteCodeLink.lhs')
-rw-r--r-- | compiler/ghci/ByteCodeLink.lhs | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/compiler/ghci/ByteCodeLink.lhs b/compiler/ghci/ByteCodeLink.lhs index af31dc19e7..9656dfb9b7 100644 --- a/compiler/ghci/ByteCodeLink.lhs +++ b/compiler/ghci/ByteCodeLink.lhs @@ -257,25 +257,28 @@ linkFail who what , " glasgow-haskell-bugs@haskell.org" ]) --- HACKS!!! ToDo: cleaner -nameToCLabel :: Name -> String{-suffix-} -> String -nameToCLabel n suffix - = if pkgid /= mainPackageKey - then package_part ++ '_': qual_name - else qual_name - where - pkgid = modulePackageKey mod - mod = ASSERT( isExternalName n ) nameModule n - package_part = zString (zEncodeFS (packageKeyFS (modulePackageKey mod))) - module_part = zString (zEncodeFS (moduleNameFS (moduleName mod))) - occ_part = zString (zEncodeFS (occNameFS (nameOccName n))) - qual_name = module_part ++ '_':occ_part ++ '_':suffix - - -primopToCLabel :: PrimOp -> String{-suffix-} -> String -primopToCLabel primop suffix - = let str = "ghczmprim_GHCziPrimopWrappers_" ++ zString (zEncodeFS (occNameFS (primOpOcc primop))) ++ '_':suffix - in --trace ("primopToCLabel: " ++ str) - str + +nameToCLabel :: Name -> String -> String +nameToCLabel n suffix = label where + encodeZ = zString . zEncodeFS + (Module pkgKey modName) = ASSERT( isExternalName n ) nameModule n + packagePart = encodeZ (packageKeyFS pkgKey) + modulePart = encodeZ (moduleNameFS modName) + occPart = encodeZ (occNameFS (nameOccName n)) + + label = concat + [ if pkgKey == mainPackageKey then "" else packagePart ++ "_" + , modulePart + , '_':occPart + , '_':suffix + ] + + +primopToCLabel :: PrimOp -> String -> String +primopToCLabel primop suffix = concat + [ "ghczmprim_GHCziPrimopWrappers_" + , zString (zEncodeFS (occNameFS (primOpOcc primop))) + , '_':suffix + ] \end{code} |