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

19 lines
377 B
Plaintext
Raw Normal View History

2013-12-20 07:05:31 -08:00
class Foo {
construct 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
}
}
2015-07-10 09:18:22 -07:00
var a = Foo.new("a")
var b = Foo.new("b")
var c = Foo.new("c")
2013-12-20 07:05:31 -08:00
// Assignment is right-associative.
a.bar = b.bar = c.bar = "d"
2015-09-15 07:46:09 -07:00
System.print(a.toString) // expect: d
System.print(b.toString) // expect: d
System.print(c.toString) // expect: d