Skip to content
  • Sylvain Henry's avatar
    Move loader state into Interp · 05c5c054
    Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
    The loader state was stored into HscEnv. As we need to have two
    interpreters and one loader state per interpreter in #14335, it's
    natural to make the loader state a field of the Interp type.
    
    As a side effect, many functions now only require a Interp parameter
    instead of HscEnv. Sadly we can't fully free GHC.Linker.Loader of HscEnv
    yet because the loader is initialised lazily from the HscEnv the first
    time it is used. This is left as future work.
    
    HscEnv may not contain an Interp value (i.e. hsc_interp :: Maybe Interp).
    So a side effect of the previous side effect is that callers of the
    modified functions now have to provide an Interp. It is satisfying as it
    pushes upstream the handling of the case where HscEnv doesn't contain an
    Interpreter. It is better than raising a panic (less partial functions,
    "parse, don't validate", etc.).
    05c5c054