blob: 9efbefe0426586c3741f690f7e6db8b1e40f22a5 [file] [log] [blame]
40 columns |
### Constructor invocations are handled identically to function calls, so just
### test the basics and make sure that we handle the keywords correctly.
>>> Empty argument list.
new Foo ( ) ;
<<<
new Foo();
>>> Inline arguments.
new SomeType ( argument , another ) ;
<<<
new SomeType(argument, another);
>>> Split argument list.
const SomeType ( argument , another , third ) ;
<<<
const SomeType(
argument,
another,
third,
);
>>> With type arguments.
new Map < int , String > ( 1 , 2 , 3 );
<<<
new Map<int, String>(1, 2, 3);
>>> Named constructor.
new Thing . name ( argument ) ;
<<<
new Thing.name(argument);
>>> Named constructor on class with type arguments.
const List < int > . filled ( 1 , 2 );
<<<
const List<int>.filled(1, 2);
>>> Prefixed.
new prefix . TypeName ( argument ) ;
<<<
new prefix.TypeName(argument);
>>> Prefix named constructor.
const prefix . Thing . name ( argument ) ;
<<<
const prefix.Thing.name(argument);
>>> Don't split at name.
new VeryLongClassName.veryLongNamedConstructor();
<<<
new VeryLongClassName.veryLongNamedConstructor();
>>> Don't split at name on prefixed named constructor.
new prefix.VeryLongClassName.veryLongNamedConstructor();
<<<
new prefix.VeryLongClassName.veryLongNamedConstructor();
>>> Allow block-formatted argument.
new Future(new Duration(1), () {
print('I am a callback');
});
<<<
new Future(new Duration(1), () {
print('I am a callback');
});