Files
wren/test/language/setter/associativity.wren
T

19 lines
355 B
Plaintext
Raw Normal View History

2013-12-20 07:05:31 -08:00
class Foo {
new(value) { _value = value }
2014-04-03 07:48:19 -07:00
toString { _value }
bar=(value) {
2013-12-20 07:05:31 -08:00
_value = value
return value
}
}
var a = new Foo("a")
var b = new Foo("b")
var c = new Foo("c")
// Assignment is right-associative.
a.bar = b.bar = c.bar = "d"
2014-01-05 12:27:12 -08:00
IO.print(a.toString) // expect: d
IO.print(b.toString) // expect: d
IO.print(c.toString) // expect: d