本文整理汇总了C++中ErrorList::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ ErrorList::empty方法的具体用法?C++ ErrorList::empty怎么用?C++ ErrorList::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ErrorList
的用法示例。
在下文中一共展示了ErrorList::empty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: compile
//.........这里部分代码省略.........
catch (Error const& error)
{
errors.append(formatError(error, error.typeName(), scannerFromSourceName));
}
catch (CompilerError const& exception)
{
errors.append(formatError(exception, "Compiler error", scannerFromSourceName));
}
catch (InternalCompilerError const& exception)
{
errors.append(formatError(exception, "Internal compiler error", scannerFromSourceName));
}
catch (Exception const& exception)
{
errors.append("Exception during compilation: " + boost::diagnostic_information(exception));
}
catch (...)
{
errors.append("Unknown exception during compilation.");
}
if (errors.size() > 0)
output["errors"] = errors;
if (success)
{
try
{
output["contracts"] = Json::Value(Json::objectValue);
for (string const& contractName: compiler.contractNames())
{
Json::Value contractData(Json::objectValue);
contractData["interface"] = compiler.interface(contractName);
contractData["bytecode"] = compiler.object(contractName).toHex();
contractData["runtimeBytecode"] = compiler.runtimeObject(contractName).toHex();
contractData["opcodes"] = solidity::disassemble(compiler.object(contractName).bytecode);
contractData["functionHashes"] = functionHashes(compiler.contractDefinition(contractName));
contractData["gasEstimates"] = estimateGas(compiler, contractName);
auto sourceMap = compiler.sourceMapping(contractName);
contractData["srcmap"] = sourceMap ? *sourceMap : "";
auto runtimeSourceMap = compiler.runtimeSourceMapping(contractName);
contractData["srcmapRuntime"] = runtimeSourceMap ? *runtimeSourceMap : "";
ostringstream unused;
contractData["assembly"] = compiler.streamAssembly(unused, contractName, _sources, true);
output["contracts"][contractName] = contractData;
}
}
catch (...)
{
output["errors"].append("Unknown exception while generating contract data output.");
}
try
{
// Do not taint the internal error list
ErrorList formalErrors;
if (compiler.prepareFormalAnalysis(&formalErrors))
output["formal"]["why3"] = compiler.formalTranslation();
if (!formalErrors.empty())
{
Json::Value errors(Json::arrayValue);
for (auto const& error: formalErrors)
errors.append(formatError(
*error,
(error->type() == Error::Type::Warning) ? "Warning" : "Error",
scannerFromSourceName
));
output["formal"]["errors"] = errors;
}
}
catch (...)
{
output["errors"].append("Unknown exception while generating formal method output.");
}
try
{
// Indices into this array are used to abbreviate source names in source locations.
output["sourceList"] = Json::Value(Json::arrayValue);
for (auto const& source: compiler.sourceNames())
output["sourceList"].append(source);
output["sources"] = Json::Value(Json::objectValue);
for (auto const& source: compiler.sourceNames())
output["sources"][source]["AST"] = ASTJsonConverter(compiler.ast(source), compiler.sourceIndices()).json();
}
catch (...)
{
output["errors"].append("Unknown exception while generating source name output.");
}
}
try
{
return Json::FastWriter().write(output);
}
catch (...)
{
return "{\"errors\":[\"Unknown error while generating JSON.\"]}";
}
}