diff options
author | chriseth <chris@ethereum.org> | 2016-08-17 23:55:40 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-17 23:55:40 +0800 |
commit | c282ab379aac4a6b14f59a957c6261e2edb8b1ce (patch) | |
tree | dadf901d13c864ae4f5cb0dbdf1036fc0e33b087 /libsolidity | |
parent | b2507e9f105ab701c417f8f2d125edf8f3022698 (diff) | |
parent | e5e2597702bcffb52222304638836a1c4302bc77 (diff) | |
download | dexon-solidity-c282ab379aac4a6b14f59a957c6261e2edb8b1ce.tar dexon-solidity-c282ab379aac4a6b14f59a957c6261e2edb8b1ce.tar.gz dexon-solidity-c282ab379aac4a6b14f59a957c6261e2edb8b1ce.tar.bz2 dexon-solidity-c282ab379aac4a6b14f59a957c6261e2edb8b1ce.tar.lz dexon-solidity-c282ab379aac4a6b14f59a957c6261e2edb8b1ce.tar.xz dexon-solidity-c282ab379aac4a6b14f59a957c6261e2edb8b1ce.tar.zst dexon-solidity-c282ab379aac4a6b14f59a957c6261e2edb8b1ce.zip |
Merge pull request #918 from winsvega/solremove4
remove solidity --interface
Diffstat (limited to 'libsolidity')
-rw-r--r-- | libsolidity/interface/CompilerStack.cpp | 8 | ||||
-rw-r--r-- | libsolidity/interface/CompilerStack.h | 7 | ||||
-rw-r--r-- | libsolidity/interface/InterfaceHandler.cpp | 70 | ||||
-rw-r--r-- | libsolidity/interface/InterfaceHandler.h | 1 |
4 files changed, 1 insertions, 85 deletions
diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp index f7982872..0e5ead2b 100644 --- a/libsolidity/interface/CompilerStack.cpp +++ b/libsolidity/interface/CompilerStack.cpp @@ -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) @@ -383,9 +378,6 @@ string const& CompilerStack::metadata(string const& _contractName, Documentation case DocumentationType::ABIInterface: doc = ¤tContract.interface; break; - case DocumentationType::ABISolidityInterface: - doc = ¤tContract.solidityInterface; - break; default: BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Illegal documentation type.")); } diff --git a/libsolidity/interface/CompilerStack.h b/libsolidity/interface/CompilerStack.h index a4b8447f..b3c4450c 100644 --- a/libsolidity/interface/CompilerStack.h +++ b/libsolidity/interface/CompilerStack.h @@ -63,8 +63,7 @@ enum class DocumentationType: uint8_t { NatspecUser = 1, NatspecDev, - ABIInterface, - ABISolidityInterface + ABIInterface }; /** @@ -167,9 +166,6 @@ public: /// @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. @@ -219,7 +215,6 @@ private: 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; diff --git a/libsolidity/interface/InterfaceHandler.cpp b/libsolidity/interface/InterfaceHandler.cpp index e254137f..f5c10356 100644 --- a/libsolidity/interface/InterfaceHandler.cpp +++ b/libsolidity/interface/InterfaceHandler.cpp @@ -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")); @@ -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; diff --git a/libsolidity/interface/InterfaceHandler.h b/libsolidity/interface/InterfaceHandler.h index 3e0a1660..54199e4e 100644 --- a/libsolidity/interface/InterfaceHandler.h +++ b/libsolidity/interface/InterfaceHandler.h @@ -73,7 +73,6 @@ public: /// @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 |