Files
wren/test/implicit_receiver/nested_class.wren
T
Bob Nystrom fca506fdf1 feat: require parentheses around operator and setter method parameters in Wren
Enforce syntactic requirement for parentheses in operator method signatures (e.g., `+(other)` instead of `+ other`) and setter definitions (e.g., `bar=(value)` instead of `bar = value`). Update the compiler's `infixSignature`, `mixedSignature`, and `namedSignature` functions to consume explicit `(` and `)` tokens around parameter names. Migrate all built-in core library operator definitions and test fixtures to the new parenthesized syntax.
2014-04-09 00:54:37 +00:00

48 lines
870 B
Plaintext

class Outer {
getter {
IO.print("outer getter")
}
setter=(value) {
IO.print("outer setter")
}
method(a) {
IO.print("outer method")
}
test {
getter // expect: outer getter
setter = "value" // expect: outer setter
method("arg") // expect: outer method
class Inner {
getter {
IO.print("inner getter")
}
setter=(value) {
IO.print("inner setter")
}
method(a) {
IO.print("inner method")
}
test {
getter // expect: inner getter
setter = "value" // expect: inner setter
method("arg") // expect: inner method
}
}
(new Inner).test
getter // expect: outer getter
setter = "value" // expect: outer setter
method("arg") // expect: outer method
}
}
(new Outer).test