Browse Source

Stylistic corrections.

cl-refactor
Christian 11 years ago
parent
commit
d7278b3d34
  1. 22
      libsolidity/AST.h
  2. 10
      libsolidity/Compiler.cpp
  3. 16
      libsolidity/NameAndTypeResolver.h

22
libsolidity/AST.h

@ -191,8 +191,8 @@ public:
bool isTypeGivenExplicitly() const { return bool(m_typeName); }
TypeName* getTypeName() const { return m_typeName.get(); }
//! 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.
/// 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.
std::shared_ptr<Type const> const& getType() const { return m_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) {}
virtual void accept(ASTVisitor& _visitor) override;
//! 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
//! the number of function call arguments matches the number of formal parameters and so forth.
/// 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
/// the number of function call arguments matches the number of formal parameters and so forth.
virtual void checkTypeRequirements() = 0;
protected:
//! 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.
/// 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.
void expectType(Expression& _expression, Type const& _expectedType);
};
@ -407,7 +407,7 @@ public:
std::shared_ptr<Type const> const& getType() const { return m_type; }
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;
};
@ -532,8 +532,8 @@ private:
ASTPointer<Expression> m_index;
};
/// Primary expression, i.e. an expression that do not be divided any further like a literal or
/// a variable reference.
/// Primary expression, i.e. an expression that cannot be divided any further. Examples are literals
/// or variable references.
class PrimaryExpression: public Expression
{
public:
@ -557,7 +557,7 @@ public:
private:
ASTPointer<ASTString> m_name;
//! Declaration the name refers to.
/// Declaration the name refers to.
Declaration* m_referencedDeclaration;
};

10
libsolidity/Compiler.cpp

@ -25,11 +25,9 @@
#include <libsolidity/AST.h>
#include <libsolidity/Compiler.h>
namespace dev {
namespace solidity {
void CompilerContext::setLabelPosition(uint32_t _label, uint32_t _position)
{
assert(m_labelPositions.find(_label) == m_labelPositions.end());
@ -63,12 +61,10 @@ bytes ExpressionCompiler::getAssembledBytecode() const
}
for (AssemblyItem const& item: m_assemblyItems)
{
if (item.getType() == AssemblyItem::Type::LABELREF)
assembled.push_back(m_context.getLabelPosition(item.getLabel()));
else
assembled.push_back(item.getData());
}
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&)
{
}

16
libsolidity/NameAndTypeResolver.h

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

Loading…
Cancel
Save