aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2022-09-10 15:14:12 +0100
committerJuan J. Martinez <jjm@usebox.net>2022-09-10 15:14:12 +0100
commita88e94504679a5aeaf102c975d873cbc14620f61 (patch)
treea6cbbcf14bae1b2f0c82aa5834492963bb48d17e
parent22c9414d07e6514fd0329fbceb3132766beb3cda (diff)
downloadmicro-lang-hs-a88e94504679a5aeaf102c975d873cbc14620f61.tar.gz
micro-lang-hs-a88e94504679a5aeaf102c975d873cbc14620f61.zip
Not needed
-rw-r--r--src/Micro/Compiler.hs6
-rw-r--r--src/Micro/Env.hs5
2 files changed, 4 insertions, 7 deletions
diff --git a/src/Micro/Compiler.hs b/src/Micro/Compiler.hs
index 1b17794..cc71f9c 100644
--- a/src/Micro/Compiler.hs
+++ b/src/Micro/Compiler.hs
@@ -156,7 +156,7 @@ compile x = do
(ev, errs) <- return $ (stEnv st, (verifyFuncType ident params ret pos) ++ stErr st)
-- updated with the function
(ev, errs) <-
- return $ case addSymUniq ev (newSym ident ftype priv False pos) of
+ return $ case addSymUniq ev (Sym ident ftype priv False pos) of
Left err -> (ev, err : errs)
Right ev -> (ev, errs)
-- lambdas can only access local variables (closures aren't supported)
@@ -164,7 +164,7 @@ compile x = do
-- with parameters
(nev, errs) <- return $ foldlEither addSymUniq (addEnv fev, errs) $ map (toSym True) params
-- helper for return
- nev <- return $ addSym nev $ newSym "$fn$" ftype True True pos
+ nev <- return $ addSym nev $ Sym "$fn$" ftype True True pos
put st {stEnv = nev, stErr = errs}
_ <- compileAll body
st <- get
@@ -184,7 +184,7 @@ compile x = do
_ -> addError $ Error NonCallable "non callable value in function call" pos
(A.Var ident typ val priv pos) -> do
st <- get
- (ev, errs) <- return $ foldlEither addSymUniq (stEnv st, stErr st) [newSym ident typ priv True pos]
+ (ev, errs) <- return $ foldlEither addSymUniq (stEnv st, stErr st) [Sym ident typ priv True pos]
errs <-
return $
if not (definedType typ)
diff --git a/src/Micro/Env.hs b/src/Micro/Env.hs
index 9de7248..731f19a 100644
--- a/src/Micro/Env.hs
+++ b/src/Micro/Env.hs
@@ -15,12 +15,9 @@ data Sym = Sym
}
deriving (Show)
-newSym :: A.Ident -> A.Type -> Bool -> Bool -> SourcePos -> Sym
-newSym a b c d e = Sym {symId = a, symType = b, symPriv = c, symRef = d, symPos = e}
-
-- XXX: this name is not good
toSym :: Bool -> A.FuncParam -> Sym
-toSym ref (a, b, c, d) = newSym a b c ref d
+toSym ref (a, b, c, d) = Sym a b c ref d
type SymMap = Map.Map A.Ident Sym