Documentation ¶
Index ¶
- Variables
- func Case(c *Context, s *Scope, line int) interface{}
- func Comm(c *Context, s *Scope, line int) chan struct{}
- func Defer(c *Context, s *Scope, line int)
- func ElseIfExpr(c *Context, s *Scope, line int)
- func ElseIfSimpleStmt(c *Context, s *Scope, line int)
- func EndSelect(c *Context, s *Scope) chan struct{}
- func EnterFuncWithRecovers(r chan chan interface{}, fn func(*Context)) (<-chan chan interface{}, chan interface{})
- func ExitFunc(ctx *Context)
- func Line(c *Context, s *Scope, line int)
- func Select(c *Context, s *Scope, line int)
- func SetTrace()
- func SetTraceGen(ctx *Context)
- type Context
- type Scope
- func (s *Scope) AddConst(ident string, c reflect.Value)
- func (s *Scope) AddFunc(ident string, f reflect.Value)
- func (s *Scope) AddPkg(pkg string, p eval.Env)
- func (s *Scope) AddType(ident string, t reflect.Type)
- func (s *Scope) AddVar(ident string, v reflect.Value)
- func (s *Scope) Const(ident string) reflect.Value
- func (s *Scope) Constant(namevalue ...interface{})
- func (s *Scope) Declare(namevalue ...interface{})
- func (s *Scope) EnteringNewChildScope() *Scope
- func (s *Scope) Func(ident string) reflect.Value
- func (s *Scope) Pkg(pkg string) eval.Env
- func (s *Scope) PopScope() eval.Env
- func (s *Scope) PushScope() eval.Env
- func (s *Scope) Type(ident string) reflect.Type
- func (s *Scope) Var(ident string) reflect.Value
Constants ¶
This section is empty.
Variables ¶
var Go = gls.Go
Functions ¶
func Case ¶
Case marks a case clause. Intended to be inserted as its own case clause immediately prior to the case clause it is marking.
func Comm ¶
Comm marks a case in a select statement. It returns a nil channel to read from as a new case immediately before the case it is marking.
func Defer ¶
Defer marks a defer statement. Intended to be run in a defer statement of its own after the corresponding defer in the original source.
func ElseIfExpr ¶
ElseIfExpr marks an "else if" expression.
func ElseIfSimpleStmt ¶
ElseIfSimpleStmt marks a simple statement preceding an "else if" expression.
func EndSelect ¶
EndSelect marks the end of a select statement. It returns a nil channel to read from as the last case of that select statement.
func EnterFuncWithRecovers ¶
func EnterFuncWithRecovers(r chan chan interface{}, fn func(*Context)) (<-chan chan interface{}, chan interface{})
EnterFuncWithRecovers is a special wrapper for functions that call recover(). recover only works if it is called directly by a deferred function. It does not work if a deferred function calls a function that in turn calls another function that calls recover. But EnterFunc and EnterFuncLit depend on being able to wrap their functions and call them farther down in the stack.
The solution is to create a new goroutine, use EnterFuncLit as normal in the new goroutine, and have the code generator replace calls to recover with channel communications. Then in the original function frame, we call recover when asked to and pass its value into the new goroutine over a channel.
EnterFuncWithRecovers takes care of maintaining goroutine-local-storage in the new goroutine, as well as propagating any panic from that goroutine to the original goroutine.
func SetTraceGen ¶
func SetTraceGen(ctx *Context)
SetTraceGen is the generated entrypoint to the debugger.
Types ¶
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context contains debugging context information.
func EnterFunc ¶
EnterFunc marks the beginning of a function. Calling fn should be equivalent to running the function that is being entered. If proceed is false, EnterFunc did in fact call fn, and so the caller of EnterFunc should return immediately rather than proceed to duplicate the effects of fn.
func EnterFuncLit ¶
EnterFuncLit is like EnterFunc, but intended for function literals. The passed callback takes a *Context rather than no input.
type Scope ¶
type Scope struct {
Vars, Consts, Funcs map[string]interface{}
// contains filtered or unexported fields
}
Scope represents a lexical scope for variable bindings.
func EnteringNewFile ¶
EnteringNewFile returns a new Scope and internally sets the current scope to be the returned scope.
func (*Scope) Constant ¶
func (s *Scope) Constant(namevalue ...interface{})
Constant is like Declare, but for constants. The values must be passed directly.
func (*Scope) Declare ¶
func (s *Scope) Declare(namevalue ...interface{})
Declare creates new variable bindings in s from a list of name, value pairs. The values should be pointers to the values in the program rather than copies of them so that s can track changes to them.
func (*Scope) EnteringNewChildScope ¶
EnteringNewChildScope returns a new Scope that is the child of s and internally sets the current scope to be the returned scope.