]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/rust/backend/rust-compile-resolve-path.h
Update copyright years.
[thirdparty/gcc.git] / 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::GroupedPattern &) override {}
49 void visit (HIR::IdentifierPattern &) override {}
50 void visit (HIR::LiteralPattern &) override {}
51 void visit (HIR::RangePattern &) override {}
52 void visit (HIR::ReferencePattern &) override {}
53 void visit (HIR::SlicePattern &) override {}
54 void visit (HIR::StructPattern &) override {}
55 void visit (HIR::TuplePattern &) override {}
56 void visit (HIR::TupleStructPattern &) override {}
57 void visit (HIR::WildcardPattern &) override {}
58
59 ResolvePathRef (Context *ctx)
60 : HIRCompileBase (ctx), resolved (error_mark_node)
61 {}
62
63 tree resolve (const HIR::PathIdentSegment &final_segment,
64 const Analysis::NodeMapping &mappings, Location locus,
65 bool is_qualified_path);
66
67 tree resolved;
68 };
69
70 } // namespace Compile
71 } // namespace Rust
72
73 #endif // RUST_COMPILE_RESOLVE_PATH