From fd046d7c9088498fbb0bded6a8ca69554155f483 Mon Sep 17 00:00:00 2001 From: Christian Date: Thu, 23 Oct 2014 00:24:07 +0200 Subject: [PATCH] Corrected spacing around colon. --- AST.h | 113 ++++++++++++++++++++-------------------- ASTPrinter.cpp | 4 +- NameAndTypeResolver.cpp | 13 ++--- NameAndTypeResolver.h | 2 +- Parser.cpp | 3 +- Scanner.h | 2 +- Types.cpp | 4 +- 7 files changed, 68 insertions(+), 73 deletions(-) diff --git a/AST.h b/AST.h index 0f015ab3d..d5e1e0662 100644 --- a/AST.h +++ b/AST.h @@ -43,9 +43,7 @@ class ASTVisitor; class ASTNode: private boost::noncopyable { public: - explicit ASTNode(Location const& _location) - : m_location(_location) - {} + explicit ASTNode(Location const& _location): m_location(_location) {} virtual ~ASTNode() {} @@ -66,8 +64,8 @@ private: class Declaration: public ASTNode { public: - Declaration(Location const& _location, ASTPointer const& _name) - : ASTNode(_location), m_name(_name) {} + Declaration(Location const& _location, ASTPointer const& _name): + ASTNode(_location), m_name(_name) {} const ASTString& getName() const { return *m_name; } @@ -82,11 +80,11 @@ public: ASTPointer const& _name, std::vector> const& _definedStructs, std::vector> const& _stateVariables, - std::vector> const& _definedFunctions) - : Declaration(_location, _name), - m_definedStructs(_definedStructs), - m_stateVariables(_stateVariables), - m_definedFunctions(_definedFunctions) + std::vector> const& _definedFunctions): + Declaration(_location, _name), + m_definedStructs(_definedStructs), + m_stateVariables(_stateVariables), + m_definedFunctions(_definedFunctions) {} virtual void accept(ASTVisitor& _visitor) override; @@ -106,8 +104,8 @@ class StructDefinition: public Declaration public: StructDefinition(Location const& _location, ASTPointer const& _name, - std::vector> const& _members) - : Declaration(_location, _name), m_members(_members) {} + std::vector> const& _members): + Declaration(_location, _name), m_members(_members) {} virtual void accept(ASTVisitor& _visitor) override; private: @@ -120,8 +118,9 @@ private: class ParameterList: public ASTNode { public: - ParameterList(Location const& _location, std::vector> const& _parameters) - : ASTNode(_location), m_parameters(_parameters) {} + ParameterList(Location const& _location, + std::vector> const& _parameters): + ASTNode(_location), m_parameters(_parameters) {} virtual void accept(ASTVisitor& _visitor) override; std::vector> const& getParameters() { return m_parameters; } @@ -137,10 +136,10 @@ public: ASTPointer const& _parameters, bool _isDeclaredConst, ASTPointer const& _returnParameters, - ASTPointer const& _body) - : Declaration(_location, _name), m_isPublic(_isPublic), m_parameters(_parameters), - m_isDeclaredConst(_isDeclaredConst), m_returnParameters(_returnParameters), - m_body(_body) {} + ASTPointer const& _body): + Declaration(_location, _name), m_isPublic(_isPublic), m_parameters(_parameters), + m_isDeclaredConst(_isDeclaredConst), m_returnParameters(_returnParameters), + m_body(_body) {} virtual void accept(ASTVisitor& _visitor) override; bool isPublic() const { return m_isPublic; } @@ -162,8 +161,8 @@ class VariableDeclaration: public Declaration { public: VariableDeclaration(Location const& _location, ASTPointer const& _type, - ASTPointer const& _name) - : Declaration(_location, _name), m_typeName(_type) {} + ASTPointer const& _name): + Declaration(_location, _name), m_typeName(_type) {} virtual void accept(ASTVisitor& _visitor) override; bool isTypeGivenExplicitly() const { return m_typeName.get() != nullptr; } @@ -196,8 +195,8 @@ public: class ElementaryTypeName: public TypeName { public: - explicit ElementaryTypeName(Location const& _location, Token::Value _type) - : TypeName(_location), m_type(_type) {} + explicit ElementaryTypeName(Location const& _location, Token::Value _type): + TypeName(_location), m_type(_type) {} virtual void accept(ASTVisitor& _visitor) override; virtual std::shared_ptr toType() override { return Type::fromElementaryTypeName(m_type); } @@ -210,8 +209,8 @@ private: class UserDefinedTypeName: public TypeName { public: - UserDefinedTypeName(Location const& _location, ASTPointer const& _name) - : TypeName(_location), m_name(_name) {} + UserDefinedTypeName(Location const& _location, ASTPointer const& _name): + TypeName(_location), m_name(_name) {} virtual void accept(ASTVisitor& _visitor) override; virtual std::shared_ptr toType() override { return Type::fromUserDefinedTypeName(*this); } @@ -229,8 +228,8 @@ class Mapping: public TypeName { public: Mapping(Location const& _location, ASTPointer const& _keyType, - ASTPointer const& _valueType) - : TypeName(_location), m_keyType(_keyType), m_valueType(_valueType) {} + ASTPointer const& _valueType): + TypeName(_location), m_keyType(_keyType), m_valueType(_valueType) {} virtual void accept(ASTVisitor& _visitor) override; virtual std::shared_ptr toType() override { return Type::fromMapping(*this); } @@ -264,8 +263,8 @@ protected: class Block: public Statement { public: - Block(Location const& _location, std::vector> const& _statements) - : Statement(_location), m_statements(_statements) {} + Block(Location const& _location, std::vector> const& _statements): + Statement(_location), m_statements(_statements) {} virtual void accept(ASTVisitor& _visitor) override; virtual void checkTypeRequirements() override; @@ -278,9 +277,9 @@ class IfStatement: public Statement { public: IfStatement(Location const& _location, ASTPointer const& _condition, - ASTPointer const& _trueBody, ASTPointer const& _falseBody) - : Statement(_location), m_condition(_condition), - m_trueBody(_trueBody), m_falseBody(_falseBody) {} + ASTPointer const& _trueBody, ASTPointer const& _falseBody): + Statement(_location), + m_condition(_condition), m_trueBody(_trueBody), m_falseBody(_falseBody) {} virtual void accept(ASTVisitor& _visitor) override; virtual void checkTypeRequirements() override; @@ -301,8 +300,8 @@ class WhileStatement: public BreakableStatement { public: WhileStatement(Location const& _location, ASTPointer const& _condition, - ASTPointer const& _body) - : BreakableStatement(_location), m_condition(_condition), m_body(_body) {} + ASTPointer const& _body): + BreakableStatement(_location), m_condition(_condition), m_body(_body) {} virtual void accept(ASTVisitor& _visitor) override; virtual void checkTypeRequirements() override; @@ -330,8 +329,8 @@ public: class Return: public Statement { public: - Return(Location const& _location, ASTPointer _expression) - : Statement(_location), m_expression(_expression) {} + Return(Location const& _location, ASTPointer _expression): + Statement(_location), m_expression(_expression) {} virtual void accept(ASTVisitor& _visitor) override; virtual void checkTypeRequirements() override; @@ -347,8 +346,8 @@ class VariableDefinition: public Statement { public: VariableDefinition(Location const& _location, ASTPointer _variable, - ASTPointer _value) - : Statement(_location), m_variable(_variable), m_value(_value) {} + ASTPointer _value): + Statement(_location), m_variable(_variable), m_value(_value) {} virtual void accept(ASTVisitor& _visitor) override; virtual void checkTypeRequirements() override; @@ -377,9 +376,9 @@ class Assignment: public Expression { public: Assignment(Location const& _location, ASTPointer const& _leftHandSide, - Token::Value _assignmentOperator, ASTPointer const& _rightHandSide) - : Expression(_location), m_leftHandSide(_leftHandSide), - m_assigmentOperator(_assignmentOperator), m_rightHandSide(_rightHandSide) {} + Token::Value _assignmentOperator, ASTPointer const& _rightHandSide): + Expression(_location), m_leftHandSide(_leftHandSide), + m_assigmentOperator(_assignmentOperator), m_rightHandSide(_rightHandSide) {} virtual void accept(ASTVisitor& _visitor) override; virtual void checkTypeRequirements() override; @@ -395,9 +394,9 @@ class UnaryOperation: public Expression { public: UnaryOperation(Location const& _location, Token::Value _operator, - ASTPointer const& _subExpression, bool _isPrefix) - : Expression(_location), m_operator(_operator), - m_subExpression(_subExpression), m_isPrefix(_isPrefix) {} + ASTPointer const& _subExpression, bool _isPrefix): + Expression(_location), m_operator(_operator), + m_subExpression(_subExpression), m_isPrefix(_isPrefix) {} virtual void accept(ASTVisitor& _visitor) override; virtual void checkTypeRequirements() override; @@ -414,8 +413,8 @@ class BinaryOperation: public Expression { public: BinaryOperation(Location const& _location, ASTPointer const& _left, - Token::Value _operator, ASTPointer const& _right) - : Expression(_location), m_left(_left), m_operator(_operator), m_right(_right) {} + Token::Value _operator, ASTPointer const& _right): + Expression(_location), m_left(_left), m_operator(_operator), m_right(_right) {} virtual void accept(ASTVisitor& _visitor) override; virtual void checkTypeRequirements() override; @@ -434,8 +433,8 @@ class FunctionCall: public Expression { public: FunctionCall(Location const& _location, ASTPointer const& _expression, - std::vector> const& _arguments) - : Expression(_location), m_expression(_expression), m_arguments(_arguments) {} + std::vector> const& _arguments): + Expression(_location), m_expression(_expression), m_arguments(_arguments) {} virtual void accept(ASTVisitor& _visitor) override; virtual void checkTypeRequirements() override; @@ -448,8 +447,8 @@ class MemberAccess: public Expression { public: MemberAccess(Location const& _location, ASTPointer _expression, - ASTPointer const& _memberName) - : Expression(_location), m_expression(_expression), m_memberName(_memberName) {} + ASTPointer const& _memberName): + Expression(_location), m_expression(_expression), m_memberName(_memberName) {} virtual void accept(ASTVisitor& _visitor) override; const ASTString& getMemberName() const { return *m_memberName; } virtual void checkTypeRequirements() override; @@ -463,8 +462,8 @@ class IndexAccess: public Expression { public: IndexAccess(Location const& _location, ASTPointer const& _base, - ASTPointer const& _index) - : Expression(_location), m_base(_base), m_index(_index) {} + ASTPointer const& _index): + Expression(_location), m_base(_base), m_index(_index) {} virtual void accept(ASTVisitor& _visitor) override; virtual void checkTypeRequirements() override; @@ -482,8 +481,8 @@ public: class Identifier: public PrimaryExpression { public: - Identifier(Location const& _location, ASTPointer const& _name) - : PrimaryExpression(_location), m_name(_name) {} + Identifier(Location const& _location, ASTPointer const& _name): + PrimaryExpression(_location), m_name(_name) {} virtual void accept(ASTVisitor& _visitor) override; virtual void checkTypeRequirements() override; @@ -501,8 +500,8 @@ private: class ElementaryTypeNameExpression: public PrimaryExpression { public: - ElementaryTypeNameExpression(Location const& _location, Token::Value _typeToken) - : PrimaryExpression(_location), m_typeToken(_typeToken) {} + ElementaryTypeNameExpression(Location const& _location, Token::Value _typeToken): + PrimaryExpression(_location), m_typeToken(_typeToken) {} virtual void accept(ASTVisitor& _visitor) override; virtual void checkTypeRequirements() override; @@ -515,8 +514,8 @@ private: class Literal: public PrimaryExpression { public: - Literal(Location const& _location, Token::Value _token, ASTPointer const& _value) - : PrimaryExpression(_location), m_token(_token), m_value(_value) {} + Literal(Location const& _location, Token::Value _token, ASTPointer const& _value): + PrimaryExpression(_location), m_token(_token), m_value(_value) {} virtual void accept(ASTVisitor& _visitor) override; virtual void checkTypeRequirements() override; diff --git a/ASTPrinter.cpp b/ASTPrinter.cpp index af8f20157..c512bd3f9 100644 --- a/ASTPrinter.cpp +++ b/ASTPrinter.cpp @@ -28,8 +28,8 @@ namespace dev namespace solidity { -ASTPrinter::ASTPrinter(ASTPointer const& _ast, std::string const& _source) - : m_indentation(0), m_source(_source), m_ast(_ast) +ASTPrinter::ASTPrinter(ASTPointer const& _ast, std::string const& _source): + m_indentation(0), m_source(_source), m_ast(_ast) { } diff --git a/NameAndTypeResolver.cpp b/NameAndTypeResolver.cpp index 84b12a238..707b6ce14 100644 --- a/NameAndTypeResolver.cpp +++ b/NameAndTypeResolver.cpp @@ -32,10 +32,6 @@ namespace solidity { -NameAndTypeResolver::NameAndTypeResolver() -{ -} - void NameAndTypeResolver::resolveNamesAndTypes(ContractDefinition& _contract) { reset(); @@ -72,8 +68,9 @@ Declaration* NameAndTypeResolver::getNameFromCurrentScope(ASTString const& _name } -DeclarationRegistrationHelper::DeclarationRegistrationHelper(std::map& _scopes, ASTNode& _astRoot) - : m_scopes(_scopes), m_currentScope(&m_scopes[nullptr]) +DeclarationRegistrationHelper::DeclarationRegistrationHelper(std::map& _scopes, + ASTNode& _astRoot): + m_scopes(_scopes), m_currentScope(&m_scopes[nullptr]) { _astRoot.accept(*this); } @@ -146,8 +143,8 @@ void DeclarationRegistrationHelper::registerDeclaration(Declaration& _declaratio } ReferencesResolver::ReferencesResolver(ASTNode& _root, NameAndTypeResolver& _resolver, - ParameterList* _returnParameters) - : m_resolver(_resolver), m_returnParameters(_returnParameters) + ParameterList* _returnParameters): + m_resolver(_resolver), m_returnParameters(_returnParameters) { _root.accept(*this); } diff --git a/NameAndTypeResolver.h b/NameAndTypeResolver.h index 5305565b3..7abcbb0c5 100644 --- a/NameAndTypeResolver.h +++ b/NameAndTypeResolver.h @@ -38,7 +38,7 @@ namespace solidity class NameAndTypeResolver: private boost::noncopyable { public: - NameAndTypeResolver(); + NameAndTypeResolver() {} void resolveNamesAndTypes(ContractDefinition& _contract); Declaration* getNameFromCurrentScope(ASTString const& _name, bool _recursive = true); diff --git a/Parser.cpp b/Parser.cpp index 7b1fdeb28..408aa7bd6 100644 --- a/Parser.cpp +++ b/Parser.cpp @@ -43,7 +43,7 @@ ASTPointer Parser::parse(std::shared_ptr const& _sc class Parser::ASTNodeFactory { public: - ASTNodeFactory(Parser const& _parser) : m_parser(_parser), m_location(_parser.getPosition(), -1) {} + ASTNodeFactory(Parser const& _parser): m_parser(_parser), m_location(_parser.getPosition(), -1) {} void markEndPosition() { m_location.end = m_parser.getEndPosition(); } void setLocationEmpty() { m_location.end = m_location.start; } @@ -73,7 +73,6 @@ int Parser::getEndPosition() const return m_scanner->getCurrentLocation().end; } - ASTPointer Parser::parseContractDefinition() { ASTNodeFactory nodeFactory(*this); diff --git a/Scanner.h b/Scanner.h index 232b300a5..adae10dca 100644 --- a/Scanner.h +++ b/Scanner.h @@ -73,7 +73,7 @@ class ParserRecorder; class CharStream { public: - CharStream() : m_pos(0) {} + CharStream(): m_pos(0) {} explicit CharStream(std::string const& _source): m_source(_source), m_pos(0) {} int getPos() const { return m_pos; } bool isPastEndOfInput() const { return m_pos >= m_source.size(); } diff --git a/Types.cpp b/Types.cpp index 88abbc77d..7634951a1 100644 --- a/Types.cpp +++ b/Types.cpp @@ -85,8 +85,8 @@ std::shared_ptr IntegerType::smallestTypeForLiteral(std::string con return std::make_shared(256, Modifier::UNSIGNED); } -IntegerType::IntegerType(int _bits, IntegerType::Modifier _modifier) - : m_bits(_bits), m_modifier(_modifier) +IntegerType::IntegerType(int _bits, IntegerType::Modifier _modifier): + m_bits(_bits), m_modifier(_modifier) { BOOST_ASSERT(_bits > 0 && _bits <= 256 && _bits % 8 == 0); if (isAddress())