[yul-phaser] Returning an ErrorList from Program::load() if program has errors and printing them in Phaser

This commit is contained in:
Kamil Śliwak
2020-03-16 20:32:59 +01:00
parent 9ef63a9789
commit 8ca0d90aae
5 changed files with 50 additions and 29 deletions
+7 -1
View File
@@ -125,7 +125,13 @@ ProgramFactory::Options ProgramFactory::Options::fromCommandLine(po::variables_m
Program ProgramFactory::build(Options const& _options)
{
CharStream sourceCode = loadSource(_options.inputFile);
return Program::load(sourceCode);
variant<Program, ErrorList> programOrErrors = Program::load(sourceCode);
if (holds_alternative<ErrorList>(programOrErrors))
{
cerr << get<ErrorList>(programOrErrors) << endl;
assertThrow(false, InvalidProgram, "Failed to load program " + _options.inputFile);
}
return move(get<Program>(programOrErrors));
}
CharStream ProgramFactory::loadSource(string const& _sourcePath)