diff options
author | Lefteris Karapetsas <lefteris@refu.co> | 2015-02-06 05:38:07 +0800 |
---|---|---|
committer | Lefteris Karapetsas <lefteris@refu.co> | 2015-02-06 05:38:07 +0800 |
commit | 305f54b23f9643538a7e3a06d855271be0949035 (patch) | |
tree | 7d3820204b0df301e9c45e5a52d3575267530faa | |
parent | eaadc71b4c88603a7264211401d249ca1ead22e3 (diff) | |
download | dexon-solidity-305f54b23f9643538a7e3a06d855271be0949035.tar.gz dexon-solidity-305f54b23f9643538a7e3a06d855271be0949035.tar.zst dexon-solidity-305f54b23f9643538a7e3a06d855271be0949035.zip |
Minor Style fixes
-rw-r--r-- | AST.cpp | 6 | ||||
-rwxr-xr-x | AST.h | 16 | ||||
-rw-r--r-- | Token.h | 12 | ||||
-rw-r--r-- | Types.cpp | 18 |
4 files changed, 28 insertions, 24 deletions
@@ -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() @@ -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; }; /// @} @@ -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 @@ -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; } |