diff options
| author | Nagi5Yeq <wu@x-nagi.com> | 2020-05-26 00:26:57 +0800 |
|---|---|---|
| committer | Nagi5Yeq <wu@x-nagi.com> | 2020-05-26 00:26:57 +0800 |
| commit | e83990754f49ec6eba7b9e1a5ff80a6add5de3a1 (patch) | |
| tree | 6308b4d0afa5bde2de82e7aa034058302cb1d193 /node/BaseNode.cc | |
| parent | 958a811b18aee04e4795cf003fd8e3db00312c91 (diff) | |
bugfix & test
Diffstat (limited to 'node/BaseNode.cc')
| -rw-r--r-- | node/BaseNode.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/node/BaseNode.cc b/node/BaseNode.cc index 8fe2c5d..4b1166b 100644 --- a/node/BaseNode.cc +++ b/node/BaseNode.cc @@ -3,4 +3,23 @@ namespace pcc { BaseNode::BaseNode(Context* context) : context_(context) {} + +ProgramNode::ProgramNode( + Context* context, const std::string& name, + std::list<std::shared_ptr<BaseNode>> GlobalDeclarations, + std::list<std::shared_ptr<FunctionNode>> functions) + : BaseNode(context) + , name_(name) + , GlobalDeclarations_(GlobalDeclarations) + , functions_(functions) {} + +Value ProgramNode::CodeGen() { + for (auto decl : GlobalDeclarations_) { + decl->CodeGen(); + } + for (auto function : functions_) { + function->CodeGen(); + } + return nullptr; +} } // namespace pcc |
