LLL: report errors if (include) failed

This commit is contained in:
Alex Beregszaszi 2017-06-22 02:29:01 +01:00
parent 3094e77748
commit a14a1254ca

View File

@ -192,7 +192,13 @@ void CodeFragment::constructOperation(sp::utree const& _t, CompilerState& _s)
{ {
if (_t.size() != 2) if (_t.size() != 2)
error<IncorrectParameterCount>(); error<IncorrectParameterCount>();
m_asm.append(CodeFragment::compile(contentsString(firstAsString()), _s).m_asm); string fileName = firstAsString();
if (fileName.empty())
error<InvalidName>("Empty file name provided");
string contents = contentsString(fileName);
if (contents.empty())
error<InvalidName>(std::string("File not found (or empty): ") + fileName);
m_asm.append(CodeFragment::compile(contents, _s).m_asm);
} }
else if (us == "SET") else if (us == "SET")
{ {