Fixes #109. Fix closure handling in various corner cases. #132
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Invocation
was incorrectly determining the value ofself
to use when calling a function. Before #131, it was only checking if the Call had a receiver, and would use that value if it did. After #131, if the Call did not have a receiver, it would then check if the functor was a closure, and use the closed value ofself
if it was.Now, Invocations always perform both checks, with closures taking higher precedence than Call receivers (though, both will be pushed to the stack if the conditions are met).
Before this PR, I was very confused why static methods weren't working while non-static methods were. I assumed it was an issue with
scope
vsinstance_scope
on Types or something like that, but had no idea.Now, though, I'm even more confused how any case was working previously, as the Call receiver was always being pushed as the value of
self
. At least with this version of the code, the value ofself
that will be present is more explicit and well-specified. ¯_(ツ)_/¯This PR also required making some changes to the Spec library to deal with the changes in semantics of what
self
will be within various Calls.