Stylistic corrections.

This commit is contained in:
Christian 2014-10-28 09:25:01 +01:00
parent a29eb889a2
commit fae8ca001e
3 changed files with 22 additions and 26 deletions

22
AST.h
View File

@ -191,8 +191,8 @@ public:
bool isTypeGivenExplicitly() const { return bool(m_typeName); } bool isTypeGivenExplicitly() const { return bool(m_typeName); }
TypeName* getTypeName() const { return m_typeName.get(); } TypeName* getTypeName() const { return m_typeName.get(); }
//! Returns the declared or inferred type. Can be an empty pointer if no type was explicitly /// Returns the declared or inferred type. Can be an empty pointer if no type was explicitly
//! declared and there is no assignment to the variable that fixes the type. /// declared and there is no assignment to the variable that fixes the type.
std::shared_ptr<Type const> const& getType() const { return m_type; } std::shared_ptr<Type const> const& getType() const { return m_type; }
void setType(std::shared_ptr<Type const> const& _type) { m_type = _type; } void setType(std::shared_ptr<Type const> const& _type) { m_type = _type; }
@ -281,14 +281,14 @@ public:
explicit Statement(Location const& _location): ASTNode(_location) {} explicit Statement(Location const& _location): ASTNode(_location) {}
virtual void accept(ASTVisitor& _visitor) override; virtual void accept(ASTVisitor& _visitor) override;
//! Check all type requirements, throws exception if some requirement is not met. /// Check all type requirements, throws exception if some requirement is not met.
//! This includes checking that operators are applicable to their arguments but also that /// This includes checking that operators are applicable to their arguments but also that
//! the number of function call arguments matches the number of formal parameters and so forth. /// the number of function call arguments matches the number of formal parameters and so forth.
virtual void checkTypeRequirements() = 0; virtual void checkTypeRequirements() = 0;
protected: protected:
//! Helper function, check that the inferred type for @a _expression is @a _expectedType or at /// Helper function, check that the inferred type for @a _expression is @a _expectedType or at
//! least implicitly convertible to @a _expectedType. If not, throw exception. /// least implicitly convertible to @a _expectedType. If not, throw exception.
void expectType(Expression& _expression, Type const& _expectedType); void expectType(Expression& _expression, Type const& _expectedType);
}; };
@ -407,7 +407,7 @@ public:
std::shared_ptr<Type const> const& getType() const { return m_type; } std::shared_ptr<Type const> const& getType() const { return m_type; }
protected: protected:
//! Inferred type of the expression, only filled after a call to checkTypeRequirements(). /// Inferred type of the expression, only filled after a call to checkTypeRequirements().
std::shared_ptr<Type const> m_type; std::shared_ptr<Type const> m_type;
}; };
@ -532,8 +532,8 @@ private:
ASTPointer<Expression> m_index; ASTPointer<Expression> m_index;
}; };
/// Primary expression, i.e. an expression that do not be divided any further like a literal or /// Primary expression, i.e. an expression that cannot be divided any further. Examples are literals
/// a variable reference. /// or variable references.
class PrimaryExpression: public Expression class PrimaryExpression: public Expression
{ {
public: public:
@ -557,7 +557,7 @@ public:
private: private:
ASTPointer<ASTString> m_name; ASTPointer<ASTString> m_name;
//! Declaration the name refers to. /// Declaration the name refers to.
Declaration* m_referencedDeclaration; Declaration* m_referencedDeclaration;
}; };

View File

@ -25,11 +25,9 @@
#include <libsolidity/AST.h> #include <libsolidity/AST.h>
#include <libsolidity/Compiler.h> #include <libsolidity/Compiler.h>
namespace dev { namespace dev {
namespace solidity { namespace solidity {
void CompilerContext::setLabelPosition(uint32_t _label, uint32_t _position) void CompilerContext::setLabelPosition(uint32_t _label, uint32_t _position)
{ {
assert(m_labelPositions.find(_label) == m_labelPositions.end()); assert(m_labelPositions.find(_label) == m_labelPositions.end());
@ -63,12 +61,10 @@ bytes ExpressionCompiler::getAssembledBytecode() const
} }
for (AssemblyItem const& item: m_assemblyItems) for (AssemblyItem const& item: m_assemblyItems)
{
if (item.getType() == AssemblyItem::Type::LABELREF) if (item.getType() == AssemblyItem::Type::LABELREF)
assembled.push_back(m_context.getLabelPosition(item.getLabel())); assembled.push_back(m_context.getLabelPosition(item.getLabel()));
else else
assembled.push_back(item.getData()); assembled.push_back(item.getData());
}
return assembled; return assembled;
} }
@ -203,17 +199,17 @@ void ExpressionCompiler::endVisit(FunctionCall& _functionCall)
} }
} }
void ExpressionCompiler::endVisit(MemberAccess& _memberAccess) void ExpressionCompiler::endVisit(MemberAccess&)
{ {
} }
void ExpressionCompiler::endVisit(IndexAccess& _indexAccess) void ExpressionCompiler::endVisit(IndexAccess&)
{ {
} }
void ExpressionCompiler::endVisit(Identifier& _identifier) void ExpressionCompiler::endVisit(Identifier&)
{ {
} }

View File

@ -33,8 +33,8 @@ namespace dev
namespace solidity namespace solidity
{ {
//! Resolves name references, resolves all types and checks that all operations are valid for the /// Resolves name references, resolves all types and checks that all operations are valid for the
//! inferred types. An exception is throw on the first error. /// inferred types. An exception is throw on the first error.
class NameAndTypeResolver: private boost::noncopyable class NameAndTypeResolver: private boost::noncopyable
{ {
public: public:
@ -46,15 +46,15 @@ public:
private: private:
void reset(); void reset();
//! Maps nodes declaring a scope to scopes, i.e. ContractDefinition, FunctionDeclaration and /// Maps nodes declaring a scope to scopes, i.e. ContractDefinition, FunctionDeclaration and
//! StructDefinition (@todo not yet implemented), where nullptr denotes the global scope. /// StructDefinition (@todo not yet implemented), where nullptr denotes the global scope.
std::map<ASTNode*, Scope> m_scopes; std::map<ASTNode*, Scope> m_scopes;
Scope* m_currentScope; Scope* m_currentScope;
}; };
//! Traverses the given AST upon construction and fills _scopes with all declarations inside the /// Traverses the given AST upon construction and fills _scopes with all declarations inside the
//! AST. /// AST.
class DeclarationRegistrationHelper: private ASTVisitor class DeclarationRegistrationHelper: private ASTVisitor
{ {
public: public:
@ -78,8 +78,8 @@ private:
Scope* m_currentScope; Scope* m_currentScope;
}; };
//! Resolves references to declarations (of variables and types) and also establishes the link /// Resolves references to declarations (of variables and types) and also establishes the link
//! between a return statement and the return parameter list. /// between a return statement and the return parameter list.
class ReferencesResolver: private ASTVisitor class ReferencesResolver: private ASTVisitor
{ {
public: public: