Line data Source code
1 : // Copyright (C) 2020-2026 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 4505 : 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 : void visit (AST::WhileLetLoopExpr &) override;
46 : // TODO: Do we need this?
47 : // void visit (AST::Method &) override;
48 : void visit (AST::IdentifierPattern &) override;
49 : void visit (AST::StructPatternFieldIdent &) override;
50 : void visit (AST::AltPattern &) override;
51 : void visit (AST::SelfParam &) override;
52 : void visit (AST::MatchArm &) override;
53 : void visit (AST::ForLoopExpr &) override;
54 : void visit_if_let_patterns (AST::IfLetExpr &) override;
55 :
56 : // resolutions
57 : void visit (AST::IdentifierExpr &) override;
58 : void visit (AST::StructExprFieldIdentifier &) override;
59 : void visit (AST::BreakExpr &) override;
60 : void visit (AST::ContinueExpr &) override;
61 : void visit (AST::LoopLabel &) override;
62 : void visit (AST::PathInExpression &) override;
63 : void visit_impl_type (AST::Type &) override;
64 : void visit (AST::TypePath &) override;
65 : void visit (AST::Visibility &) override;
66 : void visit (AST::Trait &) override;
67 : void visit (AST::StructExprStruct &) override;
68 : void visit (AST::StructExprStructBase &) override;
69 : void visit (AST::StructExprStructFields &) override;
70 : void visit (AST::GenericArgs &) override;
71 : void visit (AST::GenericArg &);
72 : void visit_closure_params (AST::ClosureExpr &) override;
73 : void visit (AST::ClosureExpr &) override;
74 :
75 : private:
76 : void resolve_label (AST::Lifetime &lifetime);
77 :
78 : bool funny_error;
79 :
80 : /* used to prevent "impl Self {}", "impl (Self, i32) {}", etc */
81 : bool block_big_self;
82 : };
83 :
84 : // TODO: Add missing mappings and data structures
85 :
86 : } // namespace Resolver2_0
87 : } // namespace Rust
88 :
89 : #endif // ! RUST_LATE_NAME_RESOLVER_2_0_H
|