zclwrite: format shouldn't add spaces around attribute access dots
This commit is contained in:
parent
d1fb42746b
commit
cab61b36dc
@ -231,6 +231,10 @@ func spaceAfterToken(subject, before, after *Token) bool {
|
|||||||
// Don't split a function name from open paren in a call
|
// Don't split a function name from open paren in a call
|
||||||
return false
|
return false
|
||||||
|
|
||||||
|
case subject.Type == zclsyntax.TokenDot || after.Type == zclsyntax.TokenDot:
|
||||||
|
// Don't use spaces around attribute access dots
|
||||||
|
return false
|
||||||
|
|
||||||
case after.Type == zclsyntax.TokenComma:
|
case after.Type == zclsyntax.TokenComma:
|
||||||
// No space right before a comma in an argument list
|
// No space right before a comma in an argument list
|
||||||
return false
|
return false
|
||||||
|
@ -23,6 +23,10 @@ func TestFormat(t *testing.T) {
|
|||||||
`a=1`,
|
`a=1`,
|
||||||
`a = 1`,
|
`a = 1`,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
`a=b.c`,
|
||||||
|
`a = b.c`,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
`( a+2 )`,
|
`( a+2 )`,
|
||||||
`(a + 2)`,
|
`(a + 2)`,
|
||||||
|
Loading…
Reference in New Issue
Block a user