[vala/wip/issue/327: 26/43] Cleaned up unnecessary crap



commit c1c9ce3afb08b1252d1cccbac6f9409c32048650
Author: Nick Schrader <nick schrader mailbox org>
Date:   Fri Mar 27 22:41:43 2020 -0300

    Cleaned up unnecessary crap

 .gitignore                     |  2 +
 vala/valamemberaccess.vala     | 28 ++------------
 vala/valaparser.vala           |  1 +
 vala/valascanner.vala          |  1 +
 vala/valasemanticanalyzer.vala | 12 +-----
 vala/valasymbolresolver.vala   | 25 ++----------
 vala/valatokentype.vala        |  1 +
 vala/valawithstatement.vala    | 86 +-----------------------------------------
 8 files changed, 14 insertions(+), 142 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 1f8def72c..937a6fde6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
 Makefile.in
 Makefile
+Makecache
 *.o
 *.lo
 *.la
@@ -31,6 +32,7 @@ stamp-h1
 .tarball-version
 .version
 .DS_Store
+.vscode
 
 *.gcda
 *.gcno
diff --git a/vala/valamemberaccess.vala b/vala/valamemberaccess.vala
index 45ee4b83c..3c1145fc4 100644
--- a/vala/valamemberaccess.vala
+++ b/vala/valamemberaccess.vala
@@ -225,7 +225,6 @@ public class Vala.MemberAccess : Expression {
                bool may_access_klass_members = false;
 
                symbol_reference = null;
-               var is_with = false;
 
                if (qualified) {
                        base_symbol = context.root;
@@ -278,9 +277,6 @@ public class Vala.MemberAccess : Expression {
                                                may_access_instance_members = (m.binding == 
MemberBinding.INSTANCE);
                                                may_access_klass_members = (m.binding != 
MemberBinding.STATIC);
                                                method_found = true;
-                                       } else if (sym is WithStatement) {
-                                               unowned WithStatement w = (WithStatement) sym;
-                                               stdout.printf("Got ittttttttttttttttttttttttttttt\n");
                                        }
                                }
 
@@ -313,24 +309,12 @@ public class Vala.MemberAccess : Expression {
 
                                if (symbol_reference == null && sym is WithStatement) {
                                        unowned WithStatement w = (WithStatement) sym;
-                                       var e = w.expression;
-                                       base_symbol = e.value_type.type_symbol;
-                                       symbol_reference = e.value_type.get_member (member_name);
+                                       inner = w.expression;
+                                       symbol_reference = inner.value_type.get_member (member_name);
                                        may_access_instance_members = true;
                                        may_access_klass_members = true;
-                                       is_with = true;
-                                       inner = e;
                                }
 
-                               var x = "null";
-                               if (sym != null)
-                                       x = Type.from_instance(sym).name();
-
-                               var y = "null";
-                               if (sym.parent_symbol != null)
-                                       y = Type.from_instance(sym.parent_symbol).name();
-       
-                               stdout.printf("sym: %s, parent %s\n", x, y);
                                sym = sym.parent_symbol;
                        }
 
@@ -569,8 +553,6 @@ public class Vala.MemberAccess : Expression {
                                                method.add_captured_variable (local);
                                        }
                                        sym = sym.parent_symbol;
-                                       if (sym == null) // DEBUG infinite loop
-                                               return false;
                                }
 
                                local.captured = true;
