Fix #326 - Spaces missing after attributes in function literals

This commit is contained in:
Laurent Tréguier 2018-10-07 20:11:52 +02:00
parent 16c3811261
commit bcf199ea53
No known key found for this signature in database
GPG Key ID: 09530BFFC32D4A69
4 changed files with 9 additions and 1 deletions

View File

@ -786,7 +786,7 @@ private:
else if (astInformation.funLitStartLocations.canFindIndex(tIndex))
{
sBraceDepth++;
if (peekBackIs(tok!")"))
if (peekBackIsOneOf(true, tok!")", tok!"identifier"))
write(" ");
auto e = expressionEndIndex(index);
immutable int l = currentLineLength + tokens[index .. e].map!(a => tokenLength(a))

View File

@ -0,0 +1,4 @@
void main()
{
() @trusted { stderr.writeln("\033[01;33m", url, "\033[0m"); }();
}

1
tests/issue0326.d Normal file
View File

@ -0,0 +1 @@
void main(){()@trusted{stderr.writeln("\033[01;33m", url, "\033[0m");}();}

View File

@ -0,0 +1,3 @@
void main() {
() @trusted { stderr.writeln("\033[01;33m", url, "\033[0m"); }();
}