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

            Line data    Source code
       1              : /* valanamedargument.vala
       2              :  *
       3              :  * Copyright (C) 2009-2010  Jürg Billeter
       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              :  *      Jürg Billeter <j@bitron.ch>
      21              :  */
      22              : 
      23           24 : public class Vala.NamedArgument : Expression {
      24           63 :         public string name { get; private set; }
      25              : 
      26              :         public Expression inner {
      27          168 :                 get {
      28          168 :                         return _inner;
      29              :                 }
      30           14 :                 private set {
      31           14 :                         _inner = value;
      32           14 :                         _inner.parent_node = this;
      33              :                 }
      34              :         }
      35              : 
      36           14 :         private Expression _inner;
      37              : 
      38           42 :         public NamedArgument (string name, Expression inner, SourceReference? source_reference = null) {
      39           14 :                 this.name = name;
      40           14 :                 this.inner = inner;
      41           14 :                 this.source_reference = source_reference;
      42              :         }
      43              : 
      44           43 :         public override void accept (CodeVisitor visitor) {
      45           43 :                 visitor.visit_named_argument (this);
      46              : 
      47           43 :                 visitor.visit_expression (this);
      48              :         }
      49              : 
      50           26 :         public override void accept_children (CodeVisitor visitor) {
      51           26 :                 inner.accept (visitor);
      52              :         }
      53              : 
      54            0 :         public override void replace_expression (Expression old_node, Expression new_node) {
      55            0 :                 if (inner == old_node) {
      56            0 :                         inner = new_node;
      57              :                 }
      58              :         }
      59              : 
      60            0 :         public override bool is_pure () {
      61            0 :                 return inner.is_pure ();
      62              :         }
      63              : 
      64           14 :         public override bool check (CodeContext context) {
      65           14 :                 if (checked) {
      66            0 :                         return !error;
      67              :                 }
      68              : 
      69           14 :                 checked = true;
      70              : 
      71           14 :                 inner.target_type = target_type;
      72              : 
      73           14 :                 if (!inner.check (context)) {
      74            0 :                         error = true;
      75            0 :                         return false;
      76              :                 }
      77              : 
      78           14 :                 inner.target_type = inner.value_type;
      79           14 :                 value_type = inner.value_type;
      80              : 
      81           14 :                 return !error;
      82              :         }
      83              : 
      84           12 :         public override void emit (CodeGenerator codegen) {
      85           12 :                 inner.emit (codegen);
      86              : 
      87           12 :                 codegen.visit_named_argument (this);
      88              : 
      89           12 :                 codegen.visit_expression (this);
      90              :         }
      91              : 
      92           36 :         public override void get_defined_variables (Collection<Variable> collection) {
      93           36 :                 inner.get_defined_variables (collection);
      94              :         }
      95              : 
      96           12 :         public override void get_used_variables (Collection<Variable> collection) {
      97           12 :                 inner.get_used_variables (collection);
      98              :         }
      99              : }
        

Generated by: LCOV version 2.0-1