Fix closures in methods.

A local name inside a method should always resolve to a self send even
if there is a local variable with that name outside of the method.
This commit is contained in:
Bob Nystrom
2015-10-05 07:44:51 -07:00
parent e968b4bf98
commit 24cbb7f399
4 changed files with 29 additions and 33 deletions
@@ -1,17 +0,0 @@
// TODO: Is this right? Shouldn't it resolve to this.local?
var foo = null
{
var local = "local"
class Foo {
construct new() {}
method {
System.print(local)
}
}
foo = Foo.new()
}
foo.method // expect: local
@@ -1,13 +0,0 @@
// TODO: Is this right? Shouldn't it resolve to this.local?
{
var local = "local"
class Foo {
construct new() {}
method {
System.print(local)
}
}
Foo.new().method // expect: local
}