Documentation
¶
Overview ¶
Package scriptdefs reads what a script defines and what the platform calls in it, from its syntax alone: every def by a key that tells two nested defs of one name apart, the def a name refers to where it is written (#2848), and the calls the platform makes after the module runs. The script flow graph reads a script through it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EntryCalls ¶
EntryCalls are the calls the platform makes after the module runs: main() for a run; in a script with no main(), handle(req) for an endpoint's request (#2172, #2315), or a form's form_spec(req) then form_submit(req, values), in the order a person meets them (#2176). None when it makes none.
Types ¶
type Table ¶
type Table struct {
// Funcs is every def by its key, and KeyOf each def's key.
Funcs map[string]*syntax.DefStmt
KeyOf map[*syntax.DefStmt]string
// ParentOf is the key of the function a nested def is written in, by the
// nested def's key.
ParentOf map[string]string
}
Table is every def of a script by its key: a module-level def by its name, a nested one by the key of the function it is written in, a dot and its name. Two nested defs of one name in two functions are two functions, which a table keyed by the bare name made one: the last in the file (#2848).
func (*Table) Resolve ¶
Resolve is the def a name written in the function of key scope ("" at module level) refers to, and its key: a def nested in that function, then in each function enclosing it, then a module-level def, as Starlark resolves a name. A def nested in another function is not visible outside it. It is nil, with an empty key, for a name no def holds there.