Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Builtin: push a Frame on the Thread's stack even when calling Builtins #112

Merged
merged 2 commits into from
Jul 2, 2018

Conversation

alandonovan
Copy link
Contributor

This makes the stack trace more accurate.

Breaking API change: (*Frame).Function is superseded by (*Frame).Callable.

This makes the stack trace more accurate.

Breaking API change: (*Frame).Function is superseded by (*Frame).Callable.
@alandonovan alandonovan self-assigned this Jul 2, 2018
@alandonovan alandonovan requested a review from jayconrod July 2, 2018 13:56
@alandonovan alandonovan removed their assignment Jul 2, 2018
}

// Function returns the frame's function, or nil for the top-level of a module.
func (fr *Frame) Function() *Function { return fr.fn }
var builtinFilename = "<builtin>"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: const instead of var?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It must be a variable as we needs its address on line 131. (The reason the variable is global, not local to that function, is to avoid allocating it more than once.)

eval_test.go Outdated
@@ -167,7 +167,8 @@ func load(thread *skylark.Thread, module string) (skylark.StringDict, error) {
}

// TODO(adonovan): test load() using this execution path.
filename := filepath.Join(filepath.Dir(thread.Caller().Position().Filename()), module)
filename := filepath.Join(filepath.Dir(thread.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like an odd place to break the line. Was it too long before? Extracting the directory into a variable might be slightly better.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This newline was introduced by mistake; removed.

.
Change-Id: I66a24da6ba54f1070151c4f207e0a0bb7e6dc9b6
@alandonovan alandonovan merged commit cc7dbc2 into master Jul 2, 2018
@alandonovan alandonovan deleted the frame branch October 12, 2018 19:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants