[vala/wip/issue/327: 39/43] Linted all with-statement concerned files



commit e3469fcef1946b9a463fd590da46f7923a2a2e4f
Author: Nick Schrader <nick schrader mailbox org>
Date:   Sat Apr 4 15:29:18 2020 -0300

    Linted all with-statement concerned files

 tests/nullability/with-non-null.test          |  4 +--
 tests/objects/with-expression.vala            | 33 ++++++++++-----------
 tests/objects/with-instance.vala              | 42 +++++++++++++--------------
 tests/objects/with-nested.vala                | 26 ++++++++---------
 tests/parser/with-embedded.vala               |  8 ++---
 tests/parser/with-empty.vala                  |  4 +--
 tests/parser/with-no-block.test               |  4 +--
 tests/parser/with-no-expression.test          |  4 +--
 tests/semantic/with-array.test                |  4 +--
 tests/semantic/with-buildin.vala              |  2 +-
 tests/semantic/with-class.test                |  2 +-
 tests/semantic/with-compact.vala              |  4 +--
 tests/semantic/with-dereferenced-pointer.vala |  8 ++---
 tests/semantic/with-enum-member.vala          |  2 +-
 tests/semantic/with-enum.test                 |  2 +-
 tests/semantic/with-error-member.test         |  2 +-
 tests/semantic/with-error.test                |  2 +-
 tests/semantic/with-namespace.test            |  2 +-
 tests/semantic/with-no-such-member.test       |  2 +-
 tests/semantic/with-no-such-with-member.test  |  4 +--
 tests/semantic/with-null.vala                 |  4 +--
 tests/semantic/with-pointer.test              |  4 +--
 tests/semantic/with-string.vala               |  2 +-
 tests/semantic/with-value.vala                |  6 ++--
 vala/valamemberaccess.vala                    |  6 ++--
 vala/valascanner.vala                         |  2 +-
 vala/valawithstatement.vala                   | 10 +++----
 27 files changed, 97 insertions(+), 98 deletions(-)
---
diff --git a/tests/nullability/with-non-null.test b/tests/nullability/with-non-null.test
index 1d0b16f38..ed8fb40df 100644
--- a/tests/nullability/with-non-null.test
+++ b/tests/nullability/with-non-null.test
@@ -4,8 +4,8 @@ class Foo {
     public int i;
 }
 
