-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
starlark: add debug API for Locals and FreeVars
This change adds the following new API to allow debugging tools and built-in functions access to the internals of Function values and call frames: package starlark type Binding struct { Name string Pos syntax.Position } func (fr *frame) NumLocals() int func (fr *frame) Local(i int) (Binding, Value) type DebugFrame interface { ... NumLocals() int Local(i int) (Binding, Value) } func (fn *Function) NumFreeVars() int func (fn *Function) FreeVar(i int) (Binding, Value) This is strictly a breaking change, but the changed functions (the Local methods) were previously documented as experimental. The fix is straightforward. Also, a test of DebugFrame to write an 'env' function in a similar vein to Python's 'dir' function. Fixes #538
- Loading branch information
Showing
6 changed files
with
101 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters