Browse Source

Further const placement changes.

cl-refactor
Christian 10 years ago
parent
commit
c6c7f86b82
  1. 2
      libsolidity/AST.cpp
  2. 6
      libsolidity/AST.h
  3. 2
      libsolidity/ASTPrinter.h
  4. 4
      libsolidity/Scanner.h
  5. 2
      test/solidityCompiler.cpp
  6. 2
      test/solidityNameAndTypeResolution.cpp
  7. 2
      test/solidityParser.cpp

2
libsolidity/AST.cpp

@ -255,7 +255,7 @@ TypeError ASTNode::createTypeError(string const& _description)
return TypeError() << errinfo_sourceLocation(getLocation()) << errinfo_comment(_description); return TypeError() << errinfo_sourceLocation(getLocation()) << errinfo_comment(_description);
} }
void Statement::expectType(Expression& _expression, const Type& _expectedType) void Statement::expectType(Expression& _expression, Type const& _expectedType)
{ {
_expression.checkTypeRequirements(); _expression.checkTypeRequirements();
if (!_expression.getType()->isImplicitlyConvertibleTo(_expectedType)) if (!_expression.getType()->isImplicitlyConvertibleTo(_expectedType))

6
libsolidity/AST.h

@ -89,7 +89,7 @@ public:
ASTNode(_location), m_name(_name) {} ASTNode(_location), m_name(_name) {}
/// Returns the declared name. /// Returns the declared name.
const ASTString& getName() const { return *m_name; } ASTString const& getName() const { return *m_name; }
private: private:
ASTPointer<ASTString> m_name; ASTPointer<ASTString> m_name;
@ -259,7 +259,7 @@ public:
virtual void accept(ASTVisitor& _visitor) override; virtual void accept(ASTVisitor& _visitor) override;
virtual std::shared_ptr<Type> toType() override { return Type::fromUserDefinedTypeName(*this); } virtual std::shared_ptr<Type> toType() override { return Type::fromUserDefinedTypeName(*this); }
const ASTString& getName() const { return *m_name; } ASTString const& getName() const { return *m_name; }
void setReferencedStruct(StructDefinition& _referencedStruct) { m_referencedStruct = &_referencedStruct; } void setReferencedStruct(StructDefinition& _referencedStruct) { m_referencedStruct = &_referencedStruct; }
StructDefinition const* getReferencedStruct() const { return m_referencedStruct; } StructDefinition const* getReferencedStruct() const { return m_referencedStruct; }
@ -549,7 +549,7 @@ public:
ASTPointer<ASTString> const& _memberName): 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;
const ASTString& getMemberName() const { return *m_memberName; } ASTString const& getMemberName() const { return *m_memberName; }
virtual void checkTypeRequirements() override; virtual void checkTypeRequirements() override;
private: private:

2
libsolidity/ASTPrinter.h

@ -38,7 +38,7 @@ class ASTPrinter: public ASTVisitor
public: public:
/// Create a printer for the given abstract syntax tree. If the source is specified, /// Create a printer for the given abstract syntax tree. If the source is specified,
/// the corresponding parts of the source are printed with each node. /// the corresponding parts of the source are printed with each node.
ASTPrinter(ASTPointer<ASTNode> const& _ast, const std::string& _source = std::string()); ASTPrinter(ASTPointer<ASTNode> const& _ast, std::string const& _source = std::string());
/// Output the string representation of the AST to _stream. /// Output the string representation of the AST to _stream.
void print(std::ostream& _stream); void print(std::ostream& _stream);

4
libsolidity/Scanner.h

@ -124,7 +124,7 @@ public:
/// Returns the current token /// Returns the current token
Token::Value getCurrentToken() { return m_current_token.token; } Token::Value getCurrentToken() { return m_current_token.token; }
Location getCurrentLocation() const { return m_current_token.location; } Location getCurrentLocation() const { return m_current_token.location; }
const std::string& getCurrentLiteral() const { return m_current_token.literal; } std::string const& getCurrentLiteral() const { return m_current_token.literal; }
///@} ///@}
///@{ ///@{
@ -133,7 +133,7 @@ public:
/// Returns the next token without advancing input. /// Returns the next token without advancing input.
Token::Value peekNextToken() const { return m_next_token.token; } Token::Value peekNextToken() const { return m_next_token.token; }
Location peekLocation() const { return m_next_token.location; } Location peekLocation() const { return m_next_token.location; }
const std::string& peekLiteral() const { return m_next_token.literal; } std::string const& peekLiteral() const { return m_next_token.literal; }
///@} ///@}
///@{ ///@{

2
test/solidityCompiler.cpp

@ -71,7 +71,7 @@ private:
Expression* m_expression; Expression* m_expression;
}; };
bytes compileFirstExpression(const std::string& _sourceCode) bytes compileFirstExpression(std::string const& _sourceCode)
{ {
Parser parser; Parser parser;
ASTPointer<ContractDefinition> contract; ASTPointer<ContractDefinition> contract;

2
test/solidityNameAndTypeResolution.cpp

@ -38,7 +38,7 @@ namespace test
namespace namespace
{ {
void parseTextAndResolveNames(const std::string& _source) void parseTextAndResolveNames(std::string const& _source)
{ {
Parser parser; Parser parser;
ASTPointer<ContractDefinition> contract = parser.parse( ASTPointer<ContractDefinition> contract = parser.parse(

2
test/solidityParser.cpp

@ -37,7 +37,7 @@ namespace test
namespace namespace
{ {
ASTPointer<ASTNode> parseText(const std::string& _source) ASTPointer<ASTNode> parseText(std::string const& _source)
{ {
Parser parser; Parser parser;
return parser.parse(std::make_shared<Scanner>(CharStream(_source))); return parser.parse(std::make_shared<Scanner>(CharStream(_source)));

Loading…
Cancel
Save