Struct kailua_check::Checker
[−]
[src]
pub struct Checker<'inp, 'envr, 'env: 'envr, R: 'env> { /* fields omitted */ }
The actual type checker.
This depends on both the per-file context Env
(which in turn depends on the global context Context
)
and also a lifetime of the input chunk.
Therefore the checker is actually per-file,
but it internally creates nested Env
and checkers to load other modules.
Methods
impl<'inp, 'envr, 'env, R: Report> Checker<'inp, 'envr, 'env, R>
[src]
fn new(env: &'envr mut Env<'env, R>) -> Checker<'inp, 'envr, 'env, R>
Creates a new checker from the per-file context.
fn visit(&mut self, chunk: &'inp Spanned<Block>) -> Result<()>
Type-checks a given chunk (here is same to the top-level block).
fn require(
&mut self,
modname: Spanned<&[u8]>,
expspan: Span
) -> Result<Option<Module>>
&mut self,
modname: Spanned<&[u8]>,
expspan: Span
) -> Result<Option<Module>>
Require
s a given module name and returns the resulting module.
Essentially same to the specialized require(modname)
call,
and normally used to provide the preloaded environment.
(Use Context::open_library
for preloading --# open
, by the way.)
There are two spans associated: the name span and the expression span.
The former span is used to pinpoint the problematic module name from the reports;
the latter span is used to track the require
call (e.g. recursive require
).
Returns the resulting module (that may have diverged, in which case returns
is None
)
or None
when the error occurred and has been recovered.