diff options
author | chriseth <c@ethdev.com> | 2016-02-22 09:13:41 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2016-03-30 08:37:00 +0800 |
commit | 949b00ed591303c531ed8fa73087b710b7a554de (patch) | |
tree | 182664f2545e6211d7994ef90a1e7746d5482981 /solc/jsonCompiler.cpp | |
parent | 8236732e9a5d2535afd3a3573a70d5aab3da3efe (diff) | |
download | dexon-solidity-949b00ed591303c531ed8fa73087b710b7a554de.tar dexon-solidity-949b00ed591303c531ed8fa73087b710b7a554de.tar.gz dexon-solidity-949b00ed591303c531ed8fa73087b710b7a554de.tar.bz2 dexon-solidity-949b00ed591303c531ed8fa73087b710b7a554de.tar.lz dexon-solidity-949b00ed591303c531ed8fa73087b710b7a554de.tar.xz dexon-solidity-949b00ed591303c531ed8fa73087b710b7a554de.tar.zst dexon-solidity-949b00ed591303c531ed8fa73087b710b7a554de.zip |
Parsing for inline assembly.
Diffstat (limited to 'solc/jsonCompiler.cpp')
-rw-r--r-- | solc/jsonCompiler.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/solc/jsonCompiler.cpp b/solc/jsonCompiler.cpp index b5efa94d..c6b40fdc 100644 --- a/solc/jsonCompiler.cpp +++ b/solc/jsonCompiler.cpp @@ -21,6 +21,7 @@ */ #include <string> +#include <functional> #include <iostream> #include <json/json.h> #include <libdevcore/Common.h> @@ -47,10 +48,14 @@ extern "C" { typedef void (*CStyleReadFileCallback)(char const* _path, char** o_contents, char** o_error); } -string formatError(Exception const& _exception, string const& _name, CompilerStack const& _compiler) +string formatError( + Exception const& _exception, + string const& _name, + function<Scanner const&(string const&)> const& _scannerFromSourceName +) { ostringstream errorOutput; - SourceReferenceFormatter::printExceptionInformation(errorOutput, _exception, _name, _compiler); + SourceReferenceFormatter::printExceptionInformation(errorOutput, _exception, _name, _scannerFromSourceName); return errorOutput.str(); } @@ -150,6 +155,7 @@ string compile(StringMap const& _sources, bool _optimize, CStyleReadFileCallback }; } CompilerStack compiler(true, readCallback); + auto scannerFromSourceName = [&](string const& _sourceName) -> solidity::Scanner const& { return compiler.scanner(_sourceName); }; bool success = false; try { @@ -161,22 +167,22 @@ string compile(StringMap const& _sources, bool _optimize, CStyleReadFileCallback errors.append(formatError( *error, (err->type() == Error::Type::Warning) ? "Warning" : "Error", - compiler + scannerFromSourceName )); } success = succ; // keep success false on exception } catch (Error const& error) { - errors.append(formatError(error, error.typeName(), compiler)); + errors.append(formatError(error, error.typeName(), scannerFromSourceName)); } catch (CompilerError const& exception) { - errors.append(formatError(exception, "Compiler error", compiler)); + errors.append(formatError(exception, "Compiler error", scannerFromSourceName)); } catch (InternalCompilerError const& exception) { - errors.append(formatError(exception, "Internal compiler error", compiler)); + errors.append(formatError(exception, "Internal compiler error", scannerFromSourceName)); } catch (Exception const& exception) { |