aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLefteris Karapetsas <lefteris@refu.co>2015-02-06 05:38:07 +0800
committerLefteris Karapetsas <lefteris@refu.co>2015-02-06 05:38:07 +0800
commit305f54b23f9643538a7e3a06d855271be0949035 (patch)
tree7d3820204b0df301e9c45e5a52d3575267530faa
parenteaadc71b4c88603a7264211401d249ca1ead22e3 (diff)
downloaddexon-solidity-305f54b23f9643538a7e3a06d855271be0949035.tar.gz
dexon-solidity-305f54b23f9643538a7e3a06d855271be0949035.tar.zst
dexon-solidity-305f54b23f9643538a7e3a06d855271be0949035.zip
Minor Style fixes
-rw-r--r--AST.cpp6
-rwxr-xr-xAST.h16
-rw-r--r--Token.h12
-rw-r--r--Types.cpp18
4 files changed, 28 insertions, 24 deletions
diff --git a/AST.cpp b/AST.cpp
index 307168ed..455dc44a 100644
--- a/AST.cpp
+++ b/AST.cpp
@@ -599,10 +599,10 @@ Literal::Literal(Location const& _location, Token::Value _token,
Token::Value _sub):
PrimaryExpression(_location), m_token(_token), m_value(_value)
{
- if(Token::isEtherSubdenomination(_sub))
- m_subDenomination = static_cast<Literal::ethSubDenomination>(_sub);
+ if (Token::isEtherSubdenomination(_sub))
+ m_subDenomination = static_cast<Literal::SubDenomination>(_sub);
else
- m_subDenomination = Literal::ethSubDenomination::NONE;
+ m_subDenomination = Literal::SubDenomination::NONE;
}
void Literal::checkTypeRequirements()
diff --git a/AST.h b/AST.h
index ecf91c05..193e7310 100755
--- a/AST.h
+++ b/AST.h
@@ -1117,12 +1117,14 @@ private:
class Literal: public PrimaryExpression
{
public:
- enum class ethSubDenomination {
+ enum class SubDenomination
+ {
NONE = Token::ILLEGAL,
- WEI = Token::ETH_SUB_WEI,
- SZABO = Token::ETH_SUB_SZABO,
- FINNEY = Token::ETH_SUB_FINNEY,
- ETHER = Token::ETH_SUB_ETHER};
+ WEI = Token::SubWei,
+ SZABO = Token::SubSzabo,
+ FINNEY = Token::SubFinney,
+ ETHER = Token::SubEther
+ };
Literal(Location const& _location, Token::Value _token,
ASTPointer<ASTString> const& _value,
Token::Value _sub = Token::ILLEGAL);
@@ -1134,12 +1136,12 @@ public:
/// @returns the non-parsed value of the literal
ASTString const& getValue() const { return *m_value; }
- ethSubDenomination getSubDenomination() const { return m_subDenomination; }
+ SubDenomination getSubDenomination() const { return m_subDenomination; }
private:
Token::Value m_token;
ASTPointer<ASTString> m_value;
- ethSubDenomination m_subDenomination;
+ SubDenomination m_subDenomination;
};
/// @}
diff --git a/Token.h b/Token.h
index f2beefd9..b07fc46c 100644
--- a/Token.h
+++ b/Token.h
@@ -174,11 +174,11 @@ namespace solidity
K(WHILE, "while", 0) \
\
\
- /* Ether subdenominations */ \
- K(ETH_SUB_WEI, "wei", 0) \
- K(ETH_SUB_SZABO, "szabo", 0) \
- K(ETH_SUB_FINNEY, "finney", 0) \
- K(ETH_SUB_ETHER, "ether", 0) \
+ /* Ether subdenominations */ \
+ K(SubWei, "wei", 0) \
+ K(SubSzabo, "szabo", 0) \
+ K(SubFinney, "finney", 0) \
+ K(SubEther, "ether", 0) \
/* type keywords, keep them in this order, keep int as first keyword
* the implementation in Types.cpp has to be synced to this here
* TODO more to be added */ \
@@ -383,7 +383,7 @@ public:
static bool isCountOp(Value op) { return op == INC || op == DEC; }
static bool isShiftOp(Value op) { return (SHL <= op) && (op <= SHR); }
static bool isVisibilitySpecifier(Value op) { return op == PUBLIC || op == PRIVATE || op == PROTECTED; }
- static bool isEtherSubdenomination(Value op) { return op == ETH_SUB_WEI || op == ETH_SUB_SZABO || op == ETH_SUB_FINNEY || op == Token::ETH_SUB_ETHER; }
+ static bool isEtherSubdenomination(Value op) { return op == SubWei || op == SubSzabo || op == SubFinney || op == Token::SubEther; }
// Returns a string corresponding to the JS token string
// (.e., "<" for the token LT) or NULL if the token doesn't
diff --git a/Types.cpp b/Types.cpp
index c554f355..a8b3add4 100644
--- a/Types.cpp
+++ b/Types.cpp
@@ -338,19 +338,21 @@ u256 IntegerConstantType::literalValue(Literal const* _literal) const
else
value = s2u(s256(m_value));
- if (_literal) {
- Literal::ethSubDenomination sub =_literal->getSubDenomination();
- switch(sub) {
- case Literal::ethSubDenomination::WEI:
- case Literal::ethSubDenomination::NONE:
+ if (_literal)
+ {
+ Literal::SubDenomination sub =_literal->getSubDenomination();
+ switch(sub)
+ {
+ case Literal::SubDenomination::WEI:
+ case Literal::SubDenomination::NONE:
break;
- case Literal::ethSubDenomination::SZABO:
+ case Literal::SubDenomination::SZABO:
value *= u256(1000000000000);
break;
- case Literal::ethSubDenomination::FINNEY:
+ case Literal::SubDenomination::FINNEY:
value *= u256(1000000000000000);
break;
- case Literal::ethSubDenomination::ETHER:
+ case Literal::SubDenomination::ETHER:
value *= u256(1000000000000000000);
break;
}