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:
parent
d39345f7cd
commit
fab103cb47
@ -2909,12 +2909,13 @@ void ASBeautifier::parseCurrentLine(const string& line)
|
|||||||
if (!inStatementIndentStack->empty())
|
if (!inStatementIndentStack->empty())
|
||||||
{
|
{
|
||||||
bool initializerBlock =
|
bool initializerBlock =
|
||||||
(isInStatement && (prevNonSpaceCh == ',' || prevNonSpaceCh == '('));
|
(prevNonSpaceCh == ',' || prevNonSpaceCh == '('
|
||||||
|
|| prevNonSpaceCh == '{');
|
||||||
|
|
||||||
// Purge the inStatementIndentStack if the line begins with '{'
|
// Purge the inStatementIndentStack if the line begins with '{'
|
||||||
// and this is not a possible initializer block in a statement,
|
// and this is not a possible initializer block in a statement,
|
||||||
// for example: function(arg, { 1, 2, 3, 4 });
|
// for example: function(arg, { 1, 2, 3, 4 });
|
||||||
if (lineBeginsWithOpenBracket && !initializerBlock)
|
if (i == 0 && !initializerBlock)
|
||||||
{
|
{
|
||||||
while (!inStatementIndentStack->empty())
|
while (!inStatementIndentStack->empty())
|
||||||
popLastInStatementIndent();
|
popLastInStatementIndent();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user