aboutsummaryrefslogtreecommitdiff
path: root/starlarktest
AgeCommit message (Collapse)Author
2020-07-06starlarktest: fix typo in comment (#288)alandonovan
Fixes #285
2019-11-13Adding support for Bazel test to use DataFile (#251)Brandon Bercovich
2019-05-28starlark: add a fail function (#210)alandonovan
Updates bazelbuild/starlark#47
2019-04-19starlark: new CallStack API (and Frame deprecation) (#192)alandonovan
Prior to this CL, the interpreter stack was implemented as a "spaghetti stack", a linked tree of Frames. This meant that EvalError (for example) could make a copy of the stack just by retaining a *Frame reference at its moment of creation, but this forced every Starlark call to allocate a new Frame. Also, in non-error cases (e.g. application built-ins that retain the call stack), the retained references (linked lists of frames) were pointers to Frames that were actively mutated by ongoing execution. This change separates the internal and external data types for Frames. Internal frames (type Frame) are still, for now, linked trees, but the Frame type is deprecated and will soon be made private. It may still be accessed through an interface, DebugFrame, for the very few clients that need debugger-like powers of reflection. DebugFrames must not be retained. The external type for frames (as used by EvalError) is CallFrame, a simple pair struct of name and position fields, a value type. It does not reveal the Callable, as that would pin functions in memory. And it does not lazily compute Position, as that would depend on Frame.pc, which changes as execution continues. A slice of CallFrame is represented by CallStack, and it has various convenience methods. Follow-up changes in two weeks will implement remove Frame and other deprecated declarations, and implement two optimizations: Frame recycling, by inline slice preallocation in the Thread, and Frame.locals []Value recycling, by inline slice preallocation in the Frame. New API: + type CallFrame -- a simple Name/Pos pair + type CallStack -- a list of CallFrame + type DebugFrame -- interface for (soon to be hidden) Frame + func (*Thread).CallStack + func (*Thread).CallStackDepth + func (*Thread).CallFrame + EvalError.CallStack field (NB: direction reversed from old Stack method) Deprecations (will be removed in 2 weeks): - Frame -- use CallFrame, or DebugFrame if you really must - func (*EvalError).Stack -- use CallStack - func NewFrame -- clients have no business here - func (*Frame).Parent -- use slice operations on CallStack - EvalError.Frame field -- use CallStack - Frame.WriteBacktrace -- use CallStack.Backtrace(); don't start with Frame
2019-03-01all: use strings.Builder (#163)Josh Bleecher Snyder
Fixes #95
2019-01-04starlarkstruct: add 'module' type, and use it for assert module (#91)alandonovan
...instead of struct, which is more suited to dynamic values. This type will be used for Stargo (see wip-stargo branch). For example, this load statement load("go", http="net/http", json="encoding/json") would load two modules.
2018-11-01add docs/PKG/index.html redirects and import commentsAlan Donovan
2018-10-31rename packages under go.starlark.netAlan Donovan
2018-10-23rename skylark -> starlarkAlan Donovan
Change-Id: Iebd0e040ff674b2f9da39bf5242c8afaa7f4ddc8