(root)/
gcc-13.2.0/
gcc/
rust/
backend/
rust-compile-resolve-path.h
       1  // Copyright (C) 2020-2023 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  #ifndef RUST_COMPILE_RESOLVE_PATH
      20  #define RUST_COMPILE_RESOLVE_PATH
      21  
      22  #include "rust-compile-base.h"
      23  
      24  namespace Rust {
      25  namespace Compile {
      26  
      27  class ResolvePathRef : public HIRCompileBase, public HIR::HIRPatternVisitor
      28  {
      29  public:
      30    static tree Compile (HIR::QualifiedPathInExpression &expr, Context *ctx)
      31    {
      32      ResolvePathRef resolver (ctx);
      33      expr.accept_vis (resolver);
      34      return resolver.resolved;
      35    }
      36  
      37    static tree Compile (HIR::PathInExpression &expr, Context *ctx)
      38    {
      39      ResolvePathRef resolver (ctx);
      40      expr.accept_vis (resolver);
      41      return resolver.resolved;
      42    }
      43  
      44    void visit (HIR::PathInExpression &expr) override;
      45    void visit (HIR::QualifiedPathInExpression &expr) override;
      46  
      47    // Empty visit for unused Pattern HIR nodes.
      48    void visit (HIR::IdentifierPattern &) override {}
      49    void visit (HIR::LiteralPattern &) override {}
      50    void visit (HIR::RangePattern &) override {}
      51    void visit (HIR::ReferencePattern &) override {}
      52    void visit (HIR::SlicePattern &) override {}
      53    void visit (HIR::StructPattern &) override {}
      54    void visit (HIR::TuplePattern &) override {}
      55    void visit (HIR::TupleStructPattern &) override {}
      56    void visit (HIR::WildcardPattern &) override {}
      57  
      58    ResolvePathRef (Context *ctx)
      59      : HIRCompileBase (ctx), resolved (error_mark_node)
      60    {}
      61  
      62    tree resolve (const HIR::PathIdentSegment &final_segment,
      63  		const Analysis::NodeMapping &mappings, Location locus,
      64  		bool is_qualified_path);
      65  
      66    tree resolved;
      67  };
      68  
      69  } // namespace Compile
      70  } // namespace Rust
      71  
      72  #endif // RUST_COMPILE_RESOLVE_PATH