[yul-phaser] Make Program copyable by doing a deep copy of the AST in the copy constructor

This commit is contained in:
cameel
2020-02-06 09:01:10 +01:00
committed by Kamil Śliwak
parent a189c8b6e2
commit 57fb64d467
3 changed files with 30 additions and 3 deletions
+7
View File
@@ -57,6 +57,13 @@ ostream& operator<<(ostream& _stream, Program const& _program);
}
Program::Program(Program const& program):
m_ast(make_unique<Block>(get<Block>(ASTCopier{}(*program.m_ast)))),
m_dialect{program.m_dialect},
m_nameDispenser(program.m_nameDispenser)
{
}
Program Program::load(CharStream& _sourceCode)
{
// ASSUMPTION: parseSource() rewinds the stream on its own