Files
wren/test/field/use_before_set.wren
T

10 lines
233 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.
}
var foo = new Foo
2013-11-23 14:55:05 -08:00
// But invoke them in the right order.
foo.init
foo.write // expect: value