git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Yet more generated/changed names changes
commit92b82dd00a1e54bce7ea77d541a8bbb9a038583b authorAndy Arvanitis <andyarvanitis@gmail.com> dateTue 25 Jun 2019, 21:29 (7 years ago) parentbcfa0d7
4 files changed+10−21
src/CodeGen/IL.hs+1−13 src/CodeGen/IL/Common.hs+4−3 src/CodeGen/IL/Optimizer/TCO.hs+2−2 src/CodeGen/IL/Printer.hs+3−3
src/CodeGen/IL.hs+1−13
@@ -63,7 +63,7 @@ moduleToIL (Module _ coms mn _ imps _ foreigns decls) _ =
6363 optimized <- traverse (traverse (optimize modName')) ilDecls
6464 let optimized' = concat optimized
6565 values = annotValue <$> optimized'
66− foreigns' = identToIL <$> foreigns
66+ foreigns' = moduleIdentToIL <$> foreigns
6767 interface = interfaceSource modName values foreigns
6868 implHeader = implHeaderSource modName (imports ++ ignoredImports) interfaceImport
6969 implFooter = implFooterSource modName foreigns
@@ -204,18 +204,6 @@ moduleToIL (Module _ coms mn _ imps _ foreigns decls) _ =
204204 unApp :: Expr Ann -> [Expr Ann] -> (Expr Ann, [Expr Ann])
205205 unApp (App _ val arg) args = unApp val (arg : args)
206206 unApp other args = (other, args)
207− -- valueToIL (Var (_, _, _, Just IsForeign) qi@(Qualified (Just mn') ident)) =
208− -- return $ if mn' == mn
209− -- then AST.Var Nothing (moduleNameToIL mn' <> "::" <> identToIL ident)
210− -- else varToIL qi
211− -- valueToIL (Var (_, _, _, Just IsForeign) (Qualified (Just mn') ident)) =
212− -- return $ AST.Var Nothing (moduleNameToIL mn' <> "::" <> identToIL ident)
213− -- valueToIL (Var (_, _, _, Just IsForeign) qi@(Qualified (Just mn') ident)) =
214− -- return $ if mn' == mn
215− -- then foreignIdent ident
216− -- else varToIL qi
217− -- valueToIL (Var (_, _, _, Just IsForeign) ident) =
218− -- internalError $ "Encountered an unqualified reference to a foreign ident " ++ T.unpack (showQualified showIdent ident)
219207 valueToIL (Var _ ident) = return $ varToIL ident
220208 valueToIL (Case (ss, _, _, _) values binders) = do
221209 vals <- mapM valueToIL values
src/CodeGen/IL/Common.hs+4−3
@@ -32,9 +32,10 @@ identToIL (Ident name) = properToIL name
3232identToIL (GenIdent _ _) = internalError "GenIdent in identToIL"
3333
3434moduleIdentToIL :: Ident -> Text
35+moduleIdentToIL UnusedIdent = unusedName
36+moduleIdentToIL (Ident name) | name == C.undefined = undefinedName
3537moduleIdentToIL (Ident name) = moduleProperToIL name
3638moduleIdentToIL (GenIdent _ _) = internalError "GenIdent in identToIL"
37−moduleIdentToIL _ = internalError "in moduleIdentToIL"
3839
3940undefinedName :: Text
4041undefinedName = "Undefined"
@@ -44,7 +45,7 @@ unusedName = "_"
4445
4546properToIL :: Text -> Text
4647properToIL name
47− | nameIsILReserved name || nameIsILBuiltIn name || prefixIsReserved name = name <> "ᵒ"
48+ | nameIsILReserved name || nameIsILBuiltIn name || prefixIsReserved name = name <> "ˉ"
4849 | otherwise = T.concatMap identCharToText name
4950
5051-- | Attempts to find a human-readable name for a symbol, if none has been specified returns the
@@ -171,4 +172,4 @@ arrayLengthFn :: Text
171172arrayLengthFn = "Length"
172173
173174tcoLoop :: Text
174−tcoLoop = "ᵗLoop"
175+tcoLoop = "ᵗᶜloop"
src/CodeGen/IL/Optimizer/TCO.hs+2−2
@@ -20,10 +20,10 @@ tco mn = everywhere convert where
2020 copyVar arg = "ᶜ" <> arg
2121
2222 tcoDone :: Text
23− tcoDone = "ᵗDone"
23+ tcoDone = "ᵗᶜdone"
2424
2525 tcoResult :: Text
26− tcoResult = "ᵗResult"
26+ tcoResult = "ᵗᶜresult"
2727
2828 convert :: AST -> AST
2929 convert fn@(Function ss (Just name) args _)
src/CodeGen/IL/Printer.hs+3−3
@@ -503,7 +503,7 @@ implFooterSource mn foreigns =
503503 else ("// Foreign values\n\n" <>
504504 "var " <> foreignDict <> " = " <> dictType <> "{}\n\n" <>
505505 (T.concat $ (\foreign' ->
506− let name = identToIL foreign' in
506+ let name = moduleIdentToIL foreign' in
507507 varDecl <> " " <> initName name <> " Once\n" <>
508508 varDecl <> " " <> valueName name <> " " <> anyType <> "\n\n" <>
509509 "func " <>
@@ -535,7 +535,7 @@ foreignDict :: Text
535535foreignDict = "Foreign"
536536
537537initName :: Text -> Text
538−initName s = "ᵢ" <> s
538+initName s = "ₒ" <> s
539539
540540valueName :: Text -> Text
541−valueName s = "ᵥ" <> s
541+valueName s = "ₐ" <> s