Properly handle initializer blocks with double block openers. For example:

std::map<uint32_t, uint32_t> generation_map(
    { {0, 100}, {1, 100}, {2, 100}, {3, 10}, {4, 10} });
This commit is contained in:
Peter Vingelmann 2016-09-29 00:20:55 +02:00
parent d39345f7cd
commit fab103cb47

View File

@ -2909,12 +2909,13 @@ void ASBeautifier::parseCurrentLine(const string& line)
if (!inStatementIndentStack->empty())
{
bool initializerBlock =
(isInStatement && (prevNonSpaceCh == ',' || prevNonSpaceCh == '('));
(prevNonSpaceCh == ',' || prevNonSpaceCh == '('
|| prevNonSpaceCh == '{');
// Purge the inStatementIndentStack if the line begins with '{'
// and this is not a possible initializer block in a statement,
// for example: function(arg, { 1, 2, 3, 4 });
if (lineBeginsWithOpenBracket && !initializerBlock)
if (i == 0 && !initializerBlock)
{
while (!inStatementIndentStack->empty())
popLastInStatementIndent();