Avoid interpreting named args as labels when indenting newline in keep_line_breaks mode.
This commit is contained in:
parent
d8e43e23ec
commit
a12e83e8a4
|
|
@ -1783,6 +1783,8 @@ private:
|
||||||
|
|
||||||
if (hasCurrent)
|
if (hasCurrent)
|
||||||
{
|
{
|
||||||
|
const isNamedArg = index + 1 < tokens.length
|
||||||
|
&& astInformation.namedArgumentColonLocations.canFindIndex(tokens[index + 1].index);
|
||||||
if (currentIs(tok!"else"))
|
if (currentIs(tok!"else"))
|
||||||
{
|
{
|
||||||
immutable i = indents.indentToMostRecent(tok!"if");
|
immutable i = indents.indentToMostRecent(tok!"if");
|
||||||
|
|
@ -1791,7 +1793,7 @@ private:
|
||||||
if (mostRecent != -1)
|
if (mostRecent != -1)
|
||||||
indentLevel = mostRecent;
|
indentLevel = mostRecent;
|
||||||
}
|
}
|
||||||
else if (currentIs(tok!"identifier") && peekIs(tok!":"))
|
else if (currentIs(tok!"identifier") && peekIs(tok!":") && !isNamedArg)
|
||||||
{
|
{
|
||||||
if (peekBackIs(tok!"}", true) || peekBackIs(tok!";", true))
|
if (peekBackIs(tok!"}", true) || peekBackIs(tok!";", true))
|
||||||
indents.popTempIndents();
|
indents.popTempIndents();
|
||||||
|
|
|
||||||
|
|
@ -26,3 +26,8 @@ void main()
|
||||||
|
|
||||||
temp(v1: () { S s = S(i: 5); return s.i; }, v2: 1);
|
temp(v1: () { S s = S(i: 5); return s.i; }, v2: 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void test()
|
||||||
|
{
|
||||||
|
return Struct(foo: field.foo, bar: field.bar, baz: field.baz);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,3 +29,10 @@ void main()
|
||||||
|
|
||||||
temp(v1: () { S s = S(i: 5); return s.i; }, v2: 1);
|
temp(v1: () { S s = S(i: 5); return s.i; }, v2: 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void test() {
|
||||||
|
return Struct(
|
||||||
|
foo: field.foo,
|
||||||
|
bar: field.bar,
|
||||||
|
baz: field.baz);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,3 +25,8 @@ void main()
|
||||||
|
|
||||||
temp(v1: () { S s = S(i: 5); return s.i; }, v2: 1);
|
temp(v1: () { S s = S(i: 5); return s.i; }, v2: 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void test()
|
||||||
|
{
|
||||||
|
return Struct(foo: field.foo, bar: field.bar, baz: field.baz);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,3 +22,7 @@ void main() {
|
||||||
|
|
||||||
temp(v1: () { S s = S(i: 5); return s.i; }, v2: 1);
|
temp(v1: () { S s = S(i: 5); return s.i; }, v2: 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void test() {
|
||||||
|
return Struct(foo: field.foo, bar: field.bar, baz: field.baz);
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue