aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian <c@ethdev.com>2014-12-08 19:07:17 +0800
committerChristian <c@ethdev.com>2014-12-08 19:07:17 +0800
commit26f554d0d857bfda3f0b6970461c442a5da56dc7 (patch)
treea61b503025b25450bf5b4702eafd56ed00d56b8a
parentd25d98a260125cd77807bde72b264bbec21c53c5 (diff)
parent407f11ba7689cdd6ea856dc857a07f761255e80d (diff)
downloaddexon-solidity-26f554d0d857bfda3f0b6970461c442a5da56dc7.tar
dexon-solidity-26f554d0d857bfda3f0b6970461c442a5da56dc7.tar.gz
dexon-solidity-26f554d0d857bfda3f0b6970461c442a5da56dc7.tar.bz2
dexon-solidity-26f554d0d857bfda3f0b6970461c442a5da56dc7.tar.lz
dexon-solidity-26f554d0d857bfda3f0b6970461c442a5da56dc7.tar.xz
dexon-solidity-26f554d0d857bfda3f0b6970461c442a5da56dc7.tar.zst
dexon-solidity-26f554d0d857bfda3f0b6970461c442a5da56dc7.zip
Merge remote-tracking branch 'ethereum/develop' into sol_import
Conflicts: libsolidity/CompilerStack.cpp libsolidity/CompilerStack.h libsolidity/InterfaceHandler.cpp libsolidity/InterfaceHandler.h solc/main.cpp test/solidityJSONInterfaceTest.cpp test/solidityNatspecJSON.cpp
-rw-r--r--CompilerStack.cpp8
-rw-r--r--CompilerStack.h4
-rw-r--r--InterfaceHandler.cpp38
-rw-r--r--InterfaceHandler.h20
4 files changed, 35 insertions, 35 deletions
diff --git a/CompilerStack.cpp b/CompilerStack.cpp
index 20b0b3e5..d0b1df18 100644
--- a/CompilerStack.cpp
+++ b/CompilerStack.cpp
@@ -131,7 +131,7 @@ string const& CompilerStack::getInterface(std::string const& _contractName)
return getJsonDocumentation(_contractName, ABI_INTERFACE);
}
-std::string const& CompilerStack::getJsonDocumentation(std::string const& _contractName, enum DocumentationType _type)
+std::string const& CompilerStack::getJsonDocumentation(std::string const& _contractName, DocumentationType _type)
{
if (!m_parseSuccessful)
BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Parsing was not successful."));
@@ -141,13 +141,13 @@ std::string const& CompilerStack::getJsonDocumentation(std::string const& _contr
std::unique_ptr<string>* doc;
switch (_type)
{
- case NATSPEC_USER:
+ case DocumentationType::NATSPEC_USER:
doc = &contract.userDocumentation;
break;
- case NATSPEC_DEV:
+ case DocumentationType::NATSPEC_DEV:
doc = &contract.devDocumentation;
break;
- case ABI_INTERFACE:
+ case DocumentationType::ABI_INTERFACE:
doc = &contract.interface;
break;
default:
diff --git a/CompilerStack.h b/CompilerStack.h
index bedb4cc3..82d27549 100644
--- a/CompilerStack.h
+++ b/CompilerStack.h
@@ -39,7 +39,7 @@ class Compiler;
class GlobalContext;
class InterfaceHandler;
-enum DocumentationType: unsigned short
+enum class DocumentationType: uint8_t
{
NATSPEC_USER = 1,
NATSPEC_DEV,
@@ -84,7 +84,7 @@ public:
/// Prerequisite: Successful call to parse or compile.
/// @param type The type of the documentation to get.
/// Can be one of 3 types defined at @c DocumentationType
- std::string const& getJsonDocumentation(std::string const& _contractName, enum DocumentationType _type);
+ std::string const& getJsonDocumentation(std::string const& _contractName, DocumentationType _type);
/// Returns the previously used scanner, useful for counting lines during error reporting.
Scanner const& getScanner(std::string const& _sourceName = "");
diff --git a/InterfaceHandler.cpp b/InterfaceHandler.cpp
index 95e8c58a..c3e62cad 100644
--- a/InterfaceHandler.cpp
+++ b/InterfaceHandler.cpp
@@ -12,19 +12,19 @@ namespace solidity
InterfaceHandler::InterfaceHandler()
{
- m_lastTag = DOCTAG_NONE;
+ m_lastTag = DocTagType::NONE;
}
std::unique_ptr<std::string> InterfaceHandler::getDocumentation(ContractDefinition& _contractDef,
- enum DocumentationType _type)
+ DocumentationType _type)
{
switch(_type)
{
- case NATSPEC_USER:
+ case DocumentationType::NATSPEC_USER:
return getUserDocumentation(_contractDef);
- case NATSPEC_DEV:
+ case DocumentationType::NATSPEC_DEV:
return getDevDocumentation(_contractDef);
- case ABI_INTERFACE:
+ case DocumentationType::ABI_INTERFACE:
return getABIInterface(_contractDef);
}
@@ -146,7 +146,7 @@ static inline std::string::const_iterator skipLineOrEOS(std::string::const_itera
std::string::const_iterator InterfaceHandler::parseDocTagLine(std::string::const_iterator _pos,
std::string::const_iterator _end,
std::string& _tagString,
- enum DocTagType _tagType)
+ DocTagType _tagType)
{
auto nlPos = std::find(_pos, _end, '\n');
std::copy(_pos, nlPos, back_inserter(_tagString));
@@ -170,7 +170,7 @@ std::string::const_iterator InterfaceHandler::parseDocTagParam(std::string::cons
auto paramDesc = std::string(currPos, nlPos);
m_params.push_back(std::make_pair(paramName, paramDesc));
- m_lastTag = DOCTAG_PARAM;
+ m_lastTag = DocTagType::PARAM;
return skipLineOrEOS(nlPos, _end);
}
@@ -197,14 +197,14 @@ std::string::const_iterator InterfaceHandler::parseDocTag(std::string::const_ite
{
// LTODO: need to check for @(start of a tag) between here and the end of line
// for all cases
- if (m_lastTag == DOCTAG_NONE || _tag != "")
+ if (m_lastTag == DocTagType::NONE || _tag != "")
{
if (_tag == "dev")
- return parseDocTagLine(_pos, _end, m_dev, DOCTAG_DEV);
+ return parseDocTagLine(_pos, _end, m_dev, DocTagType::DEV);
else if (_tag == "notice")
- return parseDocTagLine(_pos, _end, m_notice, DOCTAG_NOTICE);
+ return parseDocTagLine(_pos, _end, m_notice, DocTagType::NOTICE);
else if (_tag == "return")
- return parseDocTagLine(_pos, _end, m_return, DOCTAG_RETURN);
+ return parseDocTagLine(_pos, _end, m_return, DocTagType::RETURN);
else if (_tag == "param")
return parseDocTagParam(_pos, _end);
else
@@ -222,16 +222,16 @@ std::string::const_iterator InterfaceHandler::appendDocTag(std::string::const_it
{
switch (m_lastTag)
{
- case DOCTAG_DEV:
+ case DocTagType::DEV:
m_dev += " ";
- return parseDocTagLine(_pos, _end, m_dev, DOCTAG_DEV);
- case DOCTAG_NOTICE:
+ return parseDocTagLine(_pos, _end, m_dev, DocTagType::DEV);
+ case DocTagType::NOTICE:
m_notice += " ";
- return parseDocTagLine(_pos, _end, m_notice, DOCTAG_NOTICE);
- case DOCTAG_RETURN:
+ return parseDocTagLine(_pos, _end, m_notice, DocTagType::NOTICE);
+ case DocTagType::RETURN:
m_return += " ";
- return parseDocTagLine(_pos, _end, m_return, DOCTAG_RETURN);
- case DOCTAG_PARAM:
+ return parseDocTagLine(_pos, _end, m_return, DocTagType::RETURN);
+ case DocTagType::PARAM:
return appendDocTagParam(_pos, _end);
default:
BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Internal: Illegal documentation tag type"));
@@ -267,7 +267,7 @@ void InterfaceHandler::parseDocString(std::string const& _string)
currPos = parseDocTag(tagNameEndPos + 1, end, std::string(tagPos + 1, tagNameEndPos));
}
- else if (m_lastTag != DOCTAG_NONE) // continuation of the previous tag
+ else if (m_lastTag != DocTagType::NONE) // continuation of the previous tag
currPos = appendDocTag(currPos + 1, end);
else if (currPos != end) // skip the line if a newline was found
currPos = nlPos + 1;
diff --git a/InterfaceHandler.h b/InterfaceHandler.h
index 0eae3aaf..e6be9e6a 100644
--- a/InterfaceHandler.h
+++ b/InterfaceHandler.h
@@ -37,15 +37,15 @@ namespace solidity
// Forward declarations
class ContractDefinition;
-enum DocumentationType: unsigned short;
+enum class DocumentationType: uint8_t;
-enum DocTagType
+enum class DocTagType: uint8_t
{
- DOCTAG_NONE = 0,
- DOCTAG_DEV,
- DOCTAG_NOTICE,
- DOCTAG_PARAM,
- DOCTAG_RETURN
+ NONE = 0,
+ DEV,
+ NOTICE,
+ PARAM,
+ RETURN
};
class InterfaceHandler
@@ -60,7 +60,7 @@ public:
/// @return A unique pointer contained string with the json
/// representation of provided type
std::unique_ptr<std::string> getDocumentation(ContractDefinition& _contractDef,
- enum DocumentationType _type);
+ DocumentationType _type);
/// Get the ABI Interface of the contract
/// @param _contractDef The contract definition
/// @return A unique pointer contained string with the json
@@ -84,7 +84,7 @@ private:
std::string::const_iterator parseDocTagLine(std::string::const_iterator _pos,
std::string::const_iterator _end,
std::string& _tagString,
- enum DocTagType _tagType);
+ DocTagType _tagType);
std::string::const_iterator parseDocTagParam(std::string::const_iterator _pos,
std::string::const_iterator _end);
std::string::const_iterator appendDocTagParam(std::string::const_iterator _pos,
@@ -99,7 +99,7 @@ private:
Json::StyledWriter m_writer;
// internal state
- enum DocTagType m_lastTag;
+ DocTagType m_lastTag;
std::string m_notice;
std::string m_dev;
std::string m_return;