Files
wren/test/language/field/use_before_set.wren
T

10 lines
235 B
Plaintext
Raw Normal View History

2013-11-23 14:55:05 -08:00
class Foo {
2014-01-05 12:27:12 -08:00
write { IO.print(_field) } // Compile a use of the field...
2013-11-23 14:55:05 -08:00
init { _field = "value" } // ...before an assignment to it.
}
2015-07-10 09:18:22 -07:00
var foo = Foo.new()
2013-11-23 14:55:05 -08:00
// But invoke them in the right order.
foo.init
foo.write // expect: value