summaryrefslogtreecommitdiff
path: root/src/types.hpp
blob: 4a5965225ece2e09645604044a71757ce2bd7508 (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
#ifndef TYPES_HPP_INCLUDED
#define TYPES_HPP_INCLUDED

#include "common.hpp"
#include "coretypes.hpp"
#include "ast/path.hpp"

namespace AST {
class Expr;
}

class TypeRef
{
public:
    TypeRef() {}

    struct TagUnit {};  // unit maps to a zero-length tuple, just easier to type
    TypeRef(TagUnit) {}

    struct TagPrimitive {};
    TypeRef(TagPrimitive, enum eCoreType type) {}
    struct TagTuple {};
    TypeRef(TagTuple _, ::std::vector<TypeRef> inner_types) {}
    struct TagReference {};
    TypeRef(TagReference _, bool is_mut, TypeRef inner_type) {}
    struct TagPointer {};
    TypeRef(TagPointer _, bool is_mut, TypeRef inner_type) {}
    struct TagSizedArray {};
    TypeRef(TagSizedArray _, TypeRef inner_type, AST::Expr&& size);
    struct TagUnsizedArray {};
    TypeRef(TagUnsizedArray _, TypeRef inner_type) {}

    struct TagArg {};
    TypeRef(TagArg, ::std::string name) {}

    struct TagPath {};
    TypeRef(TagPath, AST::Path path) {}
    
    friend ::std::ostream& operator<<(::std::ostream& os, const TypeRef& tr) {
        os << "TypeRef(TODO)";
        return os;
    }
};

#endif // TYPES_HPP_INCLUDED