diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-03-30 09:32:43 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-04-21 02:38:00 +0800 |
commit | ef559de84f1ee87225ac41f61f37dd9e17acc424 (patch) | |
tree | c4a6c0f205e1606a320787a889d208e8b2cd6a13 | |
parent | ad1fe865088cdb4f97b3728e00d3fc2a5a34aba5 (diff) | |
download | dexon-solidity-ef559de84f1ee87225ac41f61f37dd9e17acc424.tar dexon-solidity-ef559de84f1ee87225ac41f61f37dd9e17acc424.tar.gz dexon-solidity-ef559de84f1ee87225ac41f61f37dd9e17acc424.tar.bz2 dexon-solidity-ef559de84f1ee87225ac41f61f37dd9e17acc424.tar.lz dexon-solidity-ef559de84f1ee87225ac41f61f37dd9e17acc424.tar.xz dexon-solidity-ef559de84f1ee87225ac41f61f37dd9e17acc424.tar.zst dexon-solidity-ef559de84f1ee87225ac41f61f37dd9e17acc424.zip |
Properly split contract filename and name
-rw-r--r-- | libsolidity/interface/StandardCompiler.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/libsolidity/interface/StandardCompiler.cpp b/libsolidity/interface/StandardCompiler.cpp index 0297a5ec..13f82f60 100644 --- a/libsolidity/interface/StandardCompiler.cpp +++ b/libsolidity/interface/StandardCompiler.cpp @@ -280,6 +280,11 @@ Json::Value StandardCompiler::compileInternal(Json::Value const& _input) Json::Value contractsOutput = Json::objectValue; for (string const& contractName: m_compilerStack.contractNames()) { + size_t colon = contractName.find(':'); + solAssert(colon != string::npos, ""); + string file = contractName.substr(0, colon); + string name = contractName.substr(colon + 1); + // ABI, documentation and metadata Json::Value contractData(Json::objectValue); contractData["abi"] = dev::jsonCompactPrint(m_compilerStack.metadata(contractName, DocumentationType::ABIInterface)); @@ -317,10 +322,12 @@ Json::Value StandardCompiler::compileInternal(Json::Value const& _input) contractData["evm"] = evmData; - contractsOutput[contractName] = contractData; + if (!contractsOutput.isMember(file)) + contractsOutput[file] = Json::objectValue; + + contractsOutput[file][name] = contractData; } - output["contracts"] = Json::objectValue; - output["contracts"][""] = contractsOutput; + output["contracts"] = contractsOutput; return output; } |