Documentation
¶
Overview ¶
Package stmtlookup reads which statements a script's call can run when the source says so (#2615, #2623): a lookup into literals (spec[3], where spec is one value of a dict of constant lists) is each value it can pick, and a statements argument built as a list, a list comprehension or a name bound to either is the statements it holds. The flow diagram and an application's diagram read what a call writes through it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Candidates ¶
Candidates is every expression e can evaluate to, when the source says so (#2623): a lookup into a literal -- {...}[k], [...][i], or a name bound to one and then indexed, as spec[3] where spec = {...}[kind] -- is each value the lookup can return, the value a constant key names or every value when the key is computed. Anything that is not a lookup is itself. ok is false when a lookup's container is not a literal the source holds, a constant key names nothing in it, or there are more than maxCandidates.
func ListsBound ¶
ListsBound is each list literal and list comprehension a function body assigns to a plain name, by the name.
func Statements ¶
Statements is what a statements argument holds, when the source says: a list literal's elements, a list comprehension's element (one statement repeated per row, #2623), or what a name is bound to in the function the call is written in (bound) or else in sc. ok is false when the statements are assembled at run time.
Types ¶
type Resolver ¶
type Resolver interface {
// Bound is the expression a name was last assigned, nil for none.
Bound(id *syntax.Ident) syntax.Expr
// Known is a local's value when the analyzer knows it.
Known(id *syntax.Ident) (string, bool)
}
Resolver reads the names a lookup is followed through, in the scope a call was written in.