Debian Codegraph @

gcc/rust/resolve/rust-late-name-resolver-2.0.h

raw
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_LATE_NAME_RESOLVER_2_0_H
20 #define RUST_LATE_NAME_RESOLVER_2_0_H
21
22 #include "rust-ast-full.h"
23 #include "rust-default-resolver.h"
24 #include "rust-expr.h"
25
26 namespace Rust {
27 namespace Resolver2_0 {
28
29 class Late : public DefaultResolver
30 {
31 using DefaultResolver::visit;
32
33 public:
34 Late (NameResolutionContext &ctx);
35
36 void go (AST::Crate &crate);
37
38 void new_label (Identifier name, NodeId id);
39
40 // some more label declarations
41 void visit (AST::LetStmt &) override;
42 // TODO: Do we need this?
43 // void visit (AST::Method &) override;
44 void visit (AST::IdentifierPattern &) override;
45 void visit (AST::SelfParam &) override;
46
47 // resolutions
48 void visit (AST::IdentifierExpr &) override;
49 void visit (AST::StructExprFieldIdentifier &) override;
50 void visit (AST::BreakExpr &) override;
51 void visit (AST::ContinueExpr &) override;
52 void visit (AST::LoopLabel &) override;
53 void visit (AST::PathInExpression &) override;
54 void visit (AST::TypePath &) override;
55 void visit (AST::Trait &) override;
56 void visit (AST::StructExprStruct &) override;
57 void visit (AST::StructExprStructBase &) override;
58 void visit (AST::StructExprStructFields &) override;
59 void visit (AST::StructStruct &) override;
60 void visit (AST::GenericArgs &) override;
61 void visit (AST::GenericArg &);
62 void visit (AST::ClosureExprInner &) override;
63 void visit (AST::ClosureExprInnerTyped &) override;
64
65 private:
66 void resolve_label (AST::Lifetime &lifetime);
67
68 /* Setup Rust's builtin types (u8, i32, !...) in the resolver */
69 void setup_builtin_types ();
70
71 bool funny_error;
72 };
73
74 // TODO: Add missing mappings and data structures
75
76 } // namespace Resolver2_0
77 } // namespace Rust
78
79 #endif // ! RUST_LATE_NAME_RESOLVER_2_0_H