@@ -879,7 +861,7 @@ public class Vala.MemberAccess : Expression {
                        }
                } else {
                        // implicit this access
-                       if (instance && inner == null && !is_with) {
+                       if (instance && inner == null) {
                                inner = new MemberAccess (null, "this", source_reference);
                                inner.value_type = this_parameter.variable_type.copy ();
                                inner.value_type.value_owned = false;
@@ -932,12 +914,10 @@ public class Vala.MemberAccess : Expression {
                                }
                        } else if (symbol_reference is Property
                            && instance && symbol_reference.parent_symbol != null) {
-                                       if (inner != null)
-                                               inner.target_type = SemanticAnalyzer.get_data_type_for_symbol 
(symbol_reference.parent_symbol);
+                               inner.target_type = SemanticAnalyzer.get_data_type_for_symbol 
(symbol_reference.parent_symbol);
                        } else if ((symbol_reference is Field || symbol_reference is Signal)
                            && instance && symbol_reference.parent_symbol != null) {
                                var parent_type = SemanticAnalyzer.get_data_type_for_symbol 
(symbol_reference.parent_symbol);
-                               if (inner != null)
                                        inner.target_type = parent_type.get_actual_type (inner.value_type, 
null, this);
                        }
                }
diff --git a/vala/valaparser.vala b/vala/valaparser.vala
index a45df7ce7..9df06accf 100644
--- a/vala/valaparser.vala
+++ b/vala/valaparser.vala
@@ -3712,3 +3712,4 @@ public errordomain Vala.ParseError {
        FAILED,
        SYNTAX
 }
+
diff --git a/vala/valascanner.vala b/vala/valascanner.vala
index 7b6881396..7a0e9fc59 100644
--- a/vala/valascanner.vala
+++ b/vala/valascanner.vala
@@ -1686,3 +1686,4 @@ public class Vala.Scanner {
                return comment;
        }
 }
+
diff --git a/vala/valasemanticanalyzer.vala b/vala/valasemanticanalyzer.vala
index 1ffc09585..cbb806ea4 100644
--- a/vala/valasemanticanalyzer.vala
+++ b/vala/valasemanticanalyzer.vala
@@ -318,17 +318,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
                        return result;
                }
 
