[vala/wip/issue/658: 44/48] Cleaned up codestyle
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/issue/658: 44/48] Cleaned up codestyle
- Date: Sat, 31 Oct 2020 15:08:17 +0000 (UTC)
commit e231d1c11620f8c5e0f88d005abfcac46a4e8d5e
Author: Nick Schrader <nick schrader mailbox org>
Date: Thu Oct 29 12:59:02 2020 -0300
Cleaned up codestyle
tests/delegates/anonymous-array.vala | 8 ++++----
tests/delegates/anonymous-dynamic.test | 8 ++++----
tests/delegates/anonymous-generics.test | 6 +++---
tests/delegates/anonymous-inner-dynamic-param.test | 8 ++++----
.../delegates/anonymous-inner-dynamic-return.test | 8 ++++----
tests/delegates/anonymous-inner-owned-unowned.vala | 24 +++++++++++-----------
tests/delegates/anonymous-inner-ref-out.vala | 18 ++++++++--------
tests/delegates/anonymous-out.test | 10 ++++-----
tests/delegates/anonymous-ref.test | 10 ++++-----
tests/delegates/anonymous-type-param.vala | 12 +++++------
tests/delegates/anonymous.vala | 4 ++--
tests/methods/parameter-anonymous-delegate.vala | 2 +-
vala/valacodewriter.vala | 2 +-
vala/valaparser.vala | 2 +-
14 files changed, 61 insertions(+), 61 deletions(-)
---
diff --git a/tests/delegates/anonymous-array.vala b/tests/delegates/anonymous-array.vala
index 116a523fd..b032b2915 100644
--- a/tests/delegates/anonymous-array.vala
+++ b/tests/delegates/anonymous-array.vala
@@ -1,14 +1,14 @@
-void main() {
- f((a, b) => {
+void main () {
+ f ((a, b) => {
int r = 0;
for (int i = 0; i < a.length; i++) {
- r += a[i]*b[i];
+ r += a[i] * b[i];
}
return r;
});
}
-void f(delegate(int[], int[]) => int abc) {
+void f (delegate(int[], int[]) => int abc) {
int i[] = {1, 2, 3};
int j[] = {7, 8, 9};
assert (abc (i, j) == 50);
diff --git a/tests/delegates/anonymous-dynamic.test b/tests/delegates/anonymous-dynamic.test
index f067c1d47..fdbf22824 100644
--- a/tests/delegates/anonymous-dynamic.test
+++ b/tests/delegates/anonymous-dynamic.test
@@ -1,12 +1,12 @@
Invalid Code
/*
- * 9.8-9.32: error: Anonymous delegates cannot be dynamic types
- * void p(dynamic delegate() => int d) {
- * ^^^^^^^^^^^^^^^^^^^^^^^^^
+ * 9.9-9.33: error: Anonymous delegates cannot be dynamic types
+ * void p (dynamic delegate() => int d) {
+ * ^^^^^^^^^^^^^^^^^^^^^^^^^
*/
-void p(dynamic delegate() => int d) {
+void p (dynamic delegate() => int d) {
d ();
}
diff --git a/tests/delegates/anonymous-generics.test b/tests/delegates/anonymous-generics.test
index de46d6d56..112e06463 100644
--- a/tests/delegates/anonymous-generics.test
+++ b/tests/delegates/anonymous-generics.test
@@ -6,14 +6,14 @@ Invalid Code
* ^
*/
-void main() {
+void main () {
f (t);
}
void f (delegate<T>(int) => void y) {
- y(1);
+ y (1);
}
-void t(int a) {
+void t (int a) {
assert (a == 1);
}
diff --git a/tests/delegates/anonymous-inner-dynamic-param.test
b/tests/delegates/anonymous-inner-dynamic-param.test
index 3f3fca197..3d8199625 100644
--- a/tests/delegates/anonymous-inner-dynamic-param.test
+++ b/tests/delegates/anonymous-inner-dynamic-param.test
@@ -1,12 +1,12 @@
Invalid Code
/*
- * 7.17-7.27: error: Dynamic types not allowed in anonymous delegates
- * void p(delegate(dynamic int) => void d) {
- * ^^^^^^^^^^^
+ * 7.18-7.28: error: Dynamic types not allowed in anonymous delegates
+ * void p (delegate(dynamic int) => void d) {
+ * ^^^^^^^^^^^
*/
-void p(delegate(dynamic int) => void d) {
+void p (delegate(dynamic int) => void d) {
d (7);
}
diff --git a/tests/delegates/anonymous-inner-dynamic-return.test
b/tests/delegates/anonymous-inner-dynamic-return.test
index 0c01de55e..0a2b6adf7 100644
--- a/tests/delegates/anonymous-inner-dynamic-return.test
+++ b/tests/delegates/anonymous-inner-dynamic-return.test
@@ -1,12 +1,12 @@
Invalid Code
/*
- * 9.22-9.32: error: Dynamic types not allowed in anonymous delegates
- * void p(delegate() => dynamic int d) {
- * ^^^^^^^^^^^
+ * 9.23-9.33: error: Dynamic types not allowed in anonymous delegates
+ * void p (delegate() => dynamic int d) {
+ * ^^^^^^^^^^^
*/
-void p(delegate() => dynamic int d) {
+void p (delegate() => dynamic int d) {
var x = d ();
}
diff --git a/tests/delegates/anonymous-inner-owned-unowned.vala
b/tests/delegates/anonymous-inner-owned-unowned.vala
index e34e32c97..7c3381e45 100644
--- a/tests/delegates/anonymous-inner-owned-unowned.vala
+++ b/tests/delegates/anonymous-inner-owned-unowned.vala
@@ -4,38 +4,38 @@ class Aaa {
}
class Bbb {
- Aaa a = new Aaa();
+ Aaa a = new Aaa ();
- public unowned Aaa get_a() {
+ public unowned Aaa get_a () {
unowned Aaa x = a;
a = null;
return x;
}
}
-void p(delegate(owned Aaa) => void d) {
- var a = new Aaa();
+void p (delegate(owned Aaa) => void d) {
+ var a = new Aaa ();
d ((owned) a);
assert (a == null);
}
-void q(delegate(Aaa) => void d) {
- var a = new Aaa();
+void q (delegate(Aaa) => void d) {
+ var a = new Aaa ();
d (a);
assert (a.i == 42);
}
-void r(delegate() => Aaa d) {
+void r (delegate() => Aaa d) {
assert (d ().i == 42);
}
-void s(delegate() => unowned Aaa d) {
+void s (delegate() => unowned Aaa d) {
assert (d ().i != 42);
}
void main () {
- p((a) => assert (a.i == 42));
- q((a) => assert (a.i == 42));
- r(() => new Aaa());
- s(new Bbb().get_a);
+ p ((a) => assert (a.i == 42));
+ q ((a) => assert (a.i == 42));
+ r (() => new Aaa());
+ s (new Bbb().get_a);
}
diff --git a/tests/delegates/anonymous-inner-ref-out.vala b/tests/delegates/anonymous-inner-ref-out.vala
index a4a268a63..b094d1ca0 100644
--- a/tests/delegates/anonymous-inner-ref-out.vala
+++ b/tests/delegates/anonymous-inner-ref-out.vala
@@ -1,24 +1,24 @@
-void main() {
- f(t);
- g(d);
+void main () {
+ f (t);
+ g (d);
}
-void f(delegate(ref int) => void x) {
+void f (delegate(ref int) => void x) {
int i = 42;
- x(ref i);
+ x (ref i);
assert (i == 7);
}
-void g(delegate(out int) => void y) {
+void g (delegate(out int) => void y) {
int i;
- y(out i);
+ y (out i);
assert (i == 42);
}
-void t(ref int a) {
+void t (ref int a) {
a = 7;
}
-void d(out int a) {
+void d (out int a) {
a = 42;
}
diff --git a/tests/delegates/anonymous-out.test b/tests/delegates/anonymous-out.test
index 30105b705..731320623 100644
--- a/tests/delegates/anonymous-out.test
+++ b/tests/delegates/anonymous-out.test
@@ -1,15 +1,15 @@
Invalid Code
/*
- * 13.8-13.32: error: Anonymous delegates cannot be `out` parameters
- * void f(ref delegate(int) => void x) {
- * ^^^^^^^^^^^^^^^^^^^^^^^^^
+ * 13.9-13.33: error: Anonymous delegates cannot be `out` parameters
+ * void f (out delegate(int) => void x) {
+ * ^^^^^^^^^^^^^^^^^^^^^^^^^
*/
-void main() {
+void main () {
assert (true);
}
-void f(out delegate(int) => void x) {
+void f (out delegate(int) => void x) {
x(42);
}
diff --git a/tests/delegates/anonymous-ref.test b/tests/delegates/anonymous-ref.test
index 6bcc73b88..e79835a38 100644
--- a/tests/delegates/anonymous-ref.test
+++ b/tests/delegates/anonymous-ref.test
@@ -1,15 +1,15 @@
Invalid Code
/*
- * 13.8-13.32: error: Anonymous delegates cannot be `ref` parameters
- * void f(ref delegate(int) => void x) {
- * ^^^^^^^^^^^^^^^^^^^^^^^^^
+ * 13.9-13.33: error: Anonymous delegates cannot be `ref` parameters
+ * void f (ref delegate(int) => void x) {
+ * ^^^^^^^^^^^^^^^^^^^^^^^^^
*/
void main() {
assert (true);
}
-void f(ref delegate(int) => void x) {
- x(42);
+void f (ref delegate(int) => void x) {
+ x (42);
}
diff --git a/tests/delegates/anonymous-type-param.vala b/tests/delegates/anonymous-type-param.vala
index 052a703ef..b5485aa5c 100644
--- a/tests/delegates/anonymous-type-param.vala
+++ b/tests/delegates/anonymous-type-param.vala
@@ -1,14 +1,14 @@
-void main() {
- f(t);
+void main () {
+ f (t);
}
-string t(Comp<string> a, Comp<string> b) {
- return a.a+b.a;
+string t (Comp<string> a, Comp<string> b) {
+ return a.a + b.a;
}
-void f(delegate(Comp<string>, Comp<string>) => string abc) {
- assert (abc(new Comp<string>("x"), new Comp<string>("y")) == "xy");
+void f (delegate(Comp<string>, Comp<string>) => string abc) {
+ assert (abc(new Comp<string> ("x"), new Comp<string> ("y")) == "xy");
}
class Comp<A> {
diff --git a/tests/delegates/anonymous.vala b/tests/delegates/anonymous.vala
index cbb8b049b..eff97e298 100644
--- a/tests/delegates/anonymous.vala
+++ b/tests/delegates/anonymous.vala
@@ -1,6 +1,6 @@
void main () {
- f((a, b) => {
- return a+b;
+ f ((a, b) => {
+ return a + b;
});
}
diff --git a/tests/methods/parameter-anonymous-delegate.vala b/tests/methods/parameter-anonymous-delegate.vala
index 0b34b6945..da3e624be 100644
--- a/tests/methods/parameter-anonymous-delegate.vala
+++ b/tests/methods/parameter-anonymous-delegate.vala
@@ -14,7 +14,7 @@ void manam ([CCode (has_target = false)] delegate(int, int) => int p, int r) {
assert (p (23, 42) == r);
}
-void main() {
+void main () {
foo (func, 65);
bar (65, func);
manam (func, 65);
diff --git a/vala/valacodewriter.vala b/vala/valacodewriter.vala
index 04bd5929a..7ae6c6576 100644
--- a/vala/valacodewriter.vala
+++ b/vala/valacodewriter.vala
@@ -716,7 +716,7 @@ public class Vala.CodeWriter : CodeVisitor {
if (cb.anonymous) {
return;
}
-
+
if (context.vapi_comments && cb.comment != null) {
write_comment (cb.comment);
}
diff --git a/vala/valaparser.vala b/vala/valaparser.vala
index 576256e25..4a41eb41d 100644
--- a/vala/valaparser.vala
+++ b/vala/valaparser.vala
@@ -3765,7 +3765,7 @@ public class Vala.Parser : CodeVisitor {
expect (TokenType.DELEGATE);
expect (TokenType.OPEN_PARENS);
- var param_list = new ArrayList<Parameter>();
+ var param_list = new ArrayList<Parameter> ();
if (current () != TokenType.CLOSE_PARENS) {
int next_parameter_id = 0;
do {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]