mirror of
https://github.com/github/semantic.git
synced 2024-12-15 01:51:39 +03:00
Pass prelude scope graph and heap to evalModule
Co-Authored-By: Rick Winfrey <rick.winfrey@gmail.com>
This commit is contained in:
parent
87d2b68e4d
commit
5084eece82
@ -78,14 +78,14 @@ evaluate :: ( AbstractValue term address value (ValueC term address value inner)
|
|||||||
-> Evaluator term address value outer (ModuleTable (NonEmpty (Module (ModuleResult address value))))
|
-> Evaluator term address value outer (ModuleTable (NonEmpty (Module (ModuleResult address value))))
|
||||||
evaluate lang perModule runTerm modules = do
|
evaluate lang perModule runTerm modules = do
|
||||||
let prelude = Module moduleInfoFromCallStack (Left lang)
|
let prelude = Module moduleInfoFromCallStack (Left lang)
|
||||||
(preludeScopeGraph, _) <- evalModule lowerBound prelude
|
(preludeScopeGraph, (heap, _)) <- evalModule lowerBound lowerBound prelude
|
||||||
foldr (run preludeScopeGraph . fmap Right) ask modules
|
foldr (run preludeScopeGraph heap . fmap Right) ask modules
|
||||||
where run prelude m rest = do
|
where run preludeScopeGraph preludeHeap m rest = do
|
||||||
evaluated <- evalModule prelude m
|
evaluated <- evalModule preludeScopeGraph preludeHeap m
|
||||||
-- FIXME: this should be some sort of Monoidal insert à la the Heap to accommodate multiple Go files being part of the same module.
|
-- FIXME: this should be some sort of Monoidal insert à la the Heap to accommodate multiple Go files being part of the same module.
|
||||||
local (ModuleTable.insert (modulePath (moduleInfo m)) ((evaluated <$ m) :| [])) rest
|
local (ModuleTable.insert (modulePath (moduleInfo m)) ((evaluated <$ m) :| [])) rest
|
||||||
|
|
||||||
evalModule prelude m = runInModule (perModule (runValueEffects . moduleBody) m)
|
evalModule scopeGraph heap m = runInModule (perModule (runValueEffects . moduleBody) m)
|
||||||
where runInModule
|
where runInModule
|
||||||
= raiseHandler (runReader (moduleInfo m))
|
= raiseHandler (runReader (moduleInfo m))
|
||||||
. runAllocator
|
. runAllocator
|
||||||
|
Loading…
Reference in New Issue
Block a user