mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Stylistic changes.
This commit is contained in:
parent
4dfd6dfa13
commit
ef546e789a
4
AST.cpp
4
AST.cpp
@ -333,11 +333,9 @@ void Assignment::checkTypeRequirements()
|
|||||||
m_rightHandSide->expectType(*m_leftHandSide->getType());
|
m_rightHandSide->expectType(*m_leftHandSide->getType());
|
||||||
m_type = m_leftHandSide->getType();
|
m_type = m_leftHandSide->getType();
|
||||||
if (m_assigmentOperator != Token::ASSIGN)
|
if (m_assigmentOperator != Token::ASSIGN)
|
||||||
{
|
|
||||||
// compound assignment
|
// compound assignment
|
||||||
if (!m_type->acceptsBinaryOperator(Token::AssignmentToBinaryOp(m_assigmentOperator)))
|
if (!m_type->acceptsBinaryOperator(Token::AssignmentToBinaryOp(m_assigmentOperator)))
|
||||||
BOOST_THROW_EXCEPTION(createTypeError("Operator not compatible with type."));
|
BOOST_THROW_EXCEPTION(createTypeError("Operator not compatible with type."));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExpressionStatement::checkTypeRequirements()
|
void ExpressionStatement::checkTypeRequirements()
|
||||||
@ -358,10 +356,8 @@ void UnaryOperation::checkTypeRequirements()
|
|||||||
// INC, DEC, ADD, SUB, NOT, BIT_NOT, DELETE
|
// INC, DEC, ADD, SUB, NOT, BIT_NOT, DELETE
|
||||||
m_subExpression->checkTypeRequirements();
|
m_subExpression->checkTypeRequirements();
|
||||||
if (m_operator == Token::Value::INC || m_operator == Token::Value::DEC || m_operator == Token::Value::DELETE)
|
if (m_operator == Token::Value::INC || m_operator == Token::Value::DEC || m_operator == Token::Value::DELETE)
|
||||||
{
|
|
||||||
if (!m_subExpression->isLvalue())
|
if (!m_subExpression->isLvalue())
|
||||||
BOOST_THROW_EXCEPTION(createTypeError("Expression has to be an lvalue."));
|
BOOST_THROW_EXCEPTION(createTypeError("Expression has to be an lvalue."));
|
||||||
}
|
|
||||||
m_type = m_subExpression->getType();
|
m_type = m_subExpression->getType();
|
||||||
if (!m_type->acceptsUnaryOperator(m_operator))
|
if (!m_type->acceptsUnaryOperator(m_operator))
|
||||||
BOOST_THROW_EXCEPTION(createTypeError("Unary operator not compatible with type."));
|
BOOST_THROW_EXCEPTION(createTypeError("Unary operator not compatible with type."));
|
||||||
|
5
AST.h
5
AST.h
@ -180,7 +180,8 @@ public:
|
|||||||
Block& getBody() { return *m_body; }
|
Block& getBody() { return *m_body; }
|
||||||
|
|
||||||
void addLocalVariable(VariableDeclaration const& _localVariable) { m_localVariables.push_back(&_localVariable); }
|
void addLocalVariable(VariableDeclaration const& _localVariable) { m_localVariables.push_back(&_localVariable); }
|
||||||
std::vector<VariableDeclaration const*>const& getLocalVariables() const { return m_localVariables; }
|
std::vector<VariableDeclaration const*> const& getLocalVariables() const { return m_localVariables; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_isPublic;
|
bool m_isPublic;
|
||||||
ASTPointer<ParameterList> m_parameters;
|
ASTPointer<ParameterList> m_parameters;
|
||||||
@ -345,6 +346,7 @@ public:
|
|||||||
Expression& getCondition() const { return *m_condition; }
|
Expression& getCondition() const { return *m_condition; }
|
||||||
Statement& getTrueStatement() const { return *m_trueBody; }
|
Statement& getTrueStatement() const { return *m_trueBody; }
|
||||||
Statement* getFalseStatement() const { return m_falseBody.get(); }
|
Statement* getFalseStatement() const { return m_falseBody.get(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ASTPointer<Expression> m_condition;
|
ASTPointer<Expression> m_condition;
|
||||||
ASTPointer<Statement> m_trueBody;
|
ASTPointer<Statement> m_trueBody;
|
||||||
@ -373,6 +375,7 @@ public:
|
|||||||
|
|
||||||
Expression& getCondition() const { return *m_condition; }
|
Expression& getCondition() const { return *m_condition; }
|
||||||
Statement& getBody() const { return *m_body; }
|
Statement& getBody() const { return *m_body; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ASTPointer<Expression> m_condition;
|
ASTPointer<Expression> m_condition;
|
||||||
ASTPointer<Statement> m_body;
|
ASTPointer<Statement> m_body;
|
||||||
|
Loading…
Reference in New Issue
Block a user