Branch data Line data Source code
1 : : // Copyright (C) 2020-2024 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_FNPARAM
20 : : #define RUST_COMPILE_FNPARAM
21 : :
22 : : #include "rust-compile-base.h"
23 : : #include "rust-hir-visitor.h"
24 : :
25 : : namespace Rust {
26 : : namespace Compile {
27 : :
28 : 4371 : class CompileFnParam : private HIRCompileBase, protected HIR::HIRPatternVisitor
29 : : {
30 : : public:
31 : : static Bvariable *compile (Context *ctx, tree fndecl,
32 : : HIR::FunctionParam *param, tree decl_type,
33 : : location_t locus);
34 : : static Bvariable *compile (Context *ctx, tree fndecl, HIR::Pattern *param,
35 : : tree decl_type, location_t locus);
36 : :
37 : : void visit (HIR::IdentifierPattern &pattern) override;
38 : : void visit (HIR::WildcardPattern &pattern) override;
39 : : void visit (HIR::StructPattern &) override;
40 : : void visit (HIR::TupleStructPattern &) override;
41 : : void visit (HIR::ReferencePattern &) override;
42 : :
43 : : // Empty visit for unused Pattern HIR nodes.
44 : 0 : void visit (HIR::AltPattern &) override {}
45 : 0 : void visit (HIR::LiteralPattern &) override {}
46 : 0 : void visit (HIR::PathInExpression &) override {}
47 : 0 : void visit (HIR::QualifiedPathInExpression &) override {}
48 : 0 : void visit (HIR::RangePattern &) override {}
49 : 0 : void visit (HIR::SlicePattern &) override {}
50 : 0 : void visit (HIR::TuplePattern &) override {}
51 : :
52 : : private:
53 : : CompileFnParam (Context *ctx, tree fndecl, tree decl_type, location_t locus);
54 : :
55 : : tree create_tmp_param_var (tree decl_type);
56 : :
57 : : tree fndecl;
58 : : tree decl_type;
59 : : location_t locus;
60 : : Bvariable *compiled_param;
61 : : };
62 : :
63 : : class CompileSelfParam : private HIRCompileBase
64 : : {
65 : : public:
66 : : static Bvariable *compile (Context *ctx, tree fndecl, HIR::SelfParam &self,
67 : : tree decl_type, location_t locus);
68 : : };
69 : :
70 : : } // namespace Compile
71 : : } // namespace Rust
72 : :
73 : : #endif // RUST_COMPILE_FNPARAM
|