From a475d060df7da0e9cbb6f794d6a99d9c29a03d56 Mon Sep 17 00:00:00 2001 From: "H. S. Teoh" Date: Sat, 23 Aug 2014 18:45:58 -0700 Subject: [PATCH] Fix coding style for declaration.dd --- declaration.dd | 69 ++++++++++++++++++++++++++++---------------------- 1 file changed, 39 insertions(+), 30 deletions(-) diff --git a/declaration.dd b/declaration.dd index d82a35d193..a8384b9aa5 100644 --- a/declaration.dd +++ b/declaration.dd @@ -368,8 +368,8 @@ alias myint = abc.Foo.bar; -------------------- alias myint = int; -void foo(int x) { . } -void foo(myint m) { . } // error, multiply defined function foo +void foo(int x) { ... } +void foo(myint m) { ... } // error, multiply defined function foo -------------------- $(P A symbol can be declared as an $(I alias) of another symbol. @@ -433,23 +433,26 @@ alias strlen = string.strlen; ) -------------------- -class A { +class A +{ int foo(int a) { return 1; } } -class B : A { +class B : A +{ int foo( int a, uint b ) { return 2; } } -class C : B { +class C : B +{ int foo( int a ) { return 3; } alias foo = B.foo; } -class D : C { +class D : C +{ } - void test() { D b = new D(); @@ -518,14 +521,15 @@ $(GNAME Typeof): ) -------------------- - void func(int i) { - typeof(i) j; // j is of type int - typeof(3 + 6.0) x; // x is of type double - typeof(1)* p; // p is of type pointer to int - int[typeof(p)] a; // a is of type int[int*] - - writefln("%d", typeof('c').sizeof); // prints 1 - double c = cast(typeof(1.0))j; // cast j to double + void func(int i) + { + typeof(i) j; // j is of type int + typeof(3 + 6.0) x; // x is of type double + typeof(1)* p; // p is of type pointer to int + int[typeof(p)] a; // a is of type int[int*] + + writefln("%d", typeof('c').sizeof); // prints 1 + double c = cast(typeof(1.0))j; // cast j to double } -------------------- @@ -535,10 +539,11 @@ $(GNAME Typeof): ) -------------------- - void func() { - int i = 1; - typeof(++i) j; // j is declared to be an int, i is not incremented - writefln("%d", i); // prints 1 + void func() + { + int i = 1; + typeof(++i) j; // j is declared to be an int, i is not incremented + writefln("%d", i); // prints 1 } -------------------- @@ -559,15 +564,17 @@ $(GNAME Typeof): -------------------- class A { } - class B : A { - typeof(this) x; // x is declared to be a B - typeof(super) y; // y is declared to be an A + class B : A + { + typeof(this) x; // x is declared to be a B + typeof(super) y; // y is declared to be an A } - struct C { - static typeof(this) z; // z is declared to be a C + struct C + { + static typeof(this) z; // z is declared to be a C - typeof(super) q; // error, no super struct for C + typeof(super) q; // error, no super struct for C } typeof(this) r; // error, no enclosing struct or class @@ -578,8 +585,9 @@ $(GNAME Typeof): ) -------------------- - struct S { - @property int foo() { return 1; } + struct S + { + @property int foo() { return 1; } } typeof(S.foo) n; // n is declared to be an int -------------------- @@ -604,9 +612,10 @@ $(GNAME VoidInitializer): ) ------------------------- -void foo() { - int x = void; - writeln(x); // will print garbage +void foo() +{ + int x = void; + writeln(x); // will print garbage } -------------------------