Skip to main content

LoweredCalls

Trait LoweredCalls 

Source
pub trait LoweredCalls {
    // Required methods
    fn call(
        &mut self,
        name: &str,
        args: Vec<RuntimeValue>,
    ) -> Result<RuntimeValue, String>;
    fn call_value(
        &mut self,
        callee: &RuntimeValue,
        args: Vec<RuntimeValue>,
    ) -> Result<RuntimeValue, String>;
    fn has(&self, name: &str) -> bool;
    fn reload(&mut self) -> Result<(), String>;
    fn lines(&self) -> &[String];

    // Provided methods
    fn failure_site(&self) -> Option<u32> { ... }
    fn take_unhandled(&mut self) -> Option<(String, Option<u32>)> { ... }
}
Expand description

An engine a lowered page runs on, seen from the host: call a function the page defines, call a closure it handed out, ask whether it defines a name, and reload it.

Required Methods§

Source

fn call( &mut self, name: &str, args: Vec<RuntimeValue>, ) -> Result<RuntimeValue, String>

Source

fn call_value( &mut self, callee: &RuntimeValue, args: Vec<RuntimeValue>, ) -> Result<RuntimeValue, String>

Source

fn has(&self, name: &str) -> bool

Source

fn reload(&mut self) -> Result<(), String>

The page reloaded: a fresh instance of the same program, its main run again.

Source

fn lines(&self) -> &[String]

Every line the engine has shown, main and every call since, in order.

Provided Methods§

Source

fn failure_site(&self) -> Option<u32>

The failure site (Stmt::Site) in force when the most recent failed call trapped — where in the page’s source it failed — for an engine that tracks one.

Source

fn take_unhandled(&mut self) -> Option<(String, Option<u32>)>

A failure the page’s own code contained while it ran — a turn a driving verb the program runs on its own page took (crate::semantics::builtins::BuiltinId::DomDispatchEntry), whose failure door already heard it and no handler absorbed — with its failure site, for the host to hold as the page’s failure. None for an engine whose entries report through this host alone.

Implementors§

Source§

impl LoweredCalls for Session<'_>

Source§

impl<'a> LoweredCalls for Interpreter<'a>

The tree-walker as the engine a lowered page runs on (crate::page_host::LoweredPage’s host calls): the page’s main has run through Interpreter::run_page_main, and every call lands on the globals it built — the same model, the same failure contract and the same refusals as the bytecode VM’s crate::vm::session::Session. A call that fails unwinds every frame, scope and loop it opened and leaves the page callable.