Branch data Line data Source code
1 : : // Copyright (C) 2020-2025 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 : 34612 : class ResolvePathRef : public HIRCompileBase
28 : : {
29 : : public:
30 : : static tree Compile (HIR::QualifiedPathInExpression &expr, Context *ctx);
31 : :
32 : : static tree Compile (HIR::PathInExpression &expr, Context *ctx);
33 : :
34 : : ResolvePathRef (Context *ctx);
35 : :
36 : : /**
37 : : * Generic visitor for both PathInExpression and QualifiedPathInExpression
38 : : */
39 : : template <typename T> tree resolve_path_like (T &expr);
40 : :
41 : : /**
42 : : * Inner implementation of `resolve` - resolution with an already known NodeId
43 : : */
44 : : tree resolve_with_node_id (const HIR::PathIdentSegment &final_segment,
45 : : const Analysis::NodeMapping &mappings,
46 : : location_t locus, bool is_qualified_path,
47 : : NodeId resolved_node_id);
48 : : /**
49 : : * Resolve a mappings' NodeId and call into `resolve_with_node_id` which
50 : : * performs the rest of the path resolution
51 : : */
52 : : tree resolve (const HIR::PathIdentSegment &final_segment,
53 : : const Analysis::NodeMapping &mappings, location_t locus,
54 : : bool is_qualified_path);
55 : :
56 : : private:
57 : : tree
58 : : attempt_constructor_expression_lookup (TyTy::BaseType *lookup, Context *ctx,
59 : : const Analysis::NodeMapping &mappings,
60 : : location_t expr_locus);
61 : : };
62 : :
63 : : } // namespace Compile
64 : : } // namespace Rust
65 : :
66 : : #endif // RUST_COMPILE_RESOLVE_PATH
|