2Module : IRTS.JavaScript.Name
3Description : The JavaScript name mangler.
6Maintainer : The Idris Community.
9{-# LANGUAGE OverloadedStrings, PatternGuards #-}
11module IRTS.JavaScript.Name
23import Data.Text (Text)
24import qualified Data.Text as T
27jsEscape :: String -> String
28jsEscape = concatMap jschar
31 | isAlpha x || isDigit x = [x]
33 | otherwise = "_" ++ show (fromEnum x) ++ "_"
36jsName (MN i u) = T.concat ["$_", T.pack (show i), "_", T.pack $ jsEscape $ T.unpack u]
37jsName n = T.pack $ jsEscape $ showCG n
39jsNameGenerated :: Int -> Text
40jsNameGenerated v = T.pack $ "$cg$" ++ show v
42data Partial = Partial Name Int Int deriving (Eq, Ord)
44jsNamePartial :: Partial -> Text
45jsNamePartial (Partial n i j) = T.concat ["$partial_", T.pack $ show i, "_", T.pack $ show j, "$" , jsName n]
47jsTailCallOptimName :: Text -> Text
48jsTailCallOptimName x = T.concat ["$tco$", x]
51data HiddenClass = HiddenClass Name Int Int deriving (Eq, Ord)
53jsNameHiddenClass :: HiddenClass -> Text
54jsNameHiddenClass (HiddenClass n id arity) = T.concat ["$HC_", T.pack $ show arity, "_", T.pack $ show id,"$", jsName n]
56dataPartName :: Int -> Text
57dataPartName i = T.pack $ "$" ++ show i
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list