Retoor software development Projects Research SearchXNG
Register Sign In

19 lines
362 B
Plaintext
Raw Normal View History

feat: implement setter syntax and assignment in named method calls Add support for setter methods in the compiler by detecting '=' after a method name in namedCall, compiling the assigned value, and emitting the setter instruction. Includes new test cases for instance setters, static setters, assignment associativity, grouping, operator precedence errors, setter result values, and same-name getter/setter methods. Also updates the super call test with a TODO for super setter calls.
2013-12-20 16:05:31 +01:00
class Foo {
new(value) { _value = value }
toString { return _value }
bar = value {
_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"
refactor: convert IO from singleton instance to static class with metaclass native methods Replace the global `io` singleton object with a static `IO` class, moving the `write` native from the instance to the metaclass. Update all benchmark, example, and test files to use `IO.write()` instead of `io.write()`.
2013-12-22 04:25:09 +01:00
IO.write(a.toString) // expect: d
IO.write(b.toString) // expect: d
IO.write(c.toString) // expect: d
Reference in New Issue Copy Permalink
b72a42eedd
wren/test/setter/associativity.wren
Response time: 34ms
Mail Licenses API