aboutsummaryrefslogtreecommitdiff
path: root/repl
diff options
context:
space:
mode:
authoralandonovan <adonovan@google.com>2018-12-17 13:10:16 -0500
committerGitHub <noreply@github.com>2018-12-17 13:10:16 -0500
commit2c1f36271ed69e06b0a35e68778357ecbc64a33c (patch)
tree75dfc31f526dc1856ff1c65dd1957189d7f46408 /repl
parent990a796dead3c6a69960dba6f11de43a4cf62d15 (diff)
downloadstarlark-go-2c1f36271ed69e06b0a35e68778357ecbc64a33c.tar.gz
starlark: API additions for improved debugging (#76)
This change adds a number of small features to improve debugging. The actual debugger API will come in a later change. - Thread.Name : an optional string field that describes the purpose of the thread, for use in debugging. - (*Program).Filename: a method that reports the file of the program. Also, a String method that returns the same thing. Also, a test that it reports the correct location even for an empty file (a special case of the previous implementation). - (*Frame).Local(i int): a method to return the value of a local variable of an active frame, such as one might use in debugger's stack trace. - ExprFunc: creates a starlark.Function from a given expression, such as one might use in a debugger REPL.
Diffstat (limited to 'repl')
-rw-r--r--repl/repl.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/repl/repl.go b/repl/repl.go
index feccbe4..f90313e 100644
--- a/repl/repl.go
+++ b/repl/repl.go
@@ -215,7 +215,7 @@ func MakeLoad() func(thread *starlark.Thread, module string) (starlark.StringDic
cache[module] = nil
// Load it.
- thread := &starlark.Thread{Load: thread.Load}
+ thread := &starlark.Thread{Name: "exec " + module, Load: thread.Load}
globals, err := starlark.ExecFile(thread, module, nil, nil)
e = &entry{globals, err}