fix bug in --space_before_function_parameters
This commit is contained in:
parent
1c22b3d5e1
commit
ec2e223b9a
|
@ -281,8 +281,8 @@ private:
|
||||||
{
|
{
|
||||||
writeToken();
|
writeToken();
|
||||||
if (index < tokens.length && (currentIs(tok!"identifier")
|
if (index < tokens.length && (currentIs(tok!"identifier")
|
||||||
|| ( ( isBasicType(peekBack().type) || peekBackIs(tok!"identifier") ) &&
|
|| ( index < 1 && ( isBasicType(peekBack(2).type) || peekBack2Is(tok!"identifier") ) &&
|
||||||
currentIs(tok!("(")) && config.dfmt_space_before_function_parameters)
|
currentIs(tok!("(")) && config.dfmt_space_before_function_parameters )
|
||||||
|| isBasicType(current.type) || currentIs(tok!"@") || currentIs(tok!"if")
|
|| isBasicType(current.type) || currentIs(tok!"@") || currentIs(tok!"if")
|
||||||
|| isNumberLiteral(tokens[index].type) || (inAsm
|
|| isNumberLiteral(tokens[index].type) || (inAsm
|
||||||
&& peekBack2Is(tok!";") && currentIs(tok!"["))))
|
&& peekBack2Is(tok!";") && currentIs(tok!"["))))
|
||||||
|
@ -1576,10 +1576,13 @@ const pure @safe @nogc:
|
||||||
return tokens[index];
|
return tokens[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
const(Token) peekBack() nothrow
|
const(Token) peekBack(uint distance = 1) nothrow
|
||||||
{
|
{
|
||||||
assert(index > 0);
|
if (index < distance)
|
||||||
return tokens[index - 1];
|
{
|
||||||
|
assert(0, "Trying to peek before the first token");
|
||||||
|
}
|
||||||
|
return tokens[index - distance];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool peekBackIsLiteralOrIdent() nothrow
|
bool peekBackIsLiteralOrIdent() nothrow
|
||||||
|
|
Loading…
Reference in New Issue