Get static methods fully working.
They are compiled as local variables defined in an implicit scope surrounding the class. This has the right semantics and, better, means that there's no VM support needed for them. They're purely syntax sugar.
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
class Foo {
|
||||
static initialize { __field = "Foo field" }
|
||||
|
||||
static closeOverGet {
|
||||
return fn { return __field }
|
||||
}
|
||||
|
||||
static closeOverSet {
|
||||
return fn { __field = "new value" }
|
||||
}
|
||||
}
|
||||
|
||||
Foo.initialize
|
||||
IO.print(Foo.closeOverGet.call) // expect: Foo field
|
||||
Foo.closeOverSet.call
|
||||
IO.print(Foo.closeOverGet.call) // expect: new value
|
||||
Reference in New Issue
Block a user