mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-16 20:28:04 +01:00
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.
11 lines
260 B
Plaintext
11 lines
260 B
Plaintext
class Foo {
|
|
bar { return this }
|
|
baz { return "baz" }
|
|
}
|
|
|
|
IO.print((new Foo).bar.baz) // expect: baz
|
|
|
|
// TODO: Test that "this" is the class when in a static method.
|
|
// (Or disallow "this" in statics? It's useful since statics are
|
|
// inherited.)
|