fix: don't combine internal envs in closures (#1126)

This commit is contained in:
Scott Olsen 2021-01-13 01:16:38 -05:00 committed by GitHub
parent 381fa0f179
commit 9bd44227c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -313,7 +313,9 @@ eval ctx xobj@(XObj o info ty) preference resolver =
(newCtx, evaledArgs) <- foldlM successiveEval (ctx, Right []) args
case evaledArgs of
Right okArgs -> do
(_, res) <- apply (c {contextHistory = contextHistory ctx} <> ctx) body params okArgs
let newGlobals = (contextGlobalEnv newCtx) <> (contextGlobalEnv c)
newTypes = TypeEnv $ (getTypeEnv (contextTypeEnv newCtx)) <> (getTypeEnv (contextTypeEnv c))
(_, res) <- apply (c {contextHistory = contextHistory ctx, contextGlobalEnv = newGlobals, contextTypeEnv = newTypes}) body params okArgs
pure (newCtx, res)
Left err -> pure (newCtx, Left err)
XObj (Lst [XObj Dynamic _ _, sym, XObj (Arr params) _ _, body]) i _ : args ->