-               /*if (sym is WithStatement) {
-                       unowned WithStatement w = (WithStatement) sym;
-                       var lv = w.expression;
-                       var base_symbol = lv.value_type.type_symbol;
-                       var symbol_reference = lv.value_type.get_member (name);
-                       //  var vt = get_value_type_for_symbol(real_sym);
-                       //  var vt_sym = x.symbol;
-                       //  stdout.printf("Resolved with statement: %s, value type: %s, value type symbol: 
%s\n", Type.from_instance(real_sym).name(), Type.from_instance(vt).name(), Type.from_instance(vt_sym).name());
-                       //  return symbol_lookup_inherited(vt_sym, name);
-                       return symbol_reference;
-               } else */ if (sym is Class) {
+               if (sym is Class) {
                        unowned Class cl = (Class) sym;
                        // first check interfaces without prerequisites
                        // (prerequisites can be assumed to be met already)
diff --git a/vala/valasymbolresolver.vala b/vala/valasymbolresolver.vala
index 47370658b..28365127a 100644
--- a/vala/valasymbolresolver.vala
+++ b/vala/valasymbolresolver.vala
@@ -15,7 +15,9 @@
 
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110visit
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
+ *
+ * Author:
  *     Jürg Billeter <j bitron ch>
  *     Raffaele Sandrini <raffaele sandrini ch>
  */
@@ -52,9 +54,6 @@ public class Vala.SymbolResolver : CodeVisitor {
        }
 
        public override void visit_class (Class cl) {
-               if (cl.name == "Foo") {
-                       stdout.printf("visit %s\n", cl.name);
-               }
                if (cl.checked) {
                        return;
                }
@@ -482,25 +481,7 @@ public class Vala.SymbolResolver : CodeVisitor {
        }
 
        public override void visit_with_statement (WithStatement stmt) {
-               //  var unresolved = UnresolvedSymbol.new_from_expression (stmt.expression);
-               //  stdout.printf("Unresolved: %s\n", unresolved.to_string());
-               //  var symbol = resolve_symbol(unresolved);
-
-               //  var old_scope = current_scope;
-               //  current_scope = symbol.scope;
-
-               //  current_scope = old_scope;
-
-               //  if (stmt.checked) {
-               //      return;
-               //  }
-
-               //  var old_scope = current_scope;
-               //  //current_scope = stmt.innerScope;
-
                stmt.accept_children (this);
-
-               //  current_scope = old_scope;
        }
 
        public override void visit_expression_statement (ExpressionStatement stmt) {
diff --git a/vala/valatokentype.vala b/vala/valatokentype.vala
index 08fbb9840..7124c049a 100644
--- a/vala/valatokentype.vala
+++ b/vala/valatokentype.vala
@@ -292,3 +292,4 @@ public enum Vala.TokenType {
                }
        }
 }
+
diff --git a/vala/valawithstatement.vala b/vala/valawithstatement.vala
index 6908f62f4..98be64cae 100644
--- a/vala/valawithstatement.vala
+++ b/vala/valawithstatement.vala
@@ -57,18 +57,11 @@ public class Vala.WithStatement : Symbol, Statement {
                }
        }
 
-       /* public Scope scope {
-               get { 
-                       stdout.printf("with scope\n");
-                       return expression.symbol_reference.scope; 
-               }
-       } */
-
        private Expression _expression;
        private Block _body;
 
        public WithStatement (Expression expression, Block? body, SourceReference? source_reference = null) {
-               base("with", source_reference);
+               base(null, source_reference);
                this.body = body;
                this.source_reference = source_reference;
                this.expression = expression;
@@ -99,95 +92,18 @@ public class Vala.WithStatement : Symbol, Statement {
                expression.check(context);
 
                var old_symbol = context.analyzer.current_symbol;
-               var old_insert_block = context.analyzer.insert_block;
                owner = context.analyzer.current_symbol.scope;
-               //owner = expression.symbol_reference.scope;
                context.analyzer.current_symbol = this;
 
                stdout.printf("With expression: %s\n", Type.from_instance(expression).name());
-
-               /*var sr = expression.symbol_reference;
-               var sc = sr.scope;
-               var st = sc.get_symbol_table();
-               var iter = st.map_iterator();
-               while (iter.next()) {
-                       scope.add(iter.get_key(), iter.get_value());
-                       stdout.printf("Symbol %s\n", iter.get_key());
-               }*/
-
-               //context.analyzer.current_symbol = expression.symbol_reference;
-               //context.analyzer.insert_block = body;
-
-               //  var cc = context.analyzer.current_class;
-               //  var cs = context.analyzer.current_symbol;
-               //  var cm = context.analyzer.current_method_or_property_accessor;
-
-               //  stdout.printf("cs %s, cc %s, cm %s\n", cc.name, cs.name, cm.name);
-
-               //body.parent_node = expression;
                body.check(context);
 
-               //context.analyzer.current_symbol = old_symbol;
-               //context.analyzer.insert_block = old_insert_block;
                context.analyzer.current_symbol = old_symbol;
                return true;
-               // Ehh change context somehow...
-               //  if (body != null) {
-               //      // if the statement isn't empty, it is converted into a try statement
-
-               //      var fin_body = new Block (source_reference);
-               //      fin_body.add_statement (new UnlockStatement (resource, source_reference));
-
-               //      var block = new Block (source_reference);
-               //      block.add_statement (new LockStatement (resource, null, source_reference));
-               //      block.add_statement (new TryStatement (body, fin_body, source_reference));
-
-               //      var parent_block = (Block) parent_node;
-               //      parent_block.replace_statement (this, block);
-
-               //      return block.check (context);
-               //  }
-
-               //  if (checked) {
-               //      return !error;
-               //  }
-
-               //  checked = true;
-
-               //  resource.check (context);
-
-               //  /* resource must be a member access and denote a Lockable */
-               //  if (!(resource is MemberAccess && resource.symbol_reference is Lockable)) {
-               //      error = true;
-               //      resource.error = true;
-               //      Report.error (resource.source_reference, "Expression is either not a member access or 
does not denote a lockable member");
-               //      return false;
-               //  }
-
-               //  /* parent symbol must be the current class */
-               //  if (resource.symbol_reference.parent_symbol != context.analyzer.current_class) {
-               //      error = true;
-               //      resource.error = true;
-               //      Report.error (resource.source_reference, "Only members of the current class are 
lockable");
-               //      return false;
-               //  }
-
-               //  /* parent class must not be compact */
-               //  if (context.analyzer.current_class.is_compact) {
-               //      error = true;
-               //      resource.error = true;
-               //      Report.error (resource.source_reference, "Only members of the non-compact classes are 
lockable");
-               //      return false;
-               //  }
-
-               //  ((Lockable) resource.symbol_reference).lock_used = true;
-
-               //  return !error;
        }
 
        public override void emit (CodeGenerator codegen) {
                expression.emit (codegen);
                body.emit (codegen);
-               //codegen.visit_with_statement (this);
        }
 }


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