mirror of
https://github.com/carp-lang/Carp.git
synced 2024-10-05 17:47:30 +03:00
Revert "eval: fix resolve semantics for successive evaluation (#1116)"
This reverts commit 2db218353c
.
This commit is contained in:
parent
2db218353c
commit
6d2dde8bea
10
src/Eval.hs
10
src/Eval.hs
@ -282,7 +282,7 @@ eval ctx xobj@(XObj o info ty) preference resolver =
|
||||
\case
|
||||
err@(Left _) -> pure err
|
||||
Right ctx' -> do
|
||||
(newCtx, res) <- eval ctx' x preference resolver
|
||||
(newCtx, res) <- eval ctx' x preference ResolveLocal
|
||||
case res of
|
||||
Right okX -> do
|
||||
let binder = Binder emptyMeta (XObj (Lst [XObj LetDef Nothing Nothing, XObj (Sym (SymPath [] n) Symbol) Nothing Nothing, okX]) Nothing (xobjTy okX))
|
||||
@ -383,10 +383,10 @@ eval ctx xobj@(XObj o info ty) preference resolver =
|
||||
pure (popFrame newCtx', res)
|
||||
x -> pure (newCtx, x)
|
||||
x@(XObj (Sym _ _) i _) : args -> do
|
||||
(newCtx, f) <- eval ctx x preference resolver
|
||||
(newCtx, f) <- eval ctx x preference ResolveLocal
|
||||
case f of
|
||||
Right fun -> do
|
||||
(newCtx', res) <- eval (pushFrame ctx xobj) (XObj (Lst (fun : args)) i ty) preference resolver
|
||||
(newCtx', res) <- eval (pushFrame ctx xobj) (XObj (Lst (fun : args)) i ty) preference ResolveLocal
|
||||
pure (popFrame newCtx', res)
|
||||
Left err -> pure (newCtx, Left err)
|
||||
XObj With _ _ : xobj'@(XObj (Sym path _) _ _) : forms ->
|
||||
@ -401,7 +401,7 @@ eval ctx xobj@(XObj o info ty) preference resolver =
|
||||
successiveEval' (ctx', acc) x =
|
||||
case acc of
|
||||
err@(Left _) -> pure (ctx', err)
|
||||
Right _ -> eval ctx' x preference resolver
|
||||
Right _ -> eval ctx' x preference ResolveLocal
|
||||
[XObj While _ _, cond, body] ->
|
||||
specialCommandWhile ctx cond body
|
||||
[XObj Address _ _, value] ->
|
||||
@ -445,7 +445,7 @@ eval ctx xobj@(XObj o info ty) preference resolver =
|
||||
case acc of
|
||||
Left _ -> pure (ctx', acc)
|
||||
Right l -> do
|
||||
(newCtx, evald) <- eval ctx' x preference resolver
|
||||
(newCtx, evald) <- eval ctx' x preference ResolveLocal
|
||||
pure $ case evald of
|
||||
Right res -> (newCtx, Right (l ++ [res]))
|
||||
Left err -> (newCtx, Left err)
|
||||
|
Loading…
Reference in New Issue
Block a user