Skip to content

Commit

Permalink
remove solidity --interface
Browse files Browse the repository at this point in the history
  • Loading branch information
winsvega committed Aug 17, 2016
1 parent e7683f4 commit e5e2597
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 262 deletions.
8 changes: 0 additions & 8 deletions libsolidity/interface/CompilerStack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,6 @@ string const& CompilerStack::interface(string const& _contractName) const
return metadata(_contractName, DocumentationType::ABIInterface);
}

string const& CompilerStack::solidityInterface(string const& _contractName) const
{
return metadata(_contractName, DocumentationType::ABISolidityInterface);
}

string const& CompilerStack::metadata(string const& _contractName, DocumentationType _type) const
{
if (!m_parseSuccessful)
Expand All @@ -383,9 +378,6 @@ string const& CompilerStack::metadata(string const& _contractName, Documentation
case DocumentationType::ABIInterface:
doc = &currentContract.interface;
break;
case DocumentationType::ABISolidityInterface:
doc = &currentContract.solidityInterface;
break;
default:
BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Illegal documentation type."));
}
Expand Down
7 changes: 1 addition & 6 deletions libsolidity/interface/CompilerStack.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ enum class DocumentationType: uint8_t
{
NatspecUser = 1,
NatspecDev,
ABIInterface,
ABISolidityInterface
ABIInterface
};

/**
Expand Down Expand Up @@ -167,9 +166,6 @@ class CompilerStack: boost::noncopyable
/// @returns a string representing the contract interface in JSON.
/// Prerequisite: Successful call to parse or compile.
std::string const& interface(std::string const& _contractName = "") const;
/// @returns a string representing the contract interface in Solidity.
/// Prerequisite: Successful call to parse or compile.
std::string const& solidityInterface(std::string const& _contractName = "") const;
/// @returns a string representing the contract's documentation in JSON.
/// Prerequisite: Successful call to parse or compile.
/// @param type The type of the documentation to get.
Expand Down Expand Up @@ -219,7 +215,6 @@ class CompilerStack: boost::noncopyable
eth::LinkerObject runtimeObject;
eth::LinkerObject cloneObject;
mutable std::unique_ptr<std::string const> interface;
mutable std::unique_ptr<std::string const> solidityInterface;
mutable std::unique_ptr<std::string const> userDocumentation;
mutable std::unique_ptr<std::string const> devDocumentation;
mutable std::unique_ptr<std::string const> sourceMapping;
Expand Down
70 changes: 0 additions & 70 deletions libsolidity/interface/InterfaceHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ string InterfaceHandler::documentation(
return devDocumentation(_contractDef);
case DocumentationType::ABIInterface:
return abiInterface(_contractDef);
case DocumentationType::ABISolidityInterface:
return ABISolidityInterface(_contractDef);
}

BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Unknown documentation type"));
Expand Down Expand Up @@ -98,74 +96,6 @@ string InterfaceHandler::abiInterface(ContractDefinition const& _contractDef)
return Json::FastWriter().write(abi);
}

string InterfaceHandler::ABISolidityInterface(ContractDefinition const& _contractDef)
{
string ret = (_contractDef.isLibrary() ? "library " : "contract ") + _contractDef.name() + "{";

auto populateParameters = [](vector<string> const& _paramNames, vector<string> const& _paramTypes)
{
string ret = "(";
for (size_t i = 0; i < _paramNames.size(); ++i)
ret += _paramTypes[i] + " " + _paramNames[i] + ",";
if (ret.size() != 1)
ret.pop_back();
return ret + ")";
};
// If this is a library, include all its enum and struct types. Should be more intelligent
// in the future and check what is actually used (it might even use types from other libraries
// or contracts or in the global scope).
if (_contractDef.isLibrary())
{
for (auto const& stru: _contractDef.definedStructs())
{
ret += "struct " + stru->name() + "{";
for (ASTPointer<VariableDeclaration> const& _member: stru->members())
ret += _member->type()->canonicalName(false) + " " + _member->name() + ";";
ret += "}";
}
for (auto const& enu: _contractDef.definedEnums())
{
ret += "enum " + enu->name() + "{";
for (ASTPointer<EnumValue> const& val: enu->members())
ret += val->name() + ",";
if (ret.back() == ',')
ret.pop_back();
ret += "}";
}
}
if (_contractDef.constructor())
{
auto externalFunction = FunctionType(*_contractDef.constructor()).interfaceFunctionType();
solAssert(!!externalFunction, "");
ret +=
"function " +
_contractDef.name() +
populateParameters(
externalFunction->parameterNames(),
externalFunction->parameterTypeNames(_contractDef.isLibrary())
) +
";";
}
for (auto const& it: _contractDef.interfaceFunctions())
{
ret += "function " + it.second->declaration().name() +
populateParameters(
it.second->parameterNames(),
it.second->parameterTypeNames(_contractDef.isLibrary())
) + (it.second->isConstant() ? "constant " : "");
if (it.second->returnParameterTypes().size())
ret += "returns" + populateParameters(
it.second->returnParameterNames(),
it.second->returnParameterTypeNames(_contractDef.isLibrary())
);
else if (ret.back() == ' ')
ret.pop_back();
ret += ";";
}

return ret + "}";
}

string InterfaceHandler::userDocumentation(ContractDefinition const& _contractDef)
{
Json::Value doc;
Expand Down
1 change: 0 additions & 1 deletion libsolidity/interface/InterfaceHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ class InterfaceHandler
/// @param _contractDef The contract definition
/// @return A string with the json representation of the contract's ABI Interface
static std::string abiInterface(ContractDefinition const& _contractDef);
static std::string ABISolidityInterface(ContractDefinition const& _contractDef);
/// Get the User documentation of the contract
/// @param _contractDef The contract definition
/// @return A string with the json representation of the contract's user documentation
Expand Down
11 changes: 0 additions & 11 deletions solc/CommandLineInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ namespace solidity
{

static string const g_argAbiStr = "abi";
static string const g_argSolInterfaceStr = "interface";
static string const g_argSignatureHashes = "hashes";
static string const g_argGas = "gas";
static string const g_argAsmStr = "asm";
Expand Down Expand Up @@ -116,7 +115,6 @@ static bool needsHumanTargetedStdout(po::variables_map const& _args)
return false;
for (string const& arg: {
g_argAbiStr,
g_argSolInterfaceStr,
g_argSignatureHashes,
g_argNatspecUserStr,
g_argAstJson,
Expand Down Expand Up @@ -215,11 +213,6 @@ void CommandLineInterface::handleMeta(DocumentationType _type, string const& _co
suffix = ".abi";
title = "Contract JSON ABI";
break;
case DocumentationType::ABISolidityInterface:
argName = g_argSolInterfaceStr;
suffix = "_interface.sol";
title = "Contract Solidity ABI";
break;
case DocumentationType::NatspecUser:
argName = g_argNatspecUserStr;
suffix = ".docuser";
Expand Down Expand Up @@ -455,7 +448,6 @@ Allowed options)",
(g_argRuntimeBinaryStr.c_str(), "Binary of the runtime part of the contracts in hex.")
(g_argCloneBinaryStr.c_str(), "Binary of the clone contracts in hex.")
(g_argAbiStr.c_str(), "ABI specification of the contracts.")
(g_argSolInterfaceStr.c_str(), "Solidity interface of the contracts.")
(g_argSignatureHashes.c_str(), "Function signature hashes of the contracts.")
(g_argNatspecUserStr.c_str(), "Natspec user documentation of all contracts.")
(g_argNatspecDevStr.c_str(), "Natspec developer documentation of all contracts.")
Expand Down Expand Up @@ -643,8 +635,6 @@ void CommandLineInterface::handleCombinedJSON()
for (string const& contractName: contracts)
{
Json::Value contractData(Json::objectValue);
if (requests.count("interface"))
contractData["interface"] = m_compiler->solidityInterface(contractName);
if (requests.count("abi"))
contractData["abi"] = m_compiler->interface(contractName);
if (requests.count("bin"))
Expand Down Expand Up @@ -901,7 +891,6 @@ void CommandLineInterface::outputCompilationResults()
handleBytecode(contract);
handleSignatureHashes(contract);
handleMeta(DocumentationType::ABIInterface, contract);
handleMeta(DocumentationType::ABISolidityInterface, contract);
handleMeta(DocumentationType::NatspecDev, contract);
handleMeta(DocumentationType::NatspecUser, contract);
} // end of contracts iteration
Expand Down
1 change: 0 additions & 1 deletion solc/jsonCompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ string compile(StringMap const& _sources, bool _optimize, CStyleReadFileCallback
for (string const& contractName: compiler.contractNames())
{
Json::Value contractData(Json::objectValue);
contractData["solidityInterface"] = compiler.solidityInterface(contractName);
contractData["interface"] = compiler.interface(contractName);
contractData["bytecode"] = compiler.object(contractName).toHex();
contractData["runtimeBytecode"] = compiler.runtimeObject(contractName).toHex();
Expand Down
165 changes: 0 additions & 165 deletions test/libsolidity/SolidityInterface.cpp

This file was deleted.

0 comments on commit e5e2597

Please sign in to comment.