{
m_AttributeStack.push_back(ast.Attributes);
AutoPop<decltype(m_AttributeStack)> autoPop(m_AttributeStack);
+ m_IR.TrackBlocks.at(index.ID).Attributes = m_AttributeStack.back();
+
+ for (auto&& i : ast.Statements)
+ {
+ m_IR.TrackBlocks[index.ID].Blocks.push_back(i.apply_visitor(*this));
+ }
return true;
}
}
}
+IR::TrackBlock::BlockType Composition2IRCompiler::operator()(const AST::Command& ast)
+{
+ return ast;
+}
+
+IR::TrackBlock::BlockType Composition2IRCompiler::operator()(const AST::TrackListBlock& ast)
+{
+ IR::TrackList trackList;
+ trackList.Attributes = ast.Attributes;
+ trackList.Tracks.reserve(ast.Tracks.size());
+
+ for (auto&& i : ast.Tracks)
+ {
+
+ }
+
+ return trackList;
+}
+
} // namespace AST2IR
} // namespace YAMML
#include <deque>
#include <vector>
-#include <boost/optional.hpp>
+#include <boost/variant.hpp>
#include <ast/attribute.hpp>
#include <ast/composition.hpp>
namespace AST2IR
{
-class Composition2IRCompiler final : public Compiler::NestedCompilerBase
+class Composition2IRCompiler final : public Compiler::NestedCompilerBase, public boost::static_visitor<IR::TrackBlock::BlockType>
{
public:
Composition2IRCompiler(Compiler::CompilerBase& parentCompiler, IR::Module& ir);
// Compiles ast into m_IR.Blocks[index.ID]
bool Compile(const AST::Composition& ast, IR::TrackBlockReference index);
+ IR::TrackBlock::BlockType operator()(const AST::Command& ast);
+ IR::TrackBlock::BlockType operator()(const AST::TrackListBlock& ast);
+
private:
IR::Module& m_IR;
std::deque<std::vector<AST::Attribute>> m_AttributeStack;