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.
This commit is contained in:
Bob Nystrom
2014-04-09 00:54:37 +00:00
parent 25098cd181
commit fca506fdf1
19 changed files with 40 additions and 35 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
class Foo {
new(value) { _value = value }
toString { _value }
bar = value {
bar=(value) {
_value = value
return value
}
+1 -1
View File
@@ -1,5 +1,5 @@
class Foo {
bar = value { value }
bar=(value) { value }
}
var foo = new Foo
+1 -1
View File
@@ -1,5 +1,5 @@
class Foo {
bar = value { value }
bar=(value) { value }
}
var foo = new Foo
+1 -1
View File
@@ -1,5 +1,5 @@
class Foo {
bar = value {
bar=(value) {
IO.print(value)
}
}
+1 -1
View File
@@ -1,5 +1,5 @@
class Foo {
bar = value { value }
bar=(value) { value }
}
var foo = new Foo
+1 -1
View File
@@ -1,5 +1,5 @@
class Foo {
bar = value { value }
bar=(value) { value }
}
var foo = new Foo
+1 -1
View File
@@ -1,5 +1,5 @@
class Foo {
bar = value { "result" }
bar=(value) { "result" }
}
var foo = new Foo
+1 -1
View File
@@ -1,5 +1,5 @@
class Foo {
bar = value { IO.print("set") }
bar=(value) { IO.print("set") }
bar { IO.print("get") }
}
+1 -1
View File
@@ -1,5 +1,5 @@
class Foo {
static bar = value {
static bar=(value) {
IO.print(value)
}
}