Compare commits
No commits in common. "master" and "v0.15.2" have entirely different histories.
|
|
@ -454,31 +454,14 @@ final class FormatVisitor : ASTVisitor
|
||||||
|
|
||||||
override void visit(const FunctionCallExpression functionCall)
|
override void visit(const FunctionCallExpression functionCall)
|
||||||
{
|
{
|
||||||
visit(functionCall.arguments);
|
// Check if function has any arguments.
|
||||||
|
if (functionCall.arguments.namedArgumentList is null)
|
||||||
|
{
|
||||||
functionCall.accept(this);
|
functionCall.accept(this);
|
||||||
}
|
|
||||||
|
|
||||||
override void visit(const NewExpression newCall)
|
|
||||||
{
|
|
||||||
visit(newCall.arguments);
|
|
||||||
newCall.accept(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
override void visit(const NewAnonClassExpression newAnonClassCall)
|
|
||||||
{
|
|
||||||
visit(newAnonClassCall.constructorArguments);
|
|
||||||
newAnonClassCall.accept(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void visit(const Arguments arguments)
|
|
||||||
{
|
|
||||||
// Check if call has any arguments.
|
|
||||||
if (!arguments || arguments.namedArgumentList is null)
|
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (item; arguments.namedArgumentList.items)
|
foreach (item; functionCall.arguments.namedArgumentList.items)
|
||||||
{
|
{
|
||||||
// Do nothing if not a named argument.
|
// Do nothing if not a named argument.
|
||||||
if (item.name == tok!"")
|
if (item.name == tok!"")
|
||||||
|
|
@ -496,6 +479,8 @@ final class FormatVisitor : ASTVisitor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
functionCall.accept(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -1783,8 +1783,6 @@ 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");
|
||||||
|
|
@ -1793,7 +1791,7 @@ private:
|
||||||
if (mostRecent != -1)
|
if (mostRecent != -1)
|
||||||
indentLevel = mostRecent;
|
indentLevel = mostRecent;
|
||||||
}
|
}
|
||||||
else if (currentIs(tok!"identifier") && peekIs(tok!":") && !isNamedArg)
|
else if (currentIs(tok!"identifier") && peekIs(tok!":"))
|
||||||
{
|
{
|
||||||
if (peekBackIs(tok!"}", true) || peekBackIs(tok!";", true))
|
if (peekBackIs(tok!"}", true) || peekBackIs(tok!";", true))
|
||||||
indents.popTempIndents();
|
indents.popTempIndents();
|
||||||
|
|
|
||||||
|
|
@ -26,13 +26,3 @@ 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);
|
|
||||||
return new Class(foo: field.foo, bar: field.bar, baz: field.baz);
|
|
||||||
// anonymous class
|
|
||||||
return new class(foo: field.foo, bar: field.bar, baz: field.baz) Class
|
|
||||||
{
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -29,19 +29,3 @@ 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);
|
|
||||||
return new Class(
|
|
||||||
foo: field.foo,
|
|
||||||
bar: field.bar,
|
|
||||||
baz: field.baz);
|
|
||||||
// anonymous class
|
|
||||||
return new class(
|
|
||||||
foo: field.foo,
|
|
||||||
bar: field.bar,
|
|
||||||
baz: field.baz) Class { };
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -25,12 +25,3 @@ 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);
|
|
||||||
return new Class(foo: field.foo, bar: field.bar, baz: field.baz);
|
|
||||||
// anonymous class
|
|
||||||
return new class(foo: field.foo, bar: field.bar, baz: field.baz) Class {
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -22,11 +22,3 @@ 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);
|
|
||||||
return new Class(foo: field.foo, bar: field.bar, baz: field.baz);
|
|
||||||
// anonymous class
|
|
||||||
return new class(foo: field.foo, bar: field.bar, baz: field.baz) Class {
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue