@@ -89,9 +89,6 @@ defCommonGeneratorOptions = CommonGeneratorOptions
8989--
9090-- @TODO: specify better default function name, or throw error?
9191toValidFunctionName :: Text -> Text
92−-- @TODO: Cons text
93−--
94−
9592toValidFunctionName t =
9693 case T.uncons t of
9794 Just (x,xs) ->
@@ -101,29 +98,7 @@ toValidFunctionName t =
10198 setFirstChar c = if firstChar c then c else '_'
10299 firstChar c = prefixOK c || any (Set.member c) firstLetterOK
103100 remainder c = prefixOK c || any (Set.member c) remainderOK
104− -- Valid prefixes
105− prefixOK c = c `elem` ['$','_']
106− -- Unicode character sets
107− firstLetterOK = [ Set.lowercaseLetter
108− , Set.uppercaseLetter
109− , Set.titlecaseLetter
110− , Set.modifierLetter
111− , Set.otherLetter
112− , Set.letterNumber ]
113− remainderOK = firstLetterOK
114− <> [ Set.nonSpacingMark
115− , Set.spacingCombiningMark
116− , Set.decimalNumber
117− , Set.connectorPunctuation ]
118−{-
119−toValidFunctionName (x:xs) = [setFirstChar x] <> filter remainder xs
120− where
121− setFirstChar c = if firstChar c then c else '_'
122− firstChar c = prefixOK c || any (Set.member c) firstLetterOK
123− remainder c = prefixOK c || any (Set.member c) remainderOK
124− -- Valid prefixes
125101 prefixOK c = c `elem` ['$','_']
126− -- Unicode character sets
127102 firstLetterOK = [ Set.lowercaseLetter
128103 , Set.uppercaseLetter
129104 , Set.titlecaseLetter
@@ -135,8 +110,6 @@ toValidFunctionName (x:xs) = [setFirstChar x] <> filter remainder xs
135110 , Set.spacingCombiningMark
136111 , Set.decimalNumber
137112 , Set.connectorPunctuation ]
138−toValidFunctionName [] = "_"
139−-}
140113
141114toJSHeader :: HeaderArg -> Text
142115toJSHeader (HeaderArg n) = toValidFunctionName ("header" <> n)