summaryrefslogtreecommitdiff
path: root/src/ast/item.hpp
blob: a5b0b1a58a109105444477f12ccd1cf60c82f7d3 (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
/*
 * MRustC - Mutabah's Rust Compiler
 * - By John Hodge (Mutabah/thePowersGang)
 *
 * ast/item.hpp
 * - AST named item wrapper
 */
#pragma once

#include <string>
#include <vector>
#include "attrs.hpp"

namespace AST {

template <typename T>
struct Named
{
    Span    span;
    AttributeList   attrs;
    bool    is_pub;
    RcString   name;
    T   data;

    Named():
        is_pub(false)
    {}
    Named(Named&&) = default;
    Named(const Named&) = default;
    Named& operator=(Named&&) = default;
    Named(Span sp, AttributeList attrs, bool is_pub, RcString name, T data):
        span(sp),
        attrs( ::std::move(attrs) ),
        is_pub( is_pub ),
        name( ::std::move(name) ),
        data( ::std::move(data) )
    {
    }
};

template <typename T>
using NamedList = ::std::vector<Named<T> >;

}   // namespace AST