fmt: add a space after + operator/method overload (#7453)
parent
74f7a1a549
commit
304aafdc50
|
@ -50,6 +50,9 @@ pub fn (node &FnDecl) stringify(t &table.Table, cur_mod string) string {
|
||||||
name = 'JS.$name'
|
name = 'JS.$name'
|
||||||
}
|
}
|
||||||
f.write('fn $receiver$name')
|
f.write('fn $receiver$name')
|
||||||
|
if name in ['+', '-', '*', '/', '%'] {
|
||||||
|
f.write(' ')
|
||||||
|
}
|
||||||
if node.is_generic {
|
if node.is_generic {
|
||||||
f.write('<T>')
|
f.write('<T>')
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
struct Foo {
|
||||||
|
x int
|
||||||
|
}
|
||||||
|
|
||||||
|
fn (a Foo) + (b Foo) Foo {
|
||||||
|
return Foo{a.x + b.x}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn (a Foo) % (b Foo) Foo {
|
||||||
|
return Foo{a.x % b.x}
|
||||||
|
}
|
Loading…
Reference in New Issue