From 40246927d33789daba552b74afcf12559ce2ad17 Mon Sep 17 00:00:00 2001 From: starg Date: Tue, 2 Aug 2016 12:13:21 +0900 Subject: [PATCH] =?utf8?q?IR=20=E3=81=AB=E3=81=99=E3=81=B9=E3=81=A6?= =?utf8?q?=E3=81=AE=E5=B1=9E=E6=80=A7=E3=82=92=E3=83=9E=E3=83=BC=E3=82=B8?= =?utf8?q?=E3=81=99=E3=82=8B=E3=81=AE=E3=82=92=E3=82=84=E3=82=81=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/ast2ir/containerutil.hpp | 14 -------------- src/ast2ir/phrase2ir.cpp | 12 ++++++------ 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/src/ast2ir/containerutil.hpp b/src/ast2ir/containerutil.hpp index 13c0004..c80be5a 100644 --- a/src/ast2ir/containerutil.hpp +++ b/src/ast2ir/containerutil.hpp @@ -31,20 +31,6 @@ private: T& m_Container; }; -template -auto Concat(const T& container) -{ - std::vector v; - - for (auto&& i : container) - { - v.insert(v.end(), i.begin(), i.end()); - } - - return v; -} - - } // namespace AST2IR } // namespace YAMML diff --git a/src/ast2ir/phrase2ir.cpp b/src/ast2ir/phrase2ir.cpp index d2e53e8..e8c83a7 100644 --- a/src/ast2ir/phrase2ir.cpp +++ b/src/ast2ir/phrase2ir.cpp @@ -114,7 +114,7 @@ IR::Block::EventType Phrase2IRCompiler::operator()(const AST::NoteSequenceStatem AutoPop autoPop(m_AttributeStack); // with bounds checking - m_IR.Blocks[newIndex.ID].Attributes = Concat(m_AttributeStack); + m_IR.Blocks[newIndex.ID].Attributes = m_AttributeStack.back(); if (ast.NoteSeq.is_initialized()) { @@ -138,7 +138,7 @@ IR::Block::EventType Phrase2IRCompiler::operator()(const AST::NoteSequenceBlock& IR::Block::EventType Phrase2IRCompiler::operator()(const AST::NoteSequence& ast) { auto newIndex = AllocBlock(); - m_IR.Blocks[newIndex.ID].Attributes = Concat(m_AttributeStack); + m_IR.Blocks[newIndex.ID].Attributes = m_AttributeStack.back(); for (auto&& i : ast.Notes) { @@ -165,7 +165,7 @@ IR::Block::EventType Phrase2IRCompiler::operator()(const AST::NoteAndDuration& a IR::Block::EventType Phrase2IRCompiler::operator()(const AST::NoteRepeatExpression& ast) { auto newIndex = AllocBlock(); - m_IR.Blocks[newIndex.ID].Attributes = Concat(m_AttributeStack); + m_IR.Blocks[newIndex.ID].Attributes = m_AttributeStack.back(); LimitRepeatCount(ast.Count, ast.Location); @@ -189,7 +189,7 @@ IR::Block::EventType Phrase2IRCompiler::operator()(const AST::NoteRepeatExpressi IR::Block::EventType Phrase2IRCompiler::operator()(const AST::NoteRepeatEachExpression& ast) { auto newIndex = AllocBlock(); - m_IR.Blocks[newIndex.ID].Attributes = Concat(m_AttributeStack); + m_IR.Blocks[newIndex.ID].Attributes = m_AttributeStack.back(); LimitRepeatCount(ast.Count, ast.Location); @@ -227,7 +227,7 @@ IR::Block::EventType Phrase2IRCompiler::operator()(const AST::NoteNumber& ast, i IR::Block::EventType Phrase2IRCompiler::operator()(const AST::SimpleChord& ast, int duration) { auto newIndex = AllocBlock(); - m_IR.Blocks.at(newIndex.ID).Attributes = Concat(m_AttributeStack); + m_IR.Blocks.at(newIndex.ID).Attributes = m_AttributeStack.back(); for (auto&& i : ast.Notes) { @@ -247,7 +247,7 @@ IR::BlockReference Phrase2IRCompiler::AllocBlock() void Phrase2IRCompiler::Compile(const AST::NoteSequenceBlockWithoutAttributes& ast, IR::BlockReference index) { // with bounds checking - m_IR.Blocks.at(index.ID).Attributes = Concat(m_AttributeStack); + m_IR.Blocks.at(index.ID).Attributes = m_AttributeStack.back(); for (auto&& i : ast.Sequences) { -- 2.11.0