Style cleanup.

This commit is contained in:
chriseth 2015-09-24 11:03:44 +02:00
parent 52f7e35843
commit c49e58a201

View File

@ -142,8 +142,11 @@ public:
/// Visibility ordered from restricted to unrestricted. /// Visibility ordered from restricted to unrestricted.
enum class Visibility { Default, Private, Internal, Public, External }; enum class Visibility { Default, Private, Internal, Public, External };
Declaration(SourceLocation const& _location, ASTPointer<ASTString> const& _name, Declaration(
Visibility _visibility = Visibility::Default): SourceLocation const& _location,
ASTPointer<ASTString> const& _name,
Visibility _visibility = Visibility::Default
):
ASTNode(_location), m_name(_name), m_visibility(_visibility), m_scope(nullptr) {} ASTNode(_location), m_name(_name), m_visibility(_visibility), m_scope(nullptr) {}
/// @returns the declared name. /// @returns the declared name.
@ -396,8 +399,10 @@ public:
class ParameterList: public ASTNode class ParameterList: public ASTNode
{ {
public: public:
ParameterList(SourceLocation const& _location, ParameterList(
std::vector<ASTPointer<VariableDeclaration>> const& _parameters): SourceLocation const& _location,
std::vector<ASTPointer<VariableDeclaration>> const& _parameters
):
ASTNode(_location), m_parameters(_parameters) {} ASTNode(_location), m_parameters(_parameters) {}
virtual void accept(ASTVisitor& _visitor) override; virtual void accept(ASTVisitor& _visitor) override;
virtual void accept(ASTConstVisitor& _visitor) const override; virtual void accept(ASTConstVisitor& _visitor) const override;
@ -683,7 +688,7 @@ public:
class ElementaryTypeName: public TypeName class ElementaryTypeName: public TypeName
{ {
public: public:
explicit ElementaryTypeName(SourceLocation const& _location, Token::Value _type): ElementaryTypeName(SourceLocation const& _location, Token::Value _type):
TypeName(_location), m_type(_type) TypeName(_location), m_type(_type)
{ {
solAssert(Token::isElementaryTypeName(_type), ""); solAssert(Token::isElementaryTypeName(_type), "");
@ -722,8 +727,11 @@ private:
class Mapping: public TypeName class Mapping: public TypeName
{ {
public: public:
Mapping(SourceLocation const& _location, ASTPointer<ElementaryTypeName> const& _keyType, Mapping(
ASTPointer<TypeName> const& _valueType): SourceLocation const& _location,
ASTPointer<ElementaryTypeName> const& _keyType,
ASTPointer<TypeName> const& _valueType
):
TypeName(_location), m_keyType(_keyType), m_valueType(_valueType) {} TypeName(_location), m_keyType(_keyType), m_valueType(_valueType) {}
virtual void accept(ASTVisitor& _visitor) override; virtual void accept(ASTVisitor& _visitor) override;
virtual void accept(ASTConstVisitor& _visitor) const override; virtual void accept(ASTConstVisitor& _visitor) const override;
@ -742,8 +750,11 @@ private:
class ArrayTypeName: public TypeName class ArrayTypeName: public TypeName
{ {
public: public:
ArrayTypeName(SourceLocation const& _location, ASTPointer<TypeName> const& _baseType, ArrayTypeName(
ASTPointer<Expression> const& _length): SourceLocation const& _location,
ASTPointer<TypeName> const& _baseType,
ASTPointer<Expression> const& _length
):
TypeName(_location), m_baseType(_baseType), m_length(_length) {} TypeName(_location), m_baseType(_baseType), m_length(_length) {}
virtual void accept(ASTVisitor& _visitor) override; virtual void accept(ASTVisitor& _visitor) override;
virtual void accept(ASTConstVisitor& _visitor) const override; virtual void accept(ASTConstVisitor& _visitor) const override;
@ -777,7 +788,10 @@ public:
class Block: public Statement class Block: public Statement
{ {
public: public:
Block(SourceLocation const& _location, std::vector<ASTPointer<Statement>> const& _statements): Block(
SourceLocation const& _location,
std::vector<ASTPointer<Statement>> const& _statements
):
Statement(_location), m_statements(_statements) {} Statement(_location), m_statements(_statements) {}
virtual void accept(ASTVisitor& _visitor) override; virtual void accept(ASTVisitor& _visitor) override;
virtual void accept(ASTConstVisitor& _visitor) const override; virtual void accept(ASTConstVisitor& _visitor) const override;
@ -793,7 +807,7 @@ private:
class PlaceholderStatement: public Statement class PlaceholderStatement: public Statement
{ {
public: public:
PlaceholderStatement(SourceLocation const& _location): Statement(_location) {} explicit PlaceholderStatement(SourceLocation const& _location): Statement(_location) {}
virtual void accept(ASTVisitor& _visitor) override; virtual void accept(ASTVisitor& _visitor) override;
virtual void accept(ASTConstVisitor& _visitor) const override; virtual void accept(ASTConstVisitor& _visitor) const override;
@ -806,10 +820,17 @@ public:
class IfStatement: public Statement class IfStatement: public Statement
{ {
public: public:
IfStatement(SourceLocation const& _location, ASTPointer<Expression> const& _condition, IfStatement(
ASTPointer<Statement> const& _trueBody, ASTPointer<Statement> const& _falseBody): SourceLocation const& _location,
ASTPointer<Expression> const& _condition,
ASTPointer<Statement> const& _trueBody,
ASTPointer<Statement> const& _falseBody
):
Statement(_location), Statement(_location),
m_condition(_condition), m_trueBody(_trueBody), m_falseBody(_falseBody) {} m_condition(_condition),
m_trueBody(_trueBody),
m_falseBody(_falseBody)
{}
virtual void accept(ASTVisitor& _visitor) override; virtual void accept(ASTVisitor& _visitor) override;
virtual void accept(ASTConstVisitor& _visitor) const override; virtual void accept(ASTConstVisitor& _visitor) const override;
@ -830,14 +851,17 @@ private:
class BreakableStatement: public Statement class BreakableStatement: public Statement
{ {
public: public:
BreakableStatement(SourceLocation const& _location): Statement(_location) {} explicit BreakableStatement(SourceLocation const& _location): Statement(_location) {}
}; };
class WhileStatement: public BreakableStatement class WhileStatement: public BreakableStatement
{ {
public: public:
WhileStatement(SourceLocation const& _location, ASTPointer<Expression> const& _condition, WhileStatement(
ASTPointer<Statement> const& _body): SourceLocation const& _location,
ASTPointer<Expression> const& _condition,
ASTPointer<Statement> const& _body
):
BreakableStatement(_location), m_condition(_condition), m_body(_body) {} BreakableStatement(_location), m_condition(_condition), m_body(_body) {}
virtual void accept(ASTVisitor& _visitor) override; virtual void accept(ASTVisitor& _visitor) override;
virtual void accept(ASTConstVisitor& _visitor) const override; virtual void accept(ASTConstVisitor& _visitor) const override;
@ -891,7 +915,7 @@ private:
class Continue: public Statement class Continue: public Statement
{ {
public: public:
Continue(SourceLocation const& _location): Statement(_location) {} explicit Continue(SourceLocation const& _location): Statement(_location) {}
virtual void accept(ASTVisitor& _visitor) override; virtual void accept(ASTVisitor& _visitor) override;
virtual void accept(ASTConstVisitor& _visitor) const override; virtual void accept(ASTConstVisitor& _visitor) const override;
}; };
@ -899,7 +923,7 @@ public:
class Break: public Statement class Break: public Statement
{ {
public: public:
Break(SourceLocation const& _location): Statement(_location) {} explicit Break(SourceLocation const& _location): Statement(_location) {}
virtual void accept(ASTVisitor& _visitor) override; virtual void accept(ASTVisitor& _visitor) override;
virtual void accept(ASTConstVisitor& _visitor) const override; virtual void accept(ASTConstVisitor& _visitor) const override;
}; };
@ -926,7 +950,7 @@ private:
class Throw: public Statement class Throw: public Statement
{ {
public: public:
Throw(SourceLocation const& _location): Statement(_location) {} explicit Throw(SourceLocation const& _location): Statement(_location) {}
virtual void accept(ASTVisitor& _visitor) override; virtual void accept(ASTVisitor& _visitor) override;
virtual void accept(ASTConstVisitor& _visitor) const override; virtual void accept(ASTConstVisitor& _visitor) const override;
}; };
@ -957,7 +981,10 @@ private:
class ExpressionStatement: public Statement class ExpressionStatement: public Statement
{ {
public: public:
ExpressionStatement(SourceLocation const& _location, ASTPointer<Expression> _expression): ExpressionStatement(
SourceLocation const& _location,
ASTPointer<Expression> _expression
):
Statement(_location), m_expression(_expression) {} Statement(_location), m_expression(_expression) {}
virtual void accept(ASTVisitor& _visitor) override; virtual void accept(ASTVisitor& _visitor) override;
virtual void accept(ASTConstVisitor& _visitor) const override; virtual void accept(ASTConstVisitor& _visitor) const override;
@ -981,7 +1008,7 @@ private:
class Expression: public ASTNode class Expression: public ASTNode
{ {
public: public:
Expression(SourceLocation const& _location): ASTNode(_location) {} explicit Expression(SourceLocation const& _location): ASTNode(_location) {}
ExpressionAnnotation& annotation() const override; ExpressionAnnotation& annotation() const override;
}; };
@ -1024,10 +1051,16 @@ private:
class UnaryOperation: public Expression class UnaryOperation: public Expression
{ {
public: public:
UnaryOperation(SourceLocation const& _location, Token::Value _operator, UnaryOperation(
ASTPointer<Expression> const& _subExpression, bool _isPrefix): SourceLocation const& _location,
Expression(_location), m_operator(_operator), Token::Value _operator,
m_subExpression(_subExpression), m_isPrefix(_isPrefix) ASTPointer<Expression> const& _subExpression,
bool _isPrefix
):
Expression(_location),
m_operator(_operator),
m_subExpression(_subExpression),
m_isPrefix(_isPrefix)
{ {
solAssert(Token::isUnaryOp(_operator), ""); solAssert(Token::isUnaryOp(_operator), "");
} }
@ -1051,8 +1084,12 @@ private:
class BinaryOperation: public Expression class BinaryOperation: public Expression
{ {
public: public:
BinaryOperation(SourceLocation const& _location, ASTPointer<Expression> const& _left, BinaryOperation(
Token::Value _operator, ASTPointer<Expression> const& _right): SourceLocation const& _location,
ASTPointer<Expression> const& _left,
Token::Value _operator,
ASTPointer<Expression> const& _right
):
Expression(_location), m_left(_left), m_operator(_operator), m_right(_right) Expression(_location), m_left(_left), m_operator(_operator), m_right(_right)
{ {
solAssert(Token::isBinaryOp(_operator) || Token::isCompareOp(_operator), ""); solAssert(Token::isBinaryOp(_operator) || Token::isCompareOp(_operator), "");
@ -1078,8 +1115,12 @@ private:
class FunctionCall: public Expression class FunctionCall: public Expression
{ {
public: public:
FunctionCall(SourceLocation const& _location, ASTPointer<Expression> const& _expression, FunctionCall(
std::vector<ASTPointer<Expression>> const& _arguments, std::vector<ASTPointer<ASTString>> const& _names): SourceLocation const& _location,
ASTPointer<Expression> const& _expression,
std::vector<ASTPointer<Expression>> const& _arguments,
std::vector<ASTPointer<ASTString>> const& _names
):
Expression(_location), m_expression(_expression), m_arguments(_arguments), m_names(_names) {} Expression(_location), m_expression(_expression), m_arguments(_arguments), m_names(_names) {}
virtual void accept(ASTVisitor& _visitor) override; virtual void accept(ASTVisitor& _visitor) override;
virtual void accept(ASTConstVisitor& _visitor) const override; virtual void accept(ASTConstVisitor& _visitor) const override;
@ -1102,7 +1143,10 @@ private:
class NewExpression: public Expression class NewExpression: public Expression
{ {
public: public:
NewExpression(SourceLocation const& _location, ASTPointer<Identifier> const& _contractName): NewExpression(
SourceLocation const& _location,
ASTPointer<Identifier> const& _contractName
):
Expression(_location), m_contractName(_contractName) {} Expression(_location), m_contractName(_contractName) {}
virtual void accept(ASTVisitor& _visitor) override; virtual void accept(ASTVisitor& _visitor) override;
virtual void accept(ASTConstVisitor& _visitor) const override; virtual void accept(ASTConstVisitor& _visitor) const override;
@ -1119,8 +1163,11 @@ private:
class MemberAccess: public Expression class MemberAccess: public Expression
{ {
public: public:
MemberAccess(SourceLocation const& _location, ASTPointer<Expression> _expression, MemberAccess(
ASTPointer<ASTString> const& _memberName): SourceLocation const& _location,
ASTPointer<Expression> _expression,
ASTPointer<ASTString> const& _memberName
):
Expression(_location), m_expression(_expression), m_memberName(_memberName) {} Expression(_location), m_expression(_expression), m_memberName(_memberName) {}
virtual void accept(ASTVisitor& _visitor) override; virtual void accept(ASTVisitor& _visitor) override;
virtual void accept(ASTConstVisitor& _visitor) const override; virtual void accept(ASTConstVisitor& _visitor) const override;
@ -1140,8 +1187,11 @@ private:
class IndexAccess: public Expression class IndexAccess: public Expression
{ {
public: public:
IndexAccess(SourceLocation const& _location, ASTPointer<Expression> const& _base, IndexAccess(
ASTPointer<Expression> const& _index): SourceLocation const& _location,
ASTPointer<Expression> const& _base,
ASTPointer<Expression> const& _index
):
Expression(_location), m_base(_base), m_index(_index) {} Expression(_location), m_base(_base), m_index(_index) {}
virtual void accept(ASTVisitor& _visitor) override; virtual void accept(ASTVisitor& _visitor) override;
virtual void accept(ASTConstVisitor& _visitor) const override; virtual void accept(ASTConstVisitor& _visitor) const override;
@ -1170,7 +1220,10 @@ public:
class Identifier: public PrimaryExpression class Identifier: public PrimaryExpression
{ {
public: public:
Identifier(SourceLocation const& _location, ASTPointer<ASTString> const& _name): Identifier(
SourceLocation const& _location,
ASTPointer<ASTString> const& _name
):
PrimaryExpression(_location), m_name(_name) {} PrimaryExpression(_location), m_name(_name) {}
virtual void accept(ASTVisitor& _visitor) override; virtual void accept(ASTVisitor& _visitor) override;
virtual void accept(ASTConstVisitor& _visitor) const override; virtual void accept(ASTConstVisitor& _visitor) const override;
@ -1225,9 +1278,12 @@ public:
Week = Token::SubWeek, Week = Token::SubWeek,
Year = Token::SubYear Year = Token::SubYear
}; };
Literal(SourceLocation const& _location, Token::Value _token, Literal(
ASTPointer<ASTString> const& _value, SourceLocation const& _location,
SubDenomination _sub = SubDenomination::None): Token::Value _token,
ASTPointer<ASTString> const& _value,
SubDenomination _sub = SubDenomination::None
):
PrimaryExpression(_location), m_token(_token), m_value(_value), m_subDenomination(_sub) {} PrimaryExpression(_location), m_token(_token), m_value(_value), m_subDenomination(_sub) {}
virtual void accept(ASTVisitor& _visitor) override; virtual void accept(ASTVisitor& _visitor) override;
virtual void accept(ASTConstVisitor& _visitor) const override; virtual void accept(ASTConstVisitor& _visitor) const override;