~/bend-docscommunity

src/syntax/bind.bend checks

raw source on the hub · import bolt@1.57.0.0/src/syntax/bind.bend as Bind

src/syntax/bind: where every name in a source is bound, and what every other name refers to. One walk over the tree threads an environment (the binders in scope, innermost first) through Bend's binding forms: - an item's name (def f, type T, law l, a constructor line); - a telescope: a def's parameters, a type's parameters, a constructor's fields, each type seeing the names before it; - case p: patterns and for x: T / exs x: T where P, for the lines under them; - a let (x = v, +x = v, x : T = v, x : T <- m, a b = f g, (a, K{b}) = p) for the lines after it in its block -- the right side sees the outer names, so st = step(st) reads the old st, on one line or with the value on the lines under a let that ends in = or <-; under a let that ends in => they are the lambda's body and see its parameters too; - x => e, @x: A -> B and &x: A -> B, for the rest of their sequence. A named rewrite %h@e : P binds nothing: h and the @ are stepped over, so e is read as the term it is and not as the @e: of an arrow. The walk branches on token and statement kinds, never on a computed test, so each step recurses on one subtree and the checker accepts it. A binder shadows an item of the same name; a dotted name is an item of the file (text.of) or, through an import alias, of another file (Lex.Tok); anything else is free (Base, or unknown).

4 imports
import Base
import ./lex.bend as Lex
import ../lazy/lazy.bend as Lazy
import ./tree.bend as Tree

Types

type BindKind source · line 31 · raw

Data

what a binder is: an item's or a constructor's name, a parameter, a type's parameter, a constructor's field, a let name, a pattern binder, a law's for, or a type-level @x: / &x:

type Bind source · line 45 · raw

Data

KLocal is a name a let, a do-bind or a lambda binds; KPat one bound by a pattern (a case, or a destructuring let). note: what to show for it -- a declaration's own text (+x: U32), else the line that bound it

type Target source · line 50 · raw

Data

what a use refers to: a binder of the file (by position), an item of the file, an item behind an import alias, or nothing known (Base, or unknown)

type Use source · line 57 · raw

Data

a name that is not a binder, with what it refers to

type Scope source · line 61 · raw

Data

the names in scope at a statement's line

type Bound source · line 65 · raw

Data

everything the binder knows about a source, each list in source order

type Pos source · line 69 · raw

Data

a line and a column

type Index source · line 260 · raw

Data

The index of a file's items. Every use no binder holds asks whether its name is an item, and a scan of the items for each one is the uses times the items: a file of 6,500 items spent 14.5 s there and 0.1 s on all the rest of its binding. The index is a binary trie on the low bits of a number folded from the name's chars, a leaf holding the names that reach it; a lookup walks down by the asked name's number and scans that one leaf. It answers as the scan does (laws/BinderIndexFindsItems.bend).

type Names source · line 346 · raw

Data

the names an environment holds: the file's items, its aliases, and the index of the items, which is what a lookup reads

type Out source · line 373 · raw

Data

what the walk has gathered so far, each list reversed

type Mode source · line 380 · raw

Data

what the walk is reading; MLhs and MLhsType carry the environment the right side of the let will see, and MLhs the kind its names bind with. MSkip steps over one node (a name a form already bound), then reads on in next; MStop reads nothing more

type W source · line 396 · raw

Data

the walk's result: the environment after, and the output

type Under source · line 922 · raw

Data

