mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Minor Style fixes
This commit is contained in:
parent
eaadc71b4c
commit
305f54b23f
6
AST.cpp
6
AST.cpp
@ -599,10 +599,10 @@ Literal::Literal(Location const& _location, Token::Value _token,
|
|||||||
Token::Value _sub):
|
Token::Value _sub):
|
||||||
PrimaryExpression(_location), m_token(_token), m_value(_value)
|
PrimaryExpression(_location), m_token(_token), m_value(_value)
|
||||||
{
|
{
|
||||||
if(Token::isEtherSubdenomination(_sub))
|
if (Token::isEtherSubdenomination(_sub))
|
||||||
m_subDenomination = static_cast<Literal::ethSubDenomination>(_sub);
|
m_subDenomination = static_cast<Literal::SubDenomination>(_sub);
|
||||||
else
|
else
|
||||||
m_subDenomination = Literal::ethSubDenomination::NONE;
|
m_subDenomination = Literal::SubDenomination::NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Literal::checkTypeRequirements()
|
void Literal::checkTypeRequirements()
|
||||||
|
16
AST.h
16
AST.h
@ -1117,12 +1117,14 @@ private:
|
|||||||
class Literal: public PrimaryExpression
|
class Literal: public PrimaryExpression
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum class ethSubDenomination {
|
enum class SubDenomination
|
||||||
|
{
|
||||||
NONE = Token::ILLEGAL,
|
NONE = Token::ILLEGAL,
|
||||||
WEI = Token::ETH_SUB_WEI,
|
WEI = Token::SubWei,
|
||||||
SZABO = Token::ETH_SUB_SZABO,
|
SZABO = Token::SubSzabo,
|
||||||
FINNEY = Token::ETH_SUB_FINNEY,
|
FINNEY = Token::SubFinney,
|
||||||
ETHER = Token::ETH_SUB_ETHER};
|
ETHER = Token::SubEther
|
||||||
|
};
|
||||||
Literal(Location const& _location, Token::Value _token,
|
Literal(Location const& _location, Token::Value _token,
|
||||||
ASTPointer<ASTString> const& _value,
|
ASTPointer<ASTString> const& _value,
|
||||||
Token::Value _sub = Token::ILLEGAL);
|
Token::Value _sub = Token::ILLEGAL);
|
||||||
@ -1134,12 +1136,12 @@ public:
|
|||||||
/// @returns the non-parsed value of the literal
|
/// @returns the non-parsed value of the literal
|
||||||
ASTString const& getValue() const { return *m_value; }
|
ASTString const& getValue() const { return *m_value; }
|
||||||
|
|
||||||
ethSubDenomination getSubDenomination() const { return m_subDenomination; }
|
SubDenomination getSubDenomination() const { return m_subDenomination; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Token::Value m_token;
|
Token::Value m_token;
|
||||||
ASTPointer<ASTString> m_value;
|
ASTPointer<ASTString> m_value;
|
||||||
ethSubDenomination m_subDenomination;
|
SubDenomination m_subDenomination;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
12
Token.h
12
Token.h
@ -174,11 +174,11 @@ namespace solidity
|
|||||||
K(WHILE, "while", 0) \
|
K(WHILE, "while", 0) \
|
||||||
\
|
\
|
||||||
\
|
\
|
||||||
/* Ether subdenominations */ \
|
/* Ether subdenominations */ \
|
||||||
K(ETH_SUB_WEI, "wei", 0) \
|
K(SubWei, "wei", 0) \
|
||||||
K(ETH_SUB_SZABO, "szabo", 0) \
|
K(SubSzabo, "szabo", 0) \
|
||||||
K(ETH_SUB_FINNEY, "finney", 0) \
|
K(SubFinney, "finney", 0) \
|
||||||
K(ETH_SUB_ETHER, "ether", 0) \
|
K(SubEther, "ether", 0) \
|
||||||
/* type keywords, keep them in this order, keep int as first keyword
|
/* type keywords, keep them in this order, keep int as first keyword
|
||||||
* the implementation in Types.cpp has to be synced to this here
|
* the implementation in Types.cpp has to be synced to this here
|
||||||
* TODO more to be added */ \
|
* TODO more to be added */ \
|
||||||
@ -383,7 +383,7 @@ public:
|
|||||||
static bool isCountOp(Value op) { return op == INC || op == DEC; }
|
static bool isCountOp(Value op) { return op == INC || op == DEC; }
|
||||||
static bool isShiftOp(Value op) { return (SHL <= op) && (op <= SHR); }
|
static bool isShiftOp(Value op) { return (SHL <= op) && (op <= SHR); }
|
||||||
static bool isVisibilitySpecifier(Value op) { return op == PUBLIC || op == PRIVATE || op == PROTECTED; }
|
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
|
// Returns a string corresponding to the JS token string
|
||||||
// (.e., "<" for the token LT) or NULL if the token doesn't
|
// (.e., "<" for the token LT) or NULL if the token doesn't
|
||||||
|
18
Types.cpp
18
Types.cpp
@ -338,19 +338,21 @@ u256 IntegerConstantType::literalValue(Literal const* _literal) const
|
|||||||
else
|
else
|
||||||
value = s2u(s256(m_value));
|
value = s2u(s256(m_value));
|
||||||
|
|
||||||
if (_literal) {
|
if (_literal)
|
||||||
Literal::ethSubDenomination sub =_literal->getSubDenomination();
|
{
|
||||||
switch(sub) {
|
Literal::SubDenomination sub =_literal->getSubDenomination();
|
||||||
case Literal::ethSubDenomination::WEI:
|
switch(sub)
|
||||||
case Literal::ethSubDenomination::NONE:
|
{
|
||||||
|
case Literal::SubDenomination::WEI:
|
||||||
|
case Literal::SubDenomination::NONE:
|
||||||
break;
|
break;
|
||||||
case Literal::ethSubDenomination::SZABO:
|
case Literal::SubDenomination::SZABO:
|
||||||
value *= u256(1000000000000);
|
value *= u256(1000000000000);
|
||||||
break;
|
break;
|
||||||
case Literal::ethSubDenomination::FINNEY:
|
case Literal::SubDenomination::FINNEY:
|
||||||
value *= u256(1000000000000000);
|
value *= u256(1000000000000000);
|
||||||
break;
|
break;
|
||||||
case Literal::ethSubDenomination::ETHER:
|
case Literal::SubDenomination::ETHER:
|
||||||
value *= u256(1000000000000000000);
|
value *= u256(1000000000000000000);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user