-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #534 from dlang-community/knr_brace_style
- Loading branch information
Showing
226 changed files
with
2,399 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
unittest { | ||
targets = [ | ||
[ | ||
RectangleShape.create(tex, vec2(-8 * scale, -32 * scale), | ||
vec2(16 * scale, 48 * scale), vec4(14 / 16.0, 0, 16 / 16.0, 3 / 16.0)), | ||
RectangleShape.create(tex, vec2(-8 * scale, -32 * scale), | ||
vec2(16 * scale, 32 * scale), vec4(14 / 16.0, 3 / 16.0, 16 / 16.0, 5 / 16.0)) | ||
], | ||
[ | ||
RectangleShape.create(tex, vec2(-8 * scale, -8 * scale), | ||
vec2(16 * scale, 16 * scale), vec4(14 / 16.0, 5 / 16.0, 15 / 16.0, 6 / 16.0)), | ||
RectangleShape.create(tex, vec2(-8 * scale, -8 * scale), | ||
vec2(16 * scale, 16 * scale), vec4(15 / 16.0, 5 / 16.0, 16 / 16.0, 6 / 16.0)) | ||
] | ||
]; | ||
|
||
int[][] foo = [ | ||
[ | ||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, | ||
20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32 | ||
], | ||
[ | ||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, | ||
20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32 | ||
] | ||
]; | ||
|
||
float[3][3] mat = [ | ||
[234.3456, 42435.8653, 23.5], [3.245, 235.3, 234.664], | ||
[14324.6453, 23434.645, 9678.345] | ||
]; | ||
} | ||
|
||
string[][] globalArray = [ | ||
["123456789012345678901234567890", "123456789012345678901234567890"], | ||
["123456789012345678901234567890", "123456789012345678901234567890"] | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import std.stdio; | ||
|
||
class Foo { | ||
} | ||
|
||
import std.conv; | ||
|
||
void main() | ||
{ | ||
return; | ||
} | ||
|
||
const baz = 11; | ||
class Foo2 : Foo { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
unittest { | ||
foo([ | ||
target.value.region[1], target.value.region[1], | ||
target.value.region[1], target.value.region[1], target.value.region[1] | ||
]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
void main() | ||
{ | ||
string key; | ||
|
||
int[string] var = [ | ||
key: 5 | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
unittest { | ||
Bson base = Bson([ | ||
"maps": Bson([ | ||
Bson(["id": Bson(4), "comment": Bson("hello")]), | ||
Bson(["id": Bson(49), "comment": Bson(null)]) | ||
]), | ||
"short": Bson(["a": "b", "c": "d"]), | ||
"numbers": Bson([ | ||
1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, | ||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 | ||
]), | ||
"shuffleOnReset": serializeToBson([ | ||
"all": false, | ||
"selected": true, | ||
"maybe": false | ||
]), | ||
"resetOnEmpty": Bson(false), | ||
"applyMods": Bson(true), | ||
"sendComments": Bson(true) | ||
]); | ||
int[] x = [ | ||
1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, | ||
4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
auto find() | ||
{ | ||
return Map.findRange([ | ||
"$and": [ | ||
["deleted": Bson(false)], | ||
[ | ||
"$or": Bson([ | ||
serializeToBson(["forceUpdate": Bson(true)]), | ||
serializeToBson([ | ||
"info.approved": ["$eq": Bson(1)], | ||
"fetchDate": [ | ||
"$lte": Bson(BsonDate(currentTime - 60.days)) | ||
] | ||
]), | ||
serializeToBson([ | ||
"info.approved": ["$ne": Bson(1)], | ||
"fetchDate": [ | ||
"$lte": Bson(BsonDate(currentTime - 14.days)) | ||
] | ||
]) | ||
]) | ||
] | ||
] | ||
]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
struct SomeStructName { | ||
static struct InnerStruct { | ||
version (linux) { | ||
static if (condition) { | ||
void longFunctionName(AAAAAAAA)(AAAAAAAA a) @property | ||
if (someThingsAreTrue!AAAAAAAA && long_condition | ||
&& is(elaborate == expression)) | ||
{ | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
unittest { | ||
{ | ||
{ | ||
foreach (abcde, def; abcdef.map!(battlecruiser => battlecruiser[123 .. 1231231]) | ||
.filter!(bravo => charlie[10] > 90000) | ||
.sum()) { | ||
|
||
} | ||
abcdeabcdeabcde(12341234).abcdeabcdeabcde(12341234).abcdeabcdeabcde(12341234) | ||
.abcdeabcdeabcde(12341234).abcdeabcdeabcde(12341234); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
class U0 : Exception { | ||
this() @safe pure nothrow | ||
{ | ||
super("U0 error message"); | ||
} | ||
} | ||
|
||
class U1 : Exception { | ||
this() @safe pure nothrow | ||
{ | ||
super("U1 error message"); | ||
} | ||
} | ||
|
||
void foo() | ||
{ | ||
import std.stdio; | ||
|
||
foreach (immutable i; 0 .. 2) { | ||
try { | ||
i.bar; | ||
} catch (U0) { | ||
"Function foo caught exception U0".writeln; | ||
} | ||
} | ||
} | ||
|
||
void bar(in int i) @safe pure | ||
{ | ||
i.baz; | ||
} | ||
|
||
void baz(in int i) @safe pure | ||
{ | ||
throw i ? new U1 : new U0; | ||
} | ||
|
||
void main() | ||
{ | ||
foo; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
int /*sneaky*/ foo( /*comments*/ ) /*everywhere*/ | ||
{ | ||
// comment on its own line | ||
foo() // comment on same line | ||
.bar(); // also on same line | ||
/* again */ // same line | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
void foo()() | ||
if (dogs && pigs && birds && ants && foxes && flies && cats && bugs && bees | ||
&& cows && sheeps && monkeys && whales) | ||
{ | ||
} | ||
|
||
void foo()() if (dogs && pigs && birds) | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
void foo()() | ||
if (dogs && pigs && birds && ants && foxes && flies && cats && bugs && bees | ||
&& cows && sheeps && monkeys && whales) | ||
{ | ||
} | ||
|
||
void foo()() | ||
if (dogs && pigs && birds) | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
void main(string[] args) | ||
{ | ||
struct SomeStruct { | ||
private: | ||
int a; | ||
int b; | ||
void doStuff(int q) | ||
in { | ||
assert(q); | ||
} | ||
out (result) { | ||
} | ||
body { | ||
writeln(q); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
void main() | ||
{ | ||
if (true) | ||
debug { | ||
foo(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
void main() | ||
{ | ||
debug (0) | ||
foo(); | ||
else | ||
bar(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
int foo(int arg) | ||
in { | ||
assert(arg > 0); | ||
} | ||
out (result) { | ||
assert(result == 0); | ||
} | ||
do { | ||
return 0; | ||
} | ||
|
||
int bar(int arg) | ||
in (arg > 0) | ||
out (; true) | ||
out /*Major*/ ( /*Tom*/ result /*To ground control*/ ; result == 0) | ||
{ | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import character.body; | ||
|
||
void body() @nogc | ||
in { | ||
} | ||
body { | ||
body = null; | ||
} | ||
|
||
void body() | ||
in { | ||
} | ||
do { | ||
body = null; | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
enum Foo { | ||
|
||
deprecated member0, | ||
@UDA(0) member1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Computes average line length for standard input. | ||
import std.stdio; | ||
|
||
void main() | ||
{ | ||
ulong lines = 0; | ||
double sumLength = 0; | ||
foreach (line; stdin.byLine()) { | ||
++lines; | ||
sumLength += line.length; | ||
} | ||
writeln("Average line length: ", lines ? sumLength / lines : 0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
void foo(@UDA(0) @UDA(1) Bar bar); |
Oops, something went wrong.