diff options
| author | Nagi5Yeq <wu@x-nagi.com> | 2020-05-30 00:25:03 +0800 |
|---|---|---|
| committer | Nagi5Yeq <wu@x-nagi.com> | 2020-05-30 00:25:03 +0800 |
| commit | 56d68765016fc7aa68fe7b522de5e84c7a12123a (patch) | |
| tree | ba9828637913aa40bc1b1509c5127be9bded3a6e /node/BaseNode.cc | |
| parent | f15a071f6d599d2a21083dfb041b18db8d482949 (diff) | |
global variable, constant support
Diffstat (limited to 'node/BaseNode.cc')
| -rw-r--r-- | node/BaseNode.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/node/BaseNode.cc b/node/BaseNode.cc index 4b1166b..8391322 100644 --- a/node/BaseNode.cc +++ b/node/BaseNode.cc @@ -5,19 +5,19 @@ 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) + Context* context, std::string&& name, + std::list<std::shared_ptr<DeclNode>>&& GlobalDeclarations, + std::list<std::shared_ptr<FunctionNode>>&& functions) : BaseNode(context) - , name_(name) - , GlobalDeclarations_(GlobalDeclarations) - , functions_(functions) {} + , name_(std::move(name)) + , GlobalDeclarations_(std::move(GlobalDeclarations)) + , functions_(std::move(functions)) {} Value ProgramNode::CodeGen() { - for (auto decl : GlobalDeclarations_) { + for (auto&& decl : GlobalDeclarations_) { decl->CodeGen(); } - for (auto function : functions_) { + for (auto&& function : functions_) { function->CodeGen(); } return nullptr; |