what the lines under a statement are to it. Bend's blocks are layout-free, and the tree puts every deeper line under the line above it, so under a let they are one of three things, told by the let's last token: its value (the let's own line ends in = or <-), the body of the lambda that is its value (it ends in =>), or simply the next statements

type Site source · line 1101 · raw

Data

where a name is: a binder, or a use of one

Definitions

def declared.is_name source · line 76 · raw

@k:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/lex.TokKind -> Bool

a name that can be declared: plain, capitalized or dotted

def declared.name source · line 88 · raw

@n:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/tree.Node -> Maybe<&2, String>

a leaf's name, when its kind is one: the kind is tested, the text only kept

def declared.go source · line 96 · raw

@kids:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/tree.Node -> Maybe<&2, String>

the item a statement declares: the first name after its keyword

def declared.is_key source · line 104 · raw

@k:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/lex.TokKind -> Bool

a keyword?

def declared.key source · line 112 · raw

@n:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/tree.Node -> Bool

a keyword leaf? its kind is read, never its text

def declared source · line 120 · raw

@kids:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/tree.Node -> Maybe<&2, String>

the item a statement declares: the first name after its keyword

def push_name.again source · line 128 · raw

@acc:List<&2, String> -> @+name:String -> Bool

is the name at the head of the list?

def push_name source · line 138 · raw

@m:Maybe<&2, String> -> @+acc:List<&2, String> -> List<&2, String>

a name, when there is one, onto a list, unless it is the name just put there: a proof file's law x and its def x are one item, and every use no binder holds is looked for in this list

def ctors source · line 146 · raw

@body:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/tree.Node -> @acc:List<&2, String> -> List<&2, String>

a type's constructors: the first name of each line under it

def items source · line 154 · raw

@root:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/tree.Node -> @acc:List<&2, String> -> List<&2, String>

the defs, laws, types and constructors of a source

def last_text source · line 168 · raw

@kids:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/tree.Node -> String

the text of a chain's last leaf

def aliases source · line 178 · raw

@root:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/tree.Node -> @+acc:List<&2, String> -> List<&2, String>

the import aliases of a source: the last token of each import .. as X

def find.go source · line 193 · raw

@env:List<&2, Bind> -> @+name:String -> @hit:Maybe<&2, Bind> -> Maybe<&2, Bind>

the innermost binder of a name in an environment; hit: the binder before env was the name, so the search stops there

def find source · line 205 · raw

@env:List<&2, Bind> -> @+name:String -> Maybe<&2, Bind>

the innermost binder of a name in an environment

def head_of.go source · line 208 · raw

@cs:List<&2, Char> -> List<&2, Char>

def head_of source · line 216 · raw

@cs:List<&2, Char> -> String

a dotted name's part before the first dot

def rest_of source · line 220 · raw

@cs:List<&2, Char> -> String

a dotted name's part after the first dot

def has source · line 228 · raw

@names:List<&2, String> -> @+name:String -> Bool

is the name among these?

def same source · line 233 · raw

@a:String -> @b:String -> Bool

two names alike, char by char, stopping at the first that differs: String.eq, without the pairs String.cmp builds on every step

def has_item source · line 246 · raw

@names:List<&2, String> -> @+name:String -> Bool

is the name among the file's items? has, stopping at the first hit, as every use no binder holds asks it of every item

def index.depth source · line 266 · raw

Nat

how many bits of a name's number the index branches on

def key.go source · line 270 · raw

@name:String -> @+acc:U32 -> U32

a name's number: its chars folded, each onto 31 times the number so far

def key source · line 278 · raw

@name:String -> U32

a name's number

def index.names source · line 282 · raw

@ix:Index -> List<&2, String>

the names at a leaf, none elsewhere

def index.pick source · line 292 · raw

@b:Bool -> @lo:Index -> @hi:Index -> Index

the low half for a set bit, the high half else

def index.near source · line 300 · raw

@b:Bool -> @ix:Index -> Index

the half of a node a bit goes down, empty elsewhere

def index.join source · line 308 · raw

@b:Bool -> @sub:Index -> @far:Index -> Index

a node whose half down a bit is sub, and the other half far

def index.put source · line 316 · raw

@d:Nat -> @+k:U32 -> @+ix:Index -> @name:String -> Index

the index with one more name, down the low bits of its number

def index.has source · line 325 · raw

@d:Nat -> @+k:U32 -> @ix:Index -> @+name:String -> Bool

is the name at the end of its number's way down the index?

def index source · line 333 · raw

@names:List<&2, String> -> Index

the index of these names

def indexed source · line 341 · raw

@ix:Index -> @+name:String -> Bool

is the name among the names the index was built from?

def names_of source · line 350 · raw

@+its:List<&2, String> -> @als:List<&2, String> -> Names

the names of a file from its items and aliases

def resolve.local source · line 353 · raw

@m:Maybe<&2, Bind> -> @+name:String -> @ns:Names -> Target

def resolve source · line 366 · raw

@env:List<&2, Bind> -> @+name:String -> @ns:Names -> Target

what a name at a point refers to, given what is in scope

def spaced source · line 401 · raw

@+t:String -> String

a declaration as written: +x: List<&2, U32>, ~f: U32 -> U32. A space follows : and ,, spaces surround ->, everything else is glued

def render_close source · line 406 · raw

@close:Maybe<&2, 0xf70fc6a217b89edfba89174d2aa39455/src/syntax/lex.Tok> -> String

a group's close bracket, "" when it never closed

def render_all source · line 414 · raw

@n:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/tree.Node -> String

the text of a whole chain

def render source · line 424 · raw

@n:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/tree.Node -> String

the text of a chain up to its first comma

def use source · line 436 · raw

@+name:String -> @line:U32 -> @col:U32 -> @+env:List<&2, Bind> -> @ns:Names -> @out:Out -> W

a use of a name, resolved against the environment

def mark source · line 441 · raw

@line:U32 -> @+env:List<&2, Bind> -> @out:Out -> Out

the names in scope at a statement's line, recorded

def tele_kind source · line 447 · raw

@+o:String -> BindKind

what the names of a telescope bind as, by its bracket: ( parameters, < type parameters, { fields

def env_of source · line 452 · raw

@w:W -> List<&2, Bind>

a result's environment

def out_of source · line 457 · raw

@w:W -> Out

a result's output

def plan.lam source · line 473 · raw

@rest:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/tree.Node -> Bool

does the chain start with a leaf of this kind?

def plan.group source · line 481 · raw

@rest:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/tree.Node -> Bool

does the chain start with a group?

def plan.named source · line 489 · raw

@rest:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/tree.Node -> Bool

does the chain start with a name (lower or upper case)?

def plan.typed source · line 500 · raw

@rest:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/tree.Node -> @upper:Bool -> Bool

does the chain start with a name and a :? An upper-case name counts when upper says so

def plan.rewrites source · line 513 · raw

@rest:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/tree.Node -> Bool

does the chain start with a name and an @: the h@ of a named rewrite, %h@e : P, where h names the equation inside P and e proves it?

def plan.peek source · line 522 · raw

@rest:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/tree.Node -> 0xf70fc6a217b89edfba89174d2aa39455/src/syntax/lex.Tok

the chain's first token; a blank one when it does not start with a leaf

def plan.tail source · line 530 · raw

@rest:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/tree.Node -> 0xf70fc6a217b89edfba89174d2aa39455/src/syntax/tree.Node

the chain after its first node

def plan.skip source · line 538 · raw

@mode:Mode -> Mode

the mode the rest is read in after a head that means nothing in this mode

def plan.lmode source · line 568 · raw

@mode:Mode -> @k:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/lex.TokKind -> @+rest:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/tree.Node -> Mode

the mode the rest is read in after a leaf of kind k

def plan.after.term source · line 604 · raw

@k:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/lex.TokKind -> @+t:String -> @+rest:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/tree.Node -> Mode

the mode the rest of a term is read in after a leaf of kind k saying t: a % with a name and an @ behind it starts a named rewrite (%h@e : P), and its name and @ are stepped over; any other leaf is read by its kind

def plan.after source · line 613 · raw

@mode:Mode -> @k:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/lex.TokKind -> @+t:String -> @+rest:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/tree.Node -> Mode

the mode the rest is read in after a leaf of kind k saying t: by its kind (plan.lmode), but for the % of a named rewrite in a term

def plan.rec source · line 621 · raw

@mode:Mode -> @k:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/lex.TokKind -> @+rest:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/tree.Node -> Bool

does a leaf of kind k record a binder?

def plan.push source · line 654 · raw

@mode:Mode -> @k:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/lex.TokKind -> @rest:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/tree.Node -> Bool

does the binder a leaf records go into the environment too? All do but an item's name and a constructor's, which the file's items hold

def plan.use source · line 664 · raw

@mode:Mode -> @k:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/lex.TokKind -> @+rest:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/tree.Node -> Bool

does a leaf of kind k use a name?

def plan.keep source · line 693 · raw

@mode:Mode -> @k:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/lex.TokKind -> Bool

is a leaf of kind k the = or <- of a let, whose right side sees the names outside the let?

def plan.outer source · line 707 · raw

@mode:Mode -> List<&2, Bind>

the environment outside a let's left side

def plan.ahead source · line 717 · raw

@tok:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/lex.Tok -> @kind:BindKind -> @+note:String -> Bind

a binder at the next token, with the note its kind shows

def plan.ahead_name source · line 723 · raw

@tok:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/lex.Tok -> String

the name of the next token, "" when there is none

def plan.binder source · line 730 · raw

@mode:Mode -> @k:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/lex.TokKind -> @+t:String -> @l:U32 -> @c:U32 -> @+rest:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/tree.Node -> Bind

the binder a leaf records: its own name, or for op name, @x: and &x: the name after it. A telescope's binder notes its declaration

def plan.pushed source · line 752 · raw

@push:Bool -> @+b:Bind -> @env:List<&2, Bind> -> List<&2, Bind>

a binder onto the environment, when there is one

def plan.recorded source · line 760 · raw

@rec:Bool -> @+b:Bind -> @out:Out -> Out

a binder onto the output, when there is one

def plan.used source · line 769 · raw

@usd:Bool -> @+name:String -> @line:U32 -> @col:U32 -> @env:List<&2, Bind> -> @ns:Names -> @out:Out -> Out

a use onto the output, when there is one

def plan.enter source · line 778 · raw

@keep:Bool -> @outer:List<&2, Bind> -> @push:Bool -> @+b:Bind -> @env:List<&2, Bind> -> List<&2, Bind>

the environment the rest is read with after a leaf: the one outside a let's left side at its =, else this one with the leaf's binder on it

def plan.ginner source · line 792 · raw

@mode:Mode -> @+gt:String -> Mode

the mode a group's insides are read in; MStop when they mean nothing here

def plan.gnext source · line 808 · raw

@mode:Mode -> Mode

the mode the rest is read in after a group

def plan.gkeeps source · line 819 · raw

@mode:Mode -> Bool

do the names a group binds stay bound after it? A signature's parameters and a pattern's binders do

def plan.kmode source · line 829 · raw

@mode:Mode -> @sk:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/tree.StmtKind -> @+env:List<&2, Bind> -> Mode

the mode a statement's header is read in

def plan.bmode source · line 853 · raw

@mode:Mode -> @sk:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/tree.StmtKind -> Mode

the mode a statement's body is read in

def plan.mark_head source · line 865 · raw

@mode:Mode -> @sk:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/tree.StmtKind -> Bool

is the scope recorded before a statement's header?

def plan.mark_body source · line 881 · raw

@mode:Mode -> @sk:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/tree.StmtKind -> Bool

is the scope recorded between a statement's header and its body? A def's is

def plan.marked source · line 889 · raw

@yes:Bool -> @line:U32 -> @+env:List<&2, Bind> -> @out:Out -> Out

the scope recorded onto the output, when it is

def plan.scoped source · line 898 · raw

@mode:Mode -> @sk:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/tree.StmtKind -> Bool

does a statement close its scope for the statements after it? All but a let and a for in a block do

def plan.snext source · line 908 · raw

@mode:Mode -> Mode

the mode the statements after a statement are read in

def plan.last source · line 929 · raw

@kids:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/tree.Node -> 0xf70fc6a217b89edfba89174d2aa39455/src/syntax/lex.TokKind

the kind of a chain's last node when it is a leaf; a space's for a chain that ends in a group or holds nothing

def plan.wraps.by source · line 941 · raw

@k:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/lex.TokKind -> Under

what a let's last token says of the lines under it

def plan.wraps.let source · line 953 · raw

@kids:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/tree.Node -> @body:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/tree.Node -> Under

what the lines under a let are to it: with none under it, nothing is asked

def plan.wraps source · line 962 · raw

@mode:Mode -> @sk:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/tree.StmtKind -> @kids:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/tree.Node -> @body:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/tree.Node -> Under

what the lines under a statement are to it: only a let in a block has a value or a lambda's body there

def plan.under source · line 975 · raw

@u:Under -> @outer:List<&2, Bind> -> @after:List<&2, Bind> -> @inner:(@_:Unit -> List<&2, Bind>) -> List<&2, Bind>

the environment the lines under a statement are read with. The next statements see what the header left (a let's names included). A let's value sees the names outside the let, as its right side does on one line (st = then step(st) reads the old st). A lambda's body sees those and the lambda's parameters: what the let's own line leaves when it is read as a term (inner)

def walk source · line 993 · raw

@n:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/tree.Node -> @+mode:Mode -> @+env:List<&2, Bind> -> @+ns:Names -> @out:Out -> W

the walk: one node in one mode, against an environment. It takes the node apart as far as its head, and the plan above says what the head does in this mode. Every recursive call is on a subtree (kids, body, gkids or rest), never on n itself

def lstrip source · line 1025 · raw

@cs:List<&2, Char> -> List<&2, Char>

leading spaces dropped

def stripped source · line 1033 · raw

@+text:String -> String

a line's text without its indentation

def note_for source · line 1038 · raw

@kind:BindKind -> @+note:String -> @text:(@_:Unit -> String) -> String

a declaration carries its own note; anything else shows the line that bound it, which text gives only when it is asked for

def annotate.ahead source · line 1051 · raw

@+line:U32 -> @+at:U32 -> @cur:List<&2, String> -> List<&2, String>

the lines from line line on, given the lines from line at on: a step forward from where the last binder was, not a walk from the first line

def annotate.head source · line 1055 · raw

@+cur:List<&2, String> -> String

the first line of these, or ""

def annotate.back source · line 1059 · raw

@lines:List<&2, String> -> @+line:U32 -> String

a line read from the first, for a binder behind the last one

def annotate.go source · line 1066 · raw

@binds:List<&2, Bind> -> @+lines:List<&2, String> -> @+at:U32 -> @+cur:List<&2, String> -> List<&2, Bind>

every binder with its note filled. Binders come in source order, so the lines are read once, front to back, from where the last binder was (cur holds the lines from line at on); a binder behind that point reads its line from the start

def annotate source · line 1078 · raw

@binds:List<&2, Bind> -> @+lines:List<&2, String> -> List<&2, Bind>

every binder with its note filled

def finish source · line 1085 · raw

@o:Out -> @lines:List<&2, String> -> Bound

the gathered output, in source order and annotated

def of_tree source · line 1090 · raw

@+root:0xf70fc6a217b89edfba89174d2aa39455/src/syntax/tree.Node -> @lines:List<&2, String> -> Bound

the binding structure of a parsed source

def bound source · line 1094 · raw

@+source:String -> Bound

the binding structure of a source

def covers source · line 1106 · raw

@+l2:U32 -> @+c2:U32 -> @+name:String -> @+line:U32 -> @+col:U32 -> Bool

does the name at (l, c) cover the position (line, col)?

def bind_at.go source · line 1112 · raw

@binds:List<&2, Bind> -> @+line:U32 -> @+col:U32 -> @hit:Maybe<&2, Site> -> Maybe<&2, Site>

the binder whose name covers a position; hit: the one before binds did, so the search stops there

def bind_at source · line 1126 · raw

@binds:List<&2, Bind> -> @+line:U32 -> @+col:U32 -> Maybe<&2, Site>

the binder whose name covers a position

def use_at.go source · line 1131 · raw

@uses:List<&2, Use> -> @+line:U32 -> @+col:U32 -> @hit:Maybe<&2, Site> -> Maybe<&2, Site>

the use whose name covers a position; hit: the one before uses did, so the search stops there

def use_at source · line 1144 · raw

@uses:List<&2, Use> -> @+line:U32 -> @+col:U32 -> Maybe<&2, Site>

the use whose name covers a position

def at.or source · line 1147 · raw

@m:Maybe<&2, Site> -> @uses:List<&2, Use> -> @line:U32 -> @col:U32 -> Maybe<&2, Site>

def at source · line 1155 · raw

@b:Bound -> @+line:U32 -> @+col:U32 -> Maybe<&2, Site>

the site at a position

def binder.go source · line 1161 · raw

@binds:List<&2, Bind> -> @+line:U32 -> @+col:U32 -> @hit:Maybe<&2, Bind> -> Maybe<&2, Bind>

the binder at a position (a use's target, or the binder itself); hit: the one before binds was, so the search stops there

def binder source · line 1174 · raw

@binds:List<&2, Bind> -> @+line:U32 -> @+col:U32 -> Maybe<&2, Bind>

the binder at a position (a use's target, or the binder itself)

def visible.go source · line 1179 · raw

@scopes:List<&2, Scope> -> @+qline:U32 -> @best:List<&2, Bind> -> List<&2, Bind>

the names in scope at a line: those of the statement on it, else of the nearest statement above

def noted source · line 1188 · raw

@m:Maybe<&2, Bind> -> @b:Bind -> Bind

the scopes hold binders before their notes were filled: read each back

def before source · line 1196 · raw

@+l1:U32 -> @+c1:U32 -> @+l2:U32 -> @+c2:U32 -> Bool

does (l1, c1) come before (l2, c2) in the source?

def seek.stop source · line 1200 · raw

@cur:List<&2, Bind> -> @+line:U32 -> @+col:U32 -> Bool

does a cursor's head sit at or after a position (the seek stops there)?

def seek source · line 1210 · raw

@binds:List<&2, Bind> -> @+line:U32 -> @+col:U32 -> @+stop:Bool -> List<&2, Bind>

the binders from the first one not before a position on; the binders are in source order, so none this drops sits at the position. stop is seek.stop of binds, carried so the step stays a loop

def seek.head source · line 1222 · raw

@cur:List<&2, Bind> -> @+line:U32 -> @+col:U32 -> Maybe<&2, Bind>

the binder at the head of a cursor, when it sits at the position

def refresh.go source · line 1236 · raw

@env:List<&2, Bind> -> @+binds:List<&2, Bind> -> @+cur:List<&2, Bind> -> @+tl:U32 -> @+tc:U32 -> @acc:List<&2, Bind> -> List<&2, Bind>

each binder of an environment, outermost first, with the note its annotated twin carries, pushed onto acc (so acc ends innermost first again). cur is a cursor into binds that drops only binders before (tl, tc), the last one read: an environment's binders were pushed in source order, so each lookup picks up where the last stopped and binds is read once, not once per binder. A binder before the last one read starts the cursor over

def refresh source · line 1253 · raw

@env:List<&2, Bind> -> @+binds:List<&2, Bind> -> List<&2, Bind>

each binder of an environment, with the note its annotated twin carries

def visible source · line 1258 · raw

@b:Bound -> @qline:U32 -> List<&2, Bind>

the names in scope at a line: those of the statement on it, else of the nearest statement above

def sites.go source · line 1263 · raw

@uses:List<&2, Use> -> @+line:U32 -> @+col:U32 -> List<&2, Pos>

every position a binder is named at: its own, then its uses'

def sites source · line 1274 · raw

@b:Bound -> @+line:U32 -> @+col:U32 -> List<&2, Pos>

every position a binder is named at: its own, then its uses'

def item_sites.binds source · line 1280 · raw

@binds:List<&2, Bind> -> @+name:String -> List<&2, Pos>

every position an item of the file is named at: its declaration, then its uses

def item_sites.uses source · line 1293 · raw

@uses:List<&2, Use> -> @+name:String -> List<&2, Pos>

def item_sites source · line 1305 · raw

@b:Bound -> @+name:String -> List<&2, Pos>

every position an item of the file is named at: its declaration, then its uses

def named_sites.go source · line 1311 · raw

@uses:List<&2, Use> -> @+name:String -> List<&2, Pos>

every position a name not of this file is used at (Base, or through an alias)

def named_sites source · line 1323 · raw

@b:Bound -> @+name:String -> List<&2, Pos>

every position a name not of this file is used at (Base, or through an alias)