-void main() {
-    Foo? f = new Foo();
+void main () {
+    Foo? f = new Foo ();
     with (f) {
         i = 7;
     }
diff --git a/tests/objects/with-expression.vala b/tests/objects/with-expression.vala
index decffa17e..8e2821ded 100644
--- a/tests/objects/with-expression.vala
+++ b/tests/objects/with-expression.vala
@@ -1,39 +1,38 @@
 class Foo {
     public static int factory_called = 0;
-    public static Foo factory() {
+    public static Foo factory () {
         factory_called++;
-        return new Foo();
+        return new Foo ();
     }
 
     public static int method_called = 0;
-    public void method() {
+    public void method () {
         method_called++;
     }
 }
 
-void test() {
-    var foo = new Foo();
+void test () {
+    var foo = new Foo ();
     with (foo)
-        method();
-    
-    with (new Foo())
-        method();
-    
-    with (Foo.factory()) {
-        method();
-        method();
+        method ();
+
+    with (new Foo ())
+        method ();
+
+    with (Foo.factory ()) {
+        method ();
+        method ();
     }
 
     Foo[] arr = {foo, foo};
     with (arr[0]) {
-        method();
+        method ();
     }
 
     assert (Foo.method_called == 5);
     assert (Foo.factory_called == 1);
 }
 
-void main() {
-    test();
+void main () {
+    test ();
 }
-
diff --git a/tests/objects/with-instance.vala b/tests/objects/with-instance.vala
index 72f87965e..d8b285089 100644
--- a/tests/objects/with-instance.vala
+++ b/tests/objects/with-instance.vala
@@ -3,7 +3,7 @@ class Foo {
     public string prop { get; set; }
 
     public bool method_called = false;
-    public void method() {
+    public void method () {
         method_called = true;
     }
 }
@@ -13,23 +13,23 @@ class Bar : Foo { }
 class TestFoo {
     public int class_field;
 
-    public void test() {
-        var foo = new Foo();
+    public void test () {
+        var foo = new Foo ();
         var local_field = 0;
-    
-        with(foo) {
+
+        with (foo) {
             field = 10;
             prop = "prop";
-            method();
-    
+            method ();
+
             local_field = 20;
             class_field = 30;
         }
-    
+
         assert (foo.field == 10);
         assert (foo.prop == "prop");
         assert (foo.method_called);
-    
+
         assert (local_field == 20);
         assert (class_field == 30);
     }
@@ -39,29 +39,29 @@ class TestFoo {
 class TestBar {
     public int class_field;
 
-    public void test() {
-        var foo = new Bar();
+    public void test () {
+        var foo = new Bar ();
         var local_field = 0;
-    
-        with(foo) {
+
+        with (foo) {
             field = 10;
             prop = "prop";
-            method();
-    
+            method ();
+
             local_field = 20;
             class_field = 30;
         }
-    
+
         assert (foo.field == 10);
         assert (foo.prop == "prop");
         assert (foo.method_called);
-    
+
         assert (local_field == 20);
         assert (class_field == 30);
     }
 }
 
-void main() {
-    new TestFoo().test();
-    new TestBar().test();
-}
\ No newline at end of file
+void main () {
+    new TestFoo ().test ();
+    new TestBar ().test ();
+}
diff --git a/tests/objects/with-nested.vala b/tests/objects/with-nested.vala
index 8405213d6..387110868 100644
--- a/tests/objects/with-nested.vala
+++ b/tests/objects/with-nested.vala
@@ -9,9 +9,9 @@ class Bar {
 class Test {
     public int field;
 
-    void method_local() {
+    void method_local () {
         var field = 0;
-        var foo = new Foo();
+        var foo = new Foo ();
 
         with (foo) {
             field = 10;
@@ -24,10 +24,10 @@ class Test {
         assert (this.field == 30);
     }
 
-    void nested() {
+    void nested () {
         var field = 0;
-        var foo = new Foo();
-        var bar = new Bar();
+        var foo = new Foo ();
+        var bar = new Bar ();
 
         with (foo) {
             field = 100;
@@ -53,10 +53,10 @@ class Test {
         assert (this.field == 2000);*/
     }
 
-    void nested_useless() {
+    void nested_useless () {
         var field = 0;
-        var foo = new Foo();
-        var bar = new Bar();
+        var foo = new Foo ();
+        var bar = new Bar ();
 
         /*with (foo) {
             with.this.field = 10000;
@@ -79,10 +79,10 @@ class Test {
         assert (field == 50000);*/
     }
 
-    static int main() {
-        new Test().method_local();
-        new Test().nested();
-        new Test().nested_useless();
+    static int main () {
+        new Test ().method_local ();
+        new Test ().nested ();
+        new Test ().nested_useless ();
         return 0;
     }
-}
\ No newline at end of file
+}
diff --git a/tests/parser/with-embedded.vala b/tests/parser/with-embedded.vala
index 7dd82d7ea..c668e5afc 100644
--- a/tests/parser/with-embedded.vala
+++ b/tests/parser/with-embedded.vala
@@ -1,4 +1,4 @@
-void main() {
-    with(10)
-        assert (to_string() == "10");
-}
\ No newline at end of file
+void main () {
+    with (10)
+        assert (to_string () == "10");
+}
diff --git a/tests/parser/with-empty.vala b/tests/parser/with-empty.vala
index 1deb8ee9c..1a870b61f 100644
--- a/tests/parser/with-empty.vala
+++ b/tests/parser/with-empty.vala
@@ -1,3 +1,3 @@
-void main() {
-    with(10);
+void main () {
+    with (10);
 }
diff --git a/tests/parser/with-no-block.test b/tests/parser/with-no-block.test
index 0711acb14..237bd89d8 100644
--- a/tests/parser/with-no-block.test
+++ b/tests/parser/with-no-block.test
@@ -1,5 +1,5 @@
 Invalid Code
 
-void main() {
-    with(10)
+void main () {
+    with (10)
 }
\ No newline at end of file
diff --git a/tests/parser/with-no-expression.test b/tests/parser/with-no-expression.test
index 4d771a995..561176989 100644
--- a/tests/parser/with-no-expression.test
+++ b/tests/parser/with-no-expression.test
@@ -1,5 +1,5 @@
 Invalid Code
 
-void main() {
-    with() { }
+void main () {
+    with () { }
 }
diff --git a/tests/semantic/with-array.test b/tests/semantic/with-array.test
index fd70019f4..3b533ed37 100644
--- a/tests/semantic/with-array.test
+++ b/tests/semantic/with-array.test
@@ -1,6 +1,6 @@
 Invalid Code
 
-void main() {
+void main () {
     int[] arr = {1, 2, 3};
-    with(arr) { }
+    with (arr) { }
 }
diff --git a/tests/semantic/with-buildin.vala b/tests/semantic/with-buildin.vala
index a77fda8db..999554adf 100644
--- a/tests/semantic/with-buildin.vala
+++ b/tests/semantic/with-buildin.vala
@@ -1,4 +1,4 @@
-void main() {
+void main () {
     with (stdout) {
         assert (!eof ());
     }
diff --git a/tests/semantic/with-class.test b/tests/semantic/with-class.test
index bca006673..aa580f5b6 100644
--- a/tests/semantic/with-class.test
+++ b/tests/semantic/with-class.test
@@ -2,6 +2,6 @@ Invalid Code
 
 class Foo { }
 
-void main() {
+void main () {
     with (Foo) { }
 }
diff --git a/tests/semantic/with-compact.vala b/tests/semantic/with-compact.vala
index 21ef4fafb..1b00b4b89 100644
--- a/tests/semantic/with-compact.vala
+++ b/tests/semantic/with-compact.vala
@@ -3,8 +3,8 @@ class Cmpct {
     public int i;
 }
 
-void main() {
-    var c = new Cmpct();
+void main () {
+    var c = new Cmpct ();
     with (c) {
         i = 13;
     }
diff --git a/tests/semantic/with-dereferenced-pointer.vala b/tests/semantic/with-dereferenced-pointer.vala
index 30217f0e1..42fc20fd8 100644
--- a/tests/semantic/with-dereferenced-pointer.vala
+++ b/tests/semantic/with-dereferenced-pointer.vala
@@ -1,12 +1,12 @@
-class Foo { 
+class Foo {
     public int i;
 }
 
-void main() {
-    var f = new Foo();
+void main () {
+    var f = new Foo ();
     var p = &f;
 
-    with (*p) { 
+    with (*p) {
         i = 13;
     }
 
diff --git a/tests/semantic/with-enum-member.vala b/tests/semantic/with-enum-member.vala
index 8db9f2886..62e3e3cc4 100644
--- a/tests/semantic/with-enum-member.vala
+++ b/tests/semantic/with-enum-member.vala
@@ -2,6 +2,6 @@ enum Enumeration {
     FIRST
 }
 
-void main() {
+void main () {
     with (Enumeration.FIRST) { }
 }
diff --git a/tests/semantic/with-enum.test b/tests/semantic/with-enum.test
index dea687a72..93d6c9341 100644
--- a/tests/semantic/with-enum.test
+++ b/tests/semantic/with-enum.test
@@ -4,6 +4,6 @@ enum Enumeration {
     FIRST
 }
 
-void main() {
+void main () {
     with (Enumeration) { }
 }
diff --git a/tests/semantic/with-error-member.test b/tests/semantic/with-error-member.test
index 907e45f83..b7d9ecc81 100644
--- a/tests/semantic/with-error-member.test
+++ b/tests/semantic/with-error-member.test
@@ -4,7 +4,7 @@ errordomain Err {
     Error
 }
 
-void main() {
+void main () {
     var e = new Err.Error ("msg");
     with (e) { }
 }
diff --git a/tests/semantic/with-error.test b/tests/semantic/with-error.test
index 128c0c950..7ca467ba2 100644
--- a/tests/semantic/with-error.test
+++ b/tests/semantic/with-error.test
@@ -4,6 +4,6 @@ errordomain Err {
     ERROR
 }
 
-void main() {
+void main () {
     with (Err) { }
 }
diff --git a/tests/semantic/with-namespace.test b/tests/semantic/with-namespace.test
index dbbabe114..f138adb52 100644
--- a/tests/semantic/with-namespace.test
+++ b/tests/semantic/with-namespace.test
@@ -2,6 +2,6 @@ Invalid Code
 
 namespace Foo { }
 
-void main() {
+void main () {
     with (Foo) { }
 }
diff --git a/tests/semantic/with-no-such-member.test b/tests/semantic/with-no-such-member.test
index 07bcc6281..76807d501 100644
--- a/tests/semantic/with-no-such-member.test
+++ b/tests/semantic/with-no-such-member.test
@@ -2,7 +2,7 @@ Invalid Code
 
 class Foo { }
 
-void main() {
+void main () {
     with (new Foo()) {
         field = 100;
     }
diff --git a/tests/semantic/with-no-such-with-member.test b/tests/semantic/with-no-such-with-member.test
index d8fe1e239..20019b2c0 100644
--- a/tests/semantic/with-no-such-with-member.test
+++ b/tests/semantic/with-no-such-with-member.test
@@ -2,8 +2,8 @@ Invalid Code
 
 class Foo { }
 
-void main() {
-    with (new Foo()) {
+void main () {
+    with (new Foo ()) {
         with.field = 10;
     }
 }
diff --git a/tests/semantic/with-null.vala b/tests/semantic/with-null.vala
index 602ac5cef..dd108b256 100644
--- a/tests/semantic/with-null.vala
+++ b/tests/semantic/with-null.vala
@@ -2,9 +2,9 @@ class Foo {
     public int i;
 }
 
-void main() {
+void main () {
     Foo? f = null;
-    Process.exit(0);
+    Process.exit (0);
 
     with (f) {
         i = 7;
diff --git a/tests/semantic/with-pointer.test b/tests/semantic/with-pointer.test
index 2293904ef..0e1f19e68 100644
--- a/tests/semantic/with-pointer.test
+++ b/tests/semantic/with-pointer.test
@@ -1,6 +1,6 @@
 Invalid Code
 
-void main() {
+void main () {
     int i = 0;
-    with(&i) { }
+    with (&i) { }
 }
diff --git a/tests/semantic/with-string.vala b/tests/semantic/with-string.vala
index 262c786fc..133be17b6 100644
--- a/tests/semantic/with-string.vala
+++ b/tests/semantic/with-string.vala
@@ -1,4 +1,4 @@
-void main() {
+void main () {
     with ("string ") {
         assert (chomp () == "string");
     }
diff --git a/tests/semantic/with-value.vala b/tests/semantic/with-value.vala
index 5b028eab4..a0f111ad8 100644
--- a/tests/semantic/with-value.vala
+++ b/tests/semantic/with-value.vala
@@ -1,9 +1,9 @@
-void main() {
+void main () {
     int i = 0;
     string s;
 
-    with(i) { 
-        s = i.to_string();
+    with (i) {
+        s = i.to_string ();
     }
 
     assert (s == "0");
diff --git a/vala/valamemberaccess.vala b/vala/valamemberaccess.vala
index 9eed17ba6..181795533 100644
--- a/vala/valamemberaccess.vala
+++ b/vala/valamemberaccess.vala
@@ -287,8 +287,8 @@ public class Vala.MemberAccess : Expression {
                                        if (variable_type is PointerType) {
                                                variable_type = ((PointerType) variable_type).base_type;
                                        }
-                                       visited_types.add(variable_type);
-                                       
+                                       visited_types.add (variable_type);
+
                                        symbol_reference = variable_type.get_member (member_name);
                                        if (symbol_reference != null) {
                                                inner = new MemberAccess (null, w.with_variable.name, 
source_reference);
@@ -525,7 +525,7 @@ public class Vala.MemberAccess : Expression {
 
                        string visited_types_string = "";
                        foreach (var type in visited_types) {
-                               visited_types_string += " or `%s'".printf(type.to_string());
+                               visited_types_string += " or `%s'".printf (type.to_string ());
                        }
 
                        Report.error (source_reference, "The name `%s' does not exist in the context of 
`%s'%s%s".printf (member_name, base_type_name, base_type_package, visited_types_string));
diff --git a/vala/valascanner.vala b/vala/valascanner.vala
index 7a0e9fc59..f9fcb6041 100644
--- a/vala/valascanner.vala
+++ b/vala/valascanner.vala
@@ -386,7 +386,7 @@ public class Vala.Scanner {
                                if (matches (begin, "void")) return TokenType.VOID;
                                break;
                        case 'w':
-                               switch  (begin[1]) {
+                               switch (begin[1]) {
                                        case 'e':
                                                if (matches (begin, "weak")) return TokenType.WEAK;
                                                break;
diff --git a/vala/valawithstatement.vala b/vala/valawithstatement.vala
index e28fb7999..43bd91d71 100644
--- a/vala/valawithstatement.vala
+++ b/vala/valawithstatement.vala
@@ -82,25 +82,25 @@ public class Vala.WithStatement : Block {
                }
        }
 
-       private bool is_object_or_value_type(DataType? type) {
+       bool is_object_or_value_type (DataType? type) {
                if (type == null) {
                        return false;
                } else if (type is PointerType) {
                        var pointer_type = (PointerType) type;
-                       return is_object_or_value_type(pointer_type.base_type) && expression is 
PointerIndirection;                     
+                       return is_object_or_value_type (pointer_type.base_type) && expression is 
PointerIndirection;
                } else {
                        return type is ObjectType || type is ValueType;
                }
        }
 
-       private LocalVariable insert_local_variable_if_necessary() {
+       LocalVariable insert_local_variable_if_necessary () {
                LocalVariable local_var = expression.symbol_reference as LocalVariable;
                if (local_var == null) {
                        local_var = new LocalVariable (expression.value_type, "_with_local%d_".printf 
(next_with_id++), expression, source_reference);
                        body.insert_statement (0, new DeclarationStatement (local_var, source_reference));
                }
                return local_var;
-       } 
+       }
 
        public override bool check (CodeContext context) {
                if (checked) {
@@ -108,7 +108,7 @@ public class Vala.WithStatement : Block {
                }
 
                checked = true;
-               
+
                expression.check (context);
 
                if (!is_object_or_value_type (expression.value_type)) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]