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_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 : 999 : 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 : : // Specialized visit bits
41 : : void visit_function_params (AST::Function &function) override;
42 : :
43 : : // some more label declarations
44 : : void visit (AST::LetStmt &) override;
45 : : // TODO: Do we need this?
46 : : // void visit (AST::Method &) override;
47 : : void visit (AST::IdentifierPattern &) override;
48 : : void visit (AST::StructPatternFieldIdent &) override;
49 : : void visit (AST::AltPattern &) override;
50 : : void visit (AST::SelfParam &) override;
51 : : void visit (AST::MatchArm &) override;
52 : : void visit (AST::ForLoopExpr &) override;
53 : : void visit (AST::IfLetExpr &) override;
54 : :
55 : : // resolutions
56 : : void visit (AST::IdentifierExpr &) override;
57 : : void visit (AST::StructExprFieldIdentifier &) override;
58 : : void visit (AST::BreakExpr &) override;
59 : : void visit (AST::ContinueExpr &) override;
60 : : void visit (AST::LoopLabel &) override;
61 : : void visit (AST::PathInExpression &) override;
62 : : void visit (AST::TypePath &) override;
63 : : void visit (AST::Trait &) override;
64 : : void visit (AST::StructExprStruct &) override;
65 : : void visit (AST::StructExprStructBase &) override;
66 : : void visit (AST::StructExprStructFields &) override;
67 : : void visit (AST::StructStruct &) override;
68 : : void visit (AST::GenericArgs &) override;
69 : : void visit (AST::GenericArg &);
70 : : void visit (AST::ClosureExprInner &) override;
71 : : void visit (AST::ClosureExprInnerTyped &) override;
72 : :
73 : : private:
74 : : void resolve_label (AST::Lifetime &lifetime);
75 : :
76 : : /* Setup Rust's builtin types (u8, i32, !...) in the resolver */
77 : : void setup_builtin_types ();
78 : :
79 : : bool funny_error;
80 : : };
81 : :
82 : : // TODO: Add missing mappings and data structures
83 : :
84 : : } // namespace Resolver2_0
85 : : } // namespace Rust
86 : :
87 : : #endif // ! RUST_LATE_NAME_RESOLVER_2_0_H
|