summaryrefslogtreecommitdiff
path: root/src/hir/generic_params.hpp
blob: 1fe92163f6660fcc7c6bfb23584302793f8f19d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
 */
#pragma once

namespace HIR {

struct TypeParamDef
{
    ::std::string   m_name;
    ::HIR::TypeRef  m_default;
    bool    m_is_sized;
};

TAGGED_UNION(GenericBound, Lifetime,
    (Lifetime, struct {
        ::std::string   test;
        ::std::string   valid_for;
        }),
    (TypeLifetime, struct {
        ::HIR::TypeRef  type;
        ::std::string   valid_for;
        }),
    (TraitBound, struct {
        ::HIR::TypeRef  type;
        ::HIR::TraitPath    trait;
        }),
    //(NotTrait, struct {
    //    ::HIR::TypeRef  type;
    //    ::HIR::GenricPath    trait;
    //    }),
    (TypeEquality, struct {
        ::HIR::TypeRef  type;
        ::HIR::TypeRef  other_type;
        })
    );

struct GenericParams
{
    ::std::vector<TypeParamDef>   m_types;
    ::std::vector< ::std::string>   m_lifetimes;
    
    ::std::vector<GenericBound>    m_bounds;
};

}   // namespace HIR