summaryrefslogtreecommitdiff
path: root/node/BaseNode.cc
blob: 839132254bbd8a9bb16e627ac5db8a365e9f1808 (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
#include "Node.hh"

namespace pcc {
BaseNode::BaseNode(Context* context)
    : context_(context) {}

ProgramNode::ProgramNode(
    Context* context, std::string&& name,
    std::list<std::shared_ptr<DeclNode>>&& GlobalDeclarations,
    std::list<std::shared_ptr<FunctionNode>>&& functions)
    : BaseNode(context)
    , name_(std::move(name))
    , GlobalDeclarations_(std::move(GlobalDeclarations))
    , functions_(std::move(functions)) {}

Value ProgramNode::CodeGen() {
    for (auto&& decl : GlobalDeclarations_) {
        decl->CodeGen();
    }
    for (auto&& function : functions_) {
        function->CodeGen();
    }
    return nullptr;
}
} // namespace pcc