Skip to main content

Scopes

Trait Scopes 

Source
pub trait Scopes {
    // Required methods
    fn head_kind(&self, name: &str) -> Option<HeadKind>;
    fn open(&mut self);
    fn bind(&mut self, name: &str, span: Span, kind: BinderKind);
    fn close(&mut self);
    fn reference(&mut self, node: &Spanned, name: &str, opaque: bool);

    // Provided methods
    fn head(&mut self, _node: &Spanned, _name: &str, _kind: HeadKind) { ... }
    fn template_symbol(&mut self, _node: &Spanned, _name: &str) { ... }
}
Expand description

A pass over the binder grammar. The walker calls these in source order.

Required Methods§

Source

fn head_kind(&self, name: &str) -> Option<HeadKind>

Which arbiter claims name as a head, if any. None walks the call as an ordinary application.

Source

fn open(&mut self)

A frame opens: a function body, a let, a catch, a test body.

Source

fn bind(&mut self, name: &str, span: Span, kind: BinderKind)

name is bound in the innermost open frame.

Source

fn close(&mut self)

The innermost frame closes.

Source

fn reference(&mut self, node: &Spanned, name: &str, opaque: bool)

A symbol in code position. opaque: inside a macro call’s arguments, which are syntax the macro may never evaluate.

Provided Methods§

Source

fn head(&mut self, _node: &Spanned, _name: &str, _kind: HeadKind)

The head of a special form or a macro call — not a reference to a binding, but still a name the program writes.

Source

fn template_symbol(&mut self, _node: &Spanned, _name: &str)

A symbol inside a quasiquoted template, outside any unquote: data at expansion, code once the expansion runs.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§