LCOV - code coverage report
Current view: top level - vala - valatraversevisitor.vala (source / functions) Coverage Total Hit
Test: vala 0.57.0.298-a8cae1 Lines: 58.8 % 187 110
Test Date: 2024-04-25 11:34:36 Functions: - 0 0

            Line data    Source code
       1              : /* valatraversevisitor.vala
       2              :  *
       3              :  * Copyright (C) 2012  Luca Bruno
       4              :  *
       5              :  * This library is free software; you can redistribute it and/or
       6              :  * modify it under the terms of the GNU Lesser General Public
       7              :  * License as published by the Free Software Foundation; either
       8              :  * version 2.1 of the License, or (at your option) any later version.
       9              : 
      10              :  * This library is distributed in the hope that it will be useful,
      11              :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      12              :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      13              :  * Lesser General Public License for more details.
      14              : 
      15              :  * You should have received a copy of the GNU Lesser General Public
      16              :  * License along with this library; if not, write to the Free Software
      17              :  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
      18              :  *
      19              :  * Author:
      20              :  *      Luca Bruno <lucabru@src.gnome.org>
      21              :  */
      22              : 
      23              : /**
      24              :  * Code visitor for traversing the tree with a simple callback
      25              :  */
      26         1423 : public class Vala.TraverseVisitor : CodeVisitor {
      27      6944248 :         private TraverseFunc func;
      28              : 
      29     13888496 :         public TraverseVisitor (owned TraverseFunc func) {
      30      6944248 :                 this.func = (owned) func;
      31              :         }
      32              : 
      33            0 :         public override void visit_namespace (Namespace ns) {
      34            0 :                 if (func (ns) == TraverseStatus.CONTINUE) {
      35            0 :                         ns.accept_children (this);
      36              :                 }
      37              :         }
      38              : 
      39            0 :         public override void visit_class (Class cl) {
      40            0 :                 if (func (cl) == TraverseStatus.CONTINUE) {
      41            0 :                         cl.accept_children (this);
      42              :                 }
      43              :         }
      44              : 
      45            0 :         public override void visit_struct (Struct st) {
      46            0 :                 if (func (st) == TraverseStatus.CONTINUE) {
      47            0 :                         st.accept_children (this);
      48              :                 }
      49              :         }
      50              : 
      51            0 :         public override void visit_interface (Interface iface) {
      52            0 :                 if (func (iface) == TraverseStatus.CONTINUE) {
      53            0 :                         iface.accept_children (this);
      54              :                 }
      55              :         }
      56              : 
      57            0 :         public override void visit_enum (Enum en) {
      58            0 :                 if (func (en) == TraverseStatus.CONTINUE) {
      59            0 :                         en.accept_children (this);
      60              :                 }
      61              :         }
      62              : 
      63            0 :         public override void visit_enum_value (EnumValue ev) {
      64            0 :                 if (func (ev) == TraverseStatus.CONTINUE) {
      65            0 :                         ev.accept_children (this);
      66              :                 }
      67              :         }
      68              : 
      69            0 :         public override void visit_error_domain (ErrorDomain edomain) {
      70            0 :                 if (func (edomain) == TraverseStatus.CONTINUE) {
      71            0 :                         edomain.accept_children (this);
      72              :                 }
      73              :         }
      74              : 
      75            0 :         public override void visit_error_code (ErrorCode ecode) {
      76            0 :                 if (func (ecode) == TraverseStatus.CONTINUE) {
      77            0 :                         ecode.accept_children (this);
      78              :                 }
      79              :         }
      80              : 
      81            0 :         public override void visit_delegate (Delegate d) {
      82            0 :                 if (func (d) == TraverseStatus.CONTINUE) {
      83            0 :                         d.accept_children (this);
      84              :                 }
      85              :         }
      86              : 
      87            0 :         public override void visit_constant (Constant c) {
      88            0 :                 if (func (c) == TraverseStatus.CONTINUE) {
      89            0 :                         c.accept_children (this);
      90              :                 }
      91              :         }
      92              : 
      93            0 :         public override void visit_field (Field f) {
      94            0 :                 if (func (f) == TraverseStatus.CONTINUE) {
      95            0 :                         f.accept_children (this);
      96              :                 }
      97              :         }
      98              : 
      99          307 :         public override void visit_method (Method m) {
     100          307 :                 if (func (m) == TraverseStatus.CONTINUE) {
     101          307 :                         m.accept_children (this);
     102              :                 }
     103              :         }
     104              : 
     105            0 :         public override void visit_creation_method (CreationMethod m) {
     106            0 :                 if (func (m) == TraverseStatus.CONTINUE) {
     107            0 :                         m.accept_children (this);
     108              :                 }
     109              :         }
     110              : 
     111          147 :         public override void visit_formal_parameter (Parameter p) {
     112          147 :                 if (func (p) == TraverseStatus.CONTINUE) {
     113          147 :                         p.accept_children (this);
     114              :                 }
     115              :         }
     116              : 
     117            0 :         public override void visit_property (Property prop) {
     118            0 :                 if (func (prop) == TraverseStatus.CONTINUE) {
     119            0 :                         prop.accept_children (this);
     120              :                 }
     121              :         }
     122              : 
     123            0 :         public override void visit_property_accessor (PropertyAccessor acc) {
     124            0 :                 if (func (acc) == TraverseStatus.CONTINUE) {
     125            0 :                         acc.accept_children (this);
     126              :                 }
     127              :         }
     128              : 
     129            0 :         public override void visit_signal (Signal sig) {
     130            0 :                 if (func (sig) == TraverseStatus.CONTINUE) {
     131            0 :                         sig.accept_children (this);
     132              :                 }
     133              :         }
     134              : 
     135            0 :         public override void visit_constructor (Constructor c) {
     136            0 :                 if (func (c) == TraverseStatus.CONTINUE) {
     137            0 :                         c.accept_children (this);
     138              :                 }
     139              :         }
     140              : 
     141            0 :         public override void visit_destructor (Destructor d) {
     142            0 :                 if (func (d) == TraverseStatus.CONTINUE) {
     143            0 :                         d.accept_children (this);
     144              :                 }
     145              :         }
     146              : 
     147         8126 :         public override void visit_block (Block b) {
     148         8126 :                 if (func (b) == TraverseStatus.CONTINUE) {
     149         8126 :                         b.accept_children (this);
     150              :                 }
     151              :         }
     152              : 
     153     14870266 :         public override void visit_data_type (DataType data_type) {
     154     14870266 :                 if (func (data_type) == TraverseStatus.CONTINUE) {
     155     14219855 :                         data_type.accept_children (this);
     156              :                 }
     157              :         }
     158              : 
     159          424 :         public override void visit_declaration_statement (DeclarationStatement stmt) {
     160          424 :                 if (func (stmt) == TraverseStatus.CONTINUE) {
     161          424 :                         stmt.accept_children (this);
     162              :                 }
     163              :         }
     164              : 
     165          424 :         public override void visit_local_variable (LocalVariable local) {
     166          424 :                 if (func (local) == TraverseStatus.CONTINUE) {
     167          424 :                         local.accept_children (this);
     168              :                 }
     169              :         }
     170              : 
     171        13015 :         public override void visit_initializer_list (InitializerList list) {
     172        13015 :                 if (func (list) == TraverseStatus.CONTINUE) {
     173        13015 :                         list.accept_children (this);
     174              :                 }
     175              :         }
     176              : 
     177         1386 :         public override void visit_expression_statement (ExpressionStatement stmt) {
     178         1386 :                 if (func (stmt) == TraverseStatus.CONTINUE) {
     179         1386 :                         stmt.accept_children (this);
     180              :                 }
     181              :         }
     182              : 
     183           94 :         public override void visit_if_statement (IfStatement stmt) {
     184           94 :                 if (func (stmt) == TraverseStatus.CONTINUE) {
     185           94 :                         stmt.accept_children (this);
     186              :                 }
     187              :         }
     188              : 
     189            4 :         public override void visit_switch_statement (SwitchStatement stmt) {
     190            4 :                 if (func (stmt) == TraverseStatus.CONTINUE) {
     191            4 :                         stmt.accept_children (this);
     192              :                 }
     193              :         }
     194              : 
     195            8 :         public override void visit_switch_section (SwitchSection section) {
     196            8 :                 if (func (section) == TraverseStatus.CONTINUE) {
     197            8 :                         section.accept_children (this);
     198              :                 }
     199              :         }
     200              : 
     201            8 :         public override void visit_switch_label (SwitchLabel label) {
     202            8 :                 if (func (label) == TraverseStatus.CONTINUE) {
     203            8 :                         label.accept_children (this);
     204              :                 }
     205              :         }
     206              : 
     207            1 :         public override void visit_loop_statement (LoopStatement loop) {
     208            1 :                 if (func (loop) == TraverseStatus.CONTINUE) {
     209            1 :                         loop.accept_children (this);
     210              :                 }
     211              :         }
     212              : 
     213            2 :         public override void visit_while_statement (WhileStatement stmt) {
     214            2 :                 if (func (stmt) == TraverseStatus.CONTINUE) {
     215            2 :                         stmt.accept_children (this);
     216              :                 }
     217              :         }
     218              : 
     219            0 :         public override void visit_do_statement (DoStatement stmt) {
     220            0 :                 if (func (stmt) == TraverseStatus.CONTINUE) {
     221            0 :                         stmt.accept_children (this);
     222              :                 }
     223              :         }
     224              : 
     225            0 :         public override void visit_for_statement (ForStatement stmt) {
     226            0 :                 if (func (stmt) == TraverseStatus.CONTINUE) {
     227            0 :                         stmt.accept_children (this);
     228              :                 }
     229              :         }
     230              : 
     231            0 :         public override void visit_foreach_statement (ForeachStatement stmt) {
     232            0 :                 if (func (stmt) == TraverseStatus.CONTINUE) {
     233            0 :                         stmt.accept_children (this);
     234              :                 }
     235              :         }
     236              : 
     237            3 :         public override void visit_break_statement (BreakStatement stmt) {
     238            3 :                 if (func (stmt) == TraverseStatus.CONTINUE) {
     239            3 :                         stmt.accept_children (this);
     240              :                 }
     241              :         }
     242              : 
     243            0 :         public override void visit_continue_statement (ContinueStatement stmt) {
     244            0 :                 if (func (stmt) == TraverseStatus.CONTINUE) {
     245            0 :                         stmt.accept_children (this);
     246              :                 }
     247              :         }
     248              : 
     249         7107 :         public override void visit_return_statement (ReturnStatement stmt) {
     250         7107 :                 if (func (stmt) == TraverseStatus.CONTINUE) {
     251         7107 :                         stmt.accept_children (this);
     252              :                 }
     253              :         }
     254              : 
     255            1 :         public override void visit_yield_statement (YieldStatement stmt) {
     256            1 :                 if (func (stmt) == TraverseStatus.CONTINUE) {
     257            0 :                         stmt.accept_children (this);
     258              :                 }
     259              :         }
     260              : 
     261            0 :         public override void visit_throw_statement (ThrowStatement stmt) {
     262            0 :                 if (func (stmt) == TraverseStatus.CONTINUE) {
     263            0 :                         stmt.accept_children (this);
     264              :                 }
     265              :         }
     266              : 
     267           25 :         public override void visit_try_statement (TryStatement stmt) {
     268           25 :                 if (func (stmt) == TraverseStatus.CONTINUE) {
     269           25 :                         stmt.accept_children (this);
     270              :                 }
     271              :         }
     272              : 
     273           25 :         public override void visit_catch_clause (CatchClause clause) {
     274           25 :                 if (func (clause) == TraverseStatus.CONTINUE) {
     275           25 :                         clause.accept_children (this);
     276              :                 }
     277              :         }
     278              : 
     279            0 :         public override void visit_lock_statement (LockStatement stmt) {
     280            0 :                 if (func (stmt) == TraverseStatus.CONTINUE) {
     281            0 :                         stmt.accept_children (this);
     282              :                 }
     283              :         }
     284              : 
     285            0 :         public override void visit_unlock_statement (UnlockStatement stmt) {
     286            0 :                 if (func (stmt) == TraverseStatus.CONTINUE) {
     287            0 :                         stmt.accept_children (this);
     288              :                 }
     289              :         }
     290              : 
     291            1 :         public override void visit_with_statement (WithStatement stmt) {
     292            1 :                 if (func (stmt) == TraverseStatus.CONTINUE) {
     293            1 :                         stmt.accept_children (this);
     294              :                 }
     295              :         }
     296              : 
     297            0 :         public override void visit_delete_statement (DeleteStatement stmt) {
     298            0 :                 if (func (stmt) == TraverseStatus.CONTINUE) {
     299            0 :                         stmt.accept_children (this);
     300              :                 }
     301              :         }
     302              : 
     303      4166707 :         public override void visit_member_access (MemberAccess expr) {
     304      4166707 :                 if (func (expr) == TraverseStatus.CONTINUE) {
     305      4166707 :                         expr.accept_children (this);
     306              :                 }
     307              :         }
     308              : 
     309       342875 :         public override void visit_assignment (Assignment expr) {
     310       342875 :                 if (func (expr) == TraverseStatus.CONTINUE) {
     311       342875 :                         expr.accept_children (this);
     312              :                 }
     313              :         }
     314              : 
     315       542171 :         public override void visit_method_call (MethodCall expr) {
     316       542171 :                 if (func (expr) == TraverseStatus.CONTINUE) {
     317       542170 :                         expr.accept_children (this);
     318              :                 }
     319              :         }
     320              : 
     321         8694 :         public override void visit_conditional_expression (ConditionalExpression expr) {
     322         8694 :                 if (func (expr) == TraverseStatus.CONTINUE) {
     323         8694 :                         expr.accept_children (this);
     324              :                 }
     325              :         }
     326              : 
     327       656877 :         public override void visit_binary_expression (BinaryExpression expr) {
     328       656877 :                 if (func (expr) == TraverseStatus.CONTINUE) {
     329       656877 :                         expr.accept_children (this);
     330              :                 }
     331              :         }
     332              : 
     333       105486 :         public override void visit_unary_expression (UnaryExpression expr) {
     334       105486 :                 if (func (expr) == TraverseStatus.CONTINUE) {
     335       104499 :                         expr.accept_children (this);
     336              :                 }
     337              :         }
     338              : 
     339        24132 :         public override void visit_reference_transfer_expression (ReferenceTransferExpression expr) {
     340        24132 :                 if (func (expr) == TraverseStatus.CONTINUE) {
     341        24132 :                         expr.accept_children (this);
     342              :                 }
     343              :         }
     344              : 
     345        43007 :         public override void visit_object_creation_expression (ObjectCreationExpression expr) {
     346        43007 :                 if (func (expr) == TraverseStatus.CONTINUE) {
     347        43006 :                         expr.accept_children (this);
     348              :                 }
     349              :         }
     350              : 
     351         6224 :         public override void visit_postfix_expression (PostfixExpression expr) {
     352         6224 :                 if (func (expr) == TraverseStatus.CONTINUE) {
     353            0 :                         expr.accept_children (this);
     354              :                 }
     355              :         }
     356              : 
     357         6770 :         public override void visit_array_creation_expression (ArrayCreationExpression expr) {
     358         6770 :                 if (func (expr) == TraverseStatus.CONTINUE) {
     359         6770 :                         expr.accept_children (this);
     360              :                 }
     361              :         }
     362              : 
     363       452681 :         public override void visit_cast_expression (CastExpression expr) {
     364       452681 :                 if (func (expr) == TraverseStatus.CONTINUE) {
     365       452681 :                         expr.accept_children (this);
     366              :                 }
     367              :         }
     368              : 
     369        39613 :         public override void visit_element_access (ElementAccess expr) {
     370        39613 :                 if (func (expr) == TraverseStatus.CONTINUE) {
     371        39613 :                         expr.accept_children (this);
     372              :                 }
     373              :         }
     374              : 
     375        10766 :         public override void visit_lambda_expression (LambdaExpression expr) {
     376        10766 :                 if (func (expr) == TraverseStatus.CONTINUE) {
     377        10766 :                         expr.accept_children (this);
     378              :                 }
     379              :         }
     380              : 
     381        48146 :         public override void visit_pointer_indirection (PointerIndirection expr) {
     382        48146 :                 if (func (expr) == TraverseStatus.CONTINUE) {
     383        48146 :                         expr.accept_children (this);
     384              :                 }
     385              :         }
     386              : 
     387         2875 :         public override void visit_addressof_expression (AddressofExpression expr) {
     388         2875 :                 if (func (expr) == TraverseStatus.CONTINUE) {
     389         2875 :                         expr.accept_children (this);
     390              :                 }
     391              :         }
     392              : 
     393           73 :         public override void visit_slice_expression (SliceExpression expr) {
     394           73 :                 if (func (expr) == TraverseStatus.CONTINUE) {
     395           73 :                         expr.accept_children (this);
     396              :                 }
     397              :         }
     398              : }
     399              : 
     400              : public enum Vala.TraverseStatus {
     401              :         STOP,
     402              :         CONTINUE
     403              : }
     404              : 
     405              : public delegate Vala.TraverseStatus Vala.TraverseFunc (CodeNode node);
        

Generated by: LCOV version 2.0-1