From ef559de84f1ee87225ac41f61f37dd9e17acc424 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Thu, 30 Mar 2017 02:32:43 +0100 Subject: Properly split contract filename and name --- libsolidity/interface/StandardCompiler.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'libsolidity') 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; } -- cgit v1.2.3