Retoor software development Projects Research SearchXNG
Register Sign In

23 lines
364 B
Plaintext
Raw Normal View History

feat: implement closure over "this" in methods and fix upvalue closing order Add support for closing over "this" in function closures defined inside methods by naming the receiver local variable "this" in method compilers. Fix upvalue closing to copy the actual value instead of the stack top, and reorder return handling to close upvalues before storing the result. Add test cases for closure over "this", nested closures, and nested classes.
2013-12-22 00:55:08 +01:00
class Outer {
method {
io.write(this.toString) // expect: Outer
fn {
io.write(this.toString) // expect: Outer
class Inner {
method {
io.write(this.toString) // expect: Inner
}
toString { return "Inner" }
}
(new Inner).method
}.call
}
toString { return "Outer" }
}
(new Outer).method
Reference in New Issue Copy Permalink
1a77a43fa0
wren/test/this/nested_class.wren
Response time: 27ms
Mail Licenses API