Fixed formatting of expressions like (x[1].1)[1]

This commit is contained in:
Alexey Milovidov 2019-06-17 01:42:06 +03:00
parent 0bc2b751ea
commit 2c0bdf1d90

View File

@ -223,10 +223,16 @@ void ASTFunction::formatImplWithoutAlias(const FormatSettings & settings, Format
{ {
if (lit->value.getType() == Field::Types::UInt64) if (lit->value.getType() == Field::Types::UInt64)
{ {
if (frame.need_parens)
settings.ostr << '(';
arguments->children[0]->formatImpl(settings, state, nested_need_parens); arguments->children[0]->formatImpl(settings, state, nested_need_parens);
settings.ostr << (settings.hilite ? hilite_operator : "") << "." << (settings.hilite ? hilite_none : ""); settings.ostr << (settings.hilite ? hilite_operator : "") << "." << (settings.hilite ? hilite_none : "");
arguments->children[1]->formatImpl(settings, state, nested_need_parens); arguments->children[1]->formatImpl(settings, state, nested_need_parens);
written = true; written = true;
if (frame.need_parens)
settings.ostr << ')';
} }
} }
} }