LCOV - code coverage report
Current view: top level - gcc/rust/ast - rust-expression-yeast.cc (source / functions) Coverage Total Hit
Test: gcc.info Lines: 100.0 % 29 29
Test Date: 2026-11-14 16:39:50 Functions: 100.0 % 3 3
Legend: Lines:     hit not hit

            Line data    Source code
       1              : // Copyright (C) 2025-2026 Free Software Foundation, Inc.
       2              : 
       3              : // This file is part of GCC.
       4              : 
       5              : // GCC is free software; you can redistribute it and/or modify it under
       6              : // the terms of the GNU General Public License as published by the Free
       7              : // Software Foundation; either version 3, or (at your option) any later
       8              : // version.
       9              : 
      10              : // GCC is distributed in the hope that it will be useful, but WITHOUT ANY
      11              : // WARRANTY; without even the implied warranty of MERCHANTABILITY or
      12              : // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
      13              : // for more details.
      14              : 
      15              : // You should have received a copy of the GNU General Public License
      16              : // along with GCC; see the file COPYING3.  If not see
      17              : // <http://www.gnu.org/licenses/>.
      18              : 
      19              : #include "rust-expression-yeast.h"
      20              : #include "rust-ast-builder.h"
      21              : #include "rust-ast-visitor.h"
      22              : #include "rust-desugar-question-mark.h"
      23              : #include "rust-desugar-try-block.h"
      24              : #include "rust-desugar-for-loops.h"
      25              : #include "rust-desugar-while-let.h"
      26              : #include "rust-expr.h"
      27              : 
      28              : namespace Rust {
      29              : namespace AST {
      30              : 
      31              : void
      32         5134 : ExpressionYeast::go (AST::Crate &crate)
      33              : {
      34         5134 :   current_crate = crate;
      35              : 
      36         5134 :   PointerVisitor::visit (crate);
      37         5134 : }
      38              : 
      39              : void
      40         3548 : ExpressionYeast::dispatch_loops (std::unique_ptr<Expr> &loop_expr)
      41              : {
      42         3548 :   auto &loop = static_cast<BaseLoopExpr &> (*loop_expr.get ());
      43         3548 :   auto node_source = Builder::get_item_source (current_crate.value ());
      44              : 
      45         3548 :   switch (loop.get_loop_kind ())
      46              :     {
      47          883 :     case BaseLoopExpr::Kind::For:
      48          883 :       DesugarForLoops::go (loop_expr, node_source);
      49          883 :       break;
      50          208 :     case BaseLoopExpr::Kind::WhileLet:
      51          208 :       DesugarWhileLet::go (loop_expr, node_source);
      52          208 :       break;
      53              :     default:
      54              :       break;
      55              :     }
      56         3548 : }
      57              : 
      58              : void
      59      4535990 : ExpressionYeast::reseat (std::unique_ptr<Expr> &expr)
      60              : {
      61      4535990 :   auto node_source = Builder::get_item_source (current_crate.value ());
      62              : 
      63      4535990 :   switch (expr->get_expr_kind ())
      64              :     {
      65         1592 :     case Expr::Kind::ErrorPropagation:
      66         1592 :       DesugarQuestionMark::go (expr, node_source);
      67         1592 :       break;
      68          241 :     case Expr::Kind::Try:
      69          241 :       DesugarTryBlock::go (expr, node_source);
      70          241 :       break;
      71         3548 :     case Expr::Kind::Loop:
      72         3548 :       dispatch_loops (expr);
      73         3548 :       break;
      74              : 
      75              :     default:
      76              :       break;
      77              :     }
      78              : 
      79      4535990 :   visit (expr);
      80      4535990 : }
      81              : 
      82              : } // namespace AST
      83              : } // namespace Rust
        

Generated by: LCOV version 2.5.0-beta

LCOV profile is generated on x86_64 machine using following configure options: configure --disable-bootstrap --enable-coverage=opt --enable-languages=c,c++,fortran,go,jit,lto,rust,m2 --enable-host-shared. GCC test suite is run with the built compiler.