|
@ -27,9 +27,9 @@ |
|
|
#include <vector> |
|
|
#include <vector> |
|
|
#include <memory> |
|
|
#include <memory> |
|
|
#include <boost/noncopyable.hpp> |
|
|
#include <boost/noncopyable.hpp> |
|
|
|
|
|
#include <libdevcore/SourceLocation.h> |
|
|
#include <libsolidity/Utils.h> |
|
|
#include <libsolidity/Utils.h> |
|
|
#include <libsolidity/ASTForward.h> |
|
|
#include <libsolidity/ASTForward.h> |
|
|
#include <libsolidity/BaseTypes.h> |
|
|
|
|
|
#include <libsolidity/Token.h> |
|
|
#include <libsolidity/Token.h> |
|
|
#include <libsolidity/Types.h> |
|
|
#include <libsolidity/Types.h> |
|
|
#include <libsolidity/Exceptions.h> |
|
|
#include <libsolidity/Exceptions.h> |
|
@ -51,7 +51,7 @@ class ASTConstVisitor; |
|
|
class ASTNode: private boost::noncopyable |
|
|
class ASTNode: private boost::noncopyable |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
explicit ASTNode(Location const& _location): m_location(_location) {} |
|
|
explicit ASTNode(SourceLocation const& _location): m_location(_location) {} |
|
|
|
|
|
|
|
|
virtual ~ASTNode() {} |
|
|
virtual ~ASTNode() {} |
|
|
|
|
|
|
|
@ -71,7 +71,7 @@ public: |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/// Returns the source code location of this node.
|
|
|
/// Returns the source code location of this node.
|
|
|
Location const& getLocation() const { return m_location; } |
|
|
SourceLocation const& getLocation() const { return m_location; } |
|
|
|
|
|
|
|
|
/// Creates a @ref TypeError exception and decorates it with the location of the node and
|
|
|
/// Creates a @ref TypeError exception and decorates it with the location of the node and
|
|
|
/// the given description
|
|
|
/// the given description
|
|
@ -85,7 +85,7 @@ public: |
|
|
///@}
|
|
|
///@}
|
|
|
|
|
|
|
|
|
private: |
|
|
private: |
|
|
Location m_location; |
|
|
SourceLocation m_location; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
/**
|
|
|
/**
|
|
@ -94,7 +94,7 @@ private: |
|
|
class SourceUnit: public ASTNode |
|
|
class SourceUnit: public ASTNode |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
SourceUnit(Location const& _location, std::vector<ASTPointer<ASTNode>> const& _nodes): |
|
|
SourceUnit(SourceLocation const& _location, std::vector<ASTPointer<ASTNode>> const& _nodes): |
|
|
ASTNode(_location), m_nodes(_nodes) {} |
|
|
ASTNode(_location), m_nodes(_nodes) {} |
|
|
|
|
|
|
|
|
virtual void accept(ASTVisitor& _visitor) override; |
|
|
virtual void accept(ASTVisitor& _visitor) override; |
|
@ -114,7 +114,7 @@ private: |
|
|
class ImportDirective: public ASTNode |
|
|
class ImportDirective: public ASTNode |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
ImportDirective(Location const& _location, ASTPointer<ASTString> const& _identifier): |
|
|
ImportDirective(SourceLocation const& _location, ASTPointer<ASTString> const& _identifier): |
|
|
ASTNode(_location), m_identifier(_identifier) {} |
|
|
ASTNode(_location), m_identifier(_identifier) {} |
|
|
|
|
|
|
|
|
virtual void accept(ASTVisitor& _visitor) override; |
|
|
virtual void accept(ASTVisitor& _visitor) override; |
|
@ -135,7 +135,7 @@ 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(Location const& _location, ASTPointer<ASTString> const& _name, |
|
|
Declaration(SourceLocation const& _location, ASTPointer<ASTString> const& _name, |
|
|
Visibility _visibility = Visibility::Default): |
|
|
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) {} |
|
|
|
|
|
|
|
@ -205,7 +205,7 @@ protected: |
|
|
class ContractDefinition: public Declaration, public Documented |
|
|
class ContractDefinition: public Declaration, public Documented |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
ContractDefinition(Location const& _location, |
|
|
ContractDefinition(SourceLocation const& _location, |
|
|
ASTPointer<ASTString> const& _name, |
|
|
ASTPointer<ASTString> const& _name, |
|
|
ASTPointer<ASTString> const& _documentation, |
|
|
ASTPointer<ASTString> const& _documentation, |
|
|
std::vector<ASTPointer<InheritanceSpecifier>> const& _baseContracts, |
|
|
std::vector<ASTPointer<InheritanceSpecifier>> const& _baseContracts, |
|
@ -278,7 +278,7 @@ private: |
|
|
class InheritanceSpecifier: public ASTNode |
|
|
class InheritanceSpecifier: public ASTNode |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
InheritanceSpecifier(Location const& _location, ASTPointer<Identifier> const& _baseName, |
|
|
InheritanceSpecifier(SourceLocation const& _location, ASTPointer<Identifier> const& _baseName, |
|
|
std::vector<ASTPointer<Expression>> _arguments): |
|
|
std::vector<ASTPointer<Expression>> _arguments): |
|
|
ASTNode(_location), m_baseName(_baseName), m_arguments(_arguments) {} |
|
|
ASTNode(_location), m_baseName(_baseName), m_arguments(_arguments) {} |
|
|
|
|
|
|
|
@ -298,7 +298,7 @@ private: |
|
|
class StructDefinition: public Declaration |
|
|
class StructDefinition: public Declaration |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
StructDefinition(Location const& _location, |
|
|
StructDefinition(SourceLocation const& _location, |
|
|
ASTPointer<ASTString> const& _name, |
|
|
ASTPointer<ASTString> const& _name, |
|
|
std::vector<ASTPointer<VariableDeclaration>> const& _members): |
|
|
std::vector<ASTPointer<VariableDeclaration>> const& _members): |
|
|
Declaration(_location, _name), m_members(_members) {} |
|
|
Declaration(_location, _name), m_members(_members) {} |
|
@ -323,7 +323,7 @@ private: |
|
|
class EnumDefinition: public Declaration |
|
|
class EnumDefinition: public Declaration |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
EnumDefinition(Location const& _location, |
|
|
EnumDefinition(SourceLocation const& _location, |
|
|
ASTPointer<ASTString> const& _name, |
|
|
ASTPointer<ASTString> const& _name, |
|
|
std::vector<ASTPointer<EnumValue>> const& _members): |
|
|
std::vector<ASTPointer<EnumValue>> const& _members): |
|
|
Declaration(_location, _name), m_members(_members) {} |
|
|
Declaration(_location, _name), m_members(_members) {} |
|
@ -344,7 +344,7 @@ private: |
|
|
class EnumValue: public Declaration |
|
|
class EnumValue: public Declaration |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
EnumValue(Location const& _location, |
|
|
EnumValue(SourceLocation const& _location, |
|
|
ASTPointer<ASTString> const& _name): |
|
|
ASTPointer<ASTString> const& _name): |
|
|
Declaration(_location, _name) {} |
|
|
Declaration(_location, _name) {} |
|
|
|
|
|
|
|
@ -361,7 +361,7 @@ class EnumValue: public Declaration |
|
|
class ParameterList: public ASTNode |
|
|
class ParameterList: public ASTNode |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
ParameterList(Location const& _location, |
|
|
ParameterList(SourceLocation const& _location, |
|
|
std::vector<ASTPointer<VariableDeclaration>> const& _parameters): |
|
|
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; |
|
@ -376,7 +376,7 @@ private: |
|
|
class FunctionDefinition: public Declaration, public VariableScope, public Documented |
|
|
class FunctionDefinition: public Declaration, public VariableScope, public Documented |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
FunctionDefinition(Location const& _location, ASTPointer<ASTString> const& _name, |
|
|
FunctionDefinition(SourceLocation const& _location, ASTPointer<ASTString> const& _name, |
|
|
Declaration::Visibility _visibility, bool _isConstructor, |
|
|
Declaration::Visibility _visibility, bool _isConstructor, |
|
|
ASTPointer<ASTString> const& _documentation, |
|
|
ASTPointer<ASTString> const& _documentation, |
|
|
ASTPointer<ParameterList> const& _parameters, |
|
|
ASTPointer<ParameterList> const& _parameters, |
|
@ -431,7 +431,7 @@ private: |
|
|
class VariableDeclaration: public Declaration |
|
|
class VariableDeclaration: public Declaration |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
VariableDeclaration(Location const& _location, ASTPointer<TypeName> const& _type, |
|
|
VariableDeclaration(SourceLocation const& _location, ASTPointer<TypeName> const& _type, |
|
|
ASTPointer<ASTString> const& _name, ASTPointer<Expression> _value, |
|
|
ASTPointer<ASTString> const& _name, ASTPointer<Expression> _value, |
|
|
Visibility _visibility, |
|
|
Visibility _visibility, |
|
|
bool _isStateVar = false, bool _isIndexed = false): |
|
|
bool _isStateVar = false, bool _isIndexed = false): |
|
@ -476,7 +476,7 @@ private: |
|
|
class ModifierDefinition: public Declaration, public VariableScope, public Documented |
|
|
class ModifierDefinition: public Declaration, public VariableScope, public Documented |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
ModifierDefinition(Location const& _location, |
|
|
ModifierDefinition(SourceLocation const& _location, |
|
|
ASTPointer<ASTString> const& _name, |
|
|
ASTPointer<ASTString> const& _name, |
|
|
ASTPointer<ASTString> const& _documentation, |
|
|
ASTPointer<ASTString> const& _documentation, |
|
|
ASTPointer<ParameterList> const& _parameters, |
|
|
ASTPointer<ParameterList> const& _parameters, |
|
@ -506,7 +506,7 @@ private: |
|
|
class ModifierInvocation: public ASTNode |
|
|
class ModifierInvocation: public ASTNode |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
ModifierInvocation(Location const& _location, ASTPointer<Identifier> const& _name, |
|
|
ModifierInvocation(SourceLocation const& _location, ASTPointer<Identifier> const& _name, |
|
|
std::vector<ASTPointer<Expression>> _arguments): |
|
|
std::vector<ASTPointer<Expression>> _arguments): |
|
|
ASTNode(_location), m_modifierName(_name), m_arguments(_arguments) {} |
|
|
ASTNode(_location), m_modifierName(_name), m_arguments(_arguments) {} |
|
|
|
|
|
|
|
@ -529,7 +529,7 @@ private: |
|
|
class EventDefinition: public Declaration, public VariableScope, public Documented |
|
|
class EventDefinition: public Declaration, public VariableScope, public Documented |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
EventDefinition(Location const& _location, |
|
|
EventDefinition(SourceLocation const& _location, |
|
|
ASTPointer<ASTString> const& _name, |
|
|
ASTPointer<ASTString> const& _name, |
|
|
ASTPointer<ASTString> const& _documentation, |
|
|
ASTPointer<ASTString> const& _documentation, |
|
|
ASTPointer<ParameterList> const& _parameters): |
|
|
ASTPointer<ParameterList> const& _parameters): |
|
@ -560,7 +560,7 @@ class MagicVariableDeclaration: public Declaration |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
MagicVariableDeclaration(ASTString const& _name, std::shared_ptr<Type const> const& _type): |
|
|
MagicVariableDeclaration(ASTString const& _name, std::shared_ptr<Type const> const& _type): |
|
|
Declaration(Location(), std::make_shared<ASTString>(_name)), m_type(_type) {} |
|
|
Declaration(SourceLocation(), std::make_shared<ASTString>(_name)), m_type(_type) {} |
|
|
virtual void accept(ASTVisitor&) override { BOOST_THROW_EXCEPTION(InternalCompilerError() |
|
|
virtual void accept(ASTVisitor&) override { BOOST_THROW_EXCEPTION(InternalCompilerError() |
|
|
<< errinfo_comment("MagicVariableDeclaration used inside real AST.")); } |
|
|
<< errinfo_comment("MagicVariableDeclaration used inside real AST.")); } |
|
|
virtual void accept(ASTConstVisitor&) const override { BOOST_THROW_EXCEPTION(InternalCompilerError() |
|
|
virtual void accept(ASTConstVisitor&) const override { BOOST_THROW_EXCEPTION(InternalCompilerError() |
|
@ -581,7 +581,7 @@ private: |
|
|
class TypeName: public ASTNode |
|
|
class TypeName: public ASTNode |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
explicit TypeName(Location const& _location): ASTNode(_location) {} |
|
|
explicit TypeName(SourceLocation const& _location): ASTNode(_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; |
|
|
|
|
|
|
|
@ -598,7 +598,7 @@ public: |
|
|
class ElementaryTypeName: public TypeName |
|
|
class ElementaryTypeName: public TypeName |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
explicit ElementaryTypeName(Location const& _location, Token::Value _type): |
|
|
explicit 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), ""); |
|
@ -619,7 +619,7 @@ private: |
|
|
class UserDefinedTypeName: public TypeName |
|
|
class UserDefinedTypeName: public TypeName |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
UserDefinedTypeName(Location const& _location, ASTPointer<ASTString> const& _name): |
|
|
UserDefinedTypeName(SourceLocation const& _location, ASTPointer<ASTString> const& _name): |
|
|
TypeName(_location), m_name(_name), m_referencedDeclaration(nullptr) {} |
|
|
TypeName(_location), m_name(_name), m_referencedDeclaration(nullptr) {} |
|
|
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; |
|
@ -641,7 +641,7 @@ private: |
|
|
class Mapping: public TypeName |
|
|
class Mapping: public TypeName |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
Mapping(Location const& _location, ASTPointer<ElementaryTypeName> const& _keyType, |
|
|
Mapping(SourceLocation const& _location, ASTPointer<ElementaryTypeName> const& _keyType, |
|
|
ASTPointer<TypeName> const& _valueType): |
|
|
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; |
|
@ -689,7 +689,7 @@ private: |
|
|
class Statement: public ASTNode |
|
|
class Statement: public ASTNode |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
explicit Statement(Location const& _location): ASTNode(_location) {} |
|
|
explicit Statement(SourceLocation const& _location): ASTNode(_location) {} |
|
|
|
|
|
|
|
|
/// 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
|
|
@ -703,7 +703,7 @@ public: |
|
|
class Block: public Statement |
|
|
class Block: public Statement |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
Block(Location 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; |
|
@ -721,7 +721,7 @@ private: |
|
|
class PlaceholderStatement: public Statement |
|
|
class PlaceholderStatement: public Statement |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
PlaceholderStatement(Location const& _location): Statement(_location) {} |
|
|
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; |
|
@ -736,7 +736,7 @@ public: |
|
|
class IfStatement: public Statement |
|
|
class IfStatement: public Statement |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
IfStatement(Location const& _location, ASTPointer<Expression> const& _condition, |
|
|
IfStatement(SourceLocation const& _location, ASTPointer<Expression> const& _condition, |
|
|
ASTPointer<Statement> const& _trueBody, ASTPointer<Statement> const& _falseBody): |
|
|
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) {} |
|
@ -761,13 +761,13 @@ private: |
|
|
class BreakableStatement: public Statement |
|
|
class BreakableStatement: public Statement |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
BreakableStatement(Location const& _location): Statement(_location) {} |
|
|
BreakableStatement(SourceLocation const& _location): Statement(_location) {} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
class WhileStatement: public BreakableStatement |
|
|
class WhileStatement: public BreakableStatement |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
WhileStatement(Location const& _location, ASTPointer<Expression> const& _condition, |
|
|
WhileStatement(SourceLocation const& _location, ASTPointer<Expression> const& _condition, |
|
|
ASTPointer<Statement> const& _body): |
|
|
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; |
|
@ -788,7 +788,7 @@ private: |
|
|
class ForStatement: public BreakableStatement |
|
|
class ForStatement: public BreakableStatement |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
ForStatement(Location const& _location, |
|
|
ForStatement(SourceLocation const& _location, |
|
|
ASTPointer<Statement> const& _initExpression, |
|
|
ASTPointer<Statement> const& _initExpression, |
|
|
ASTPointer<Expression> const& _conditionExpression, |
|
|
ASTPointer<Expression> const& _conditionExpression, |
|
|
ASTPointer<ExpressionStatement> const& _loopExpression, |
|
|
ASTPointer<ExpressionStatement> const& _loopExpression, |
|
@ -821,7 +821,7 @@ private: |
|
|
class Continue: public Statement |
|
|
class Continue: public Statement |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
Continue(Location const& _location): Statement(_location) {} |
|
|
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; |
|
|
virtual void checkTypeRequirements() override {} |
|
|
virtual void checkTypeRequirements() override {} |
|
@ -830,7 +830,7 @@ public: |
|
|
class Break: public Statement |
|
|
class Break: public Statement |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
Break(Location const& _location): Statement(_location) {} |
|
|
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; |
|
|
virtual void checkTypeRequirements() override {} |
|
|
virtual void checkTypeRequirements() override {} |
|
@ -839,7 +839,7 @@ public: |
|
|
class Return: public Statement |
|
|
class Return: public Statement |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
Return(Location const& _location, ASTPointer<Expression> _expression): |
|
|
Return(SourceLocation const& _location, ASTPointer<Expression> _expression): |
|
|
Statement(_location), m_expression(_expression), m_returnParameters(nullptr) {} |
|
|
Statement(_location), m_expression(_expression), m_returnParameters(nullptr) {} |
|
|
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; |
|
@ -864,7 +864,7 @@ private: |
|
|
class VariableDeclarationStatement: public Statement |
|
|
class VariableDeclarationStatement: public Statement |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
VariableDeclarationStatement(Location const& _location, ASTPointer<VariableDeclaration> _variable): |
|
|
VariableDeclarationStatement(SourceLocation const& _location, ASTPointer<VariableDeclaration> _variable): |
|
|
Statement(_location), m_variable(_variable) {} |
|
|
Statement(_location), m_variable(_variable) {} |
|
|
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; |
|
@ -883,7 +883,7 @@ private: |
|
|
class ExpressionStatement: public Statement |
|
|
class ExpressionStatement: public Statement |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
ExpressionStatement(Location 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; |
|
@ -908,7 +908,7 @@ private: |
|
|
class Expression: public ASTNode |
|
|
class Expression: public ASTNode |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
Expression(Location const& _location): ASTNode(_location) {} |
|
|
Expression(SourceLocation const& _location): ASTNode(_location) {} |
|
|
virtual void checkTypeRequirements() = 0; |
|
|
virtual void checkTypeRequirements() = 0; |
|
|
|
|
|
|
|
|
std::shared_ptr<Type const> const& getType() const { return m_type; } |
|
|
std::shared_ptr<Type const> const& getType() const { return m_type; } |
|
@ -939,7 +939,7 @@ protected: |
|
|
class Assignment: public Expression |
|
|
class Assignment: public Expression |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
Assignment(Location const& _location, ASTPointer<Expression> const& _leftHandSide, |
|
|
Assignment(SourceLocation const& _location, ASTPointer<Expression> const& _leftHandSide, |
|
|
Token::Value _assignmentOperator, ASTPointer<Expression> const& _rightHandSide): |
|
|
Token::Value _assignmentOperator, ASTPointer<Expression> const& _rightHandSide): |
|
|
Expression(_location), m_leftHandSide(_leftHandSide), |
|
|
Expression(_location), m_leftHandSide(_leftHandSide), |
|
|
m_assigmentOperator(_assignmentOperator), m_rightHandSide(_rightHandSide) |
|
|
m_assigmentOperator(_assignmentOperator), m_rightHandSide(_rightHandSide) |
|
@ -967,7 +967,7 @@ private: |
|
|
class UnaryOperation: public Expression |
|
|
class UnaryOperation: public Expression |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
UnaryOperation(Location const& _location, Token::Value _operator, |
|
|
UnaryOperation(SourceLocation const& _location, Token::Value _operator, |
|
|
ASTPointer<Expression> const& _subExpression, bool _isPrefix): |
|
|
ASTPointer<Expression> const& _subExpression, bool _isPrefix): |
|
|
Expression(_location), m_operator(_operator), |
|
|
Expression(_location), m_operator(_operator), |
|
|
m_subExpression(_subExpression), m_isPrefix(_isPrefix) |
|
|
m_subExpression(_subExpression), m_isPrefix(_isPrefix) |
|
@ -995,7 +995,7 @@ private: |
|
|
class BinaryOperation: public Expression |
|
|
class BinaryOperation: public Expression |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
BinaryOperation(Location const& _location, ASTPointer<Expression> const& _left, |
|
|
BinaryOperation(SourceLocation const& _location, ASTPointer<Expression> const& _left, |
|
|
Token::Value _operator, ASTPointer<Expression> const& _right): |
|
|
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) |
|
|
{ |
|
|
{ |
|
@ -1026,7 +1026,7 @@ private: |
|
|
class FunctionCall: public Expression |
|
|
class FunctionCall: public Expression |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
FunctionCall(Location const& _location, ASTPointer<Expression> const& _expression, |
|
|
FunctionCall(SourceLocation const& _location, ASTPointer<Expression> const& _expression, |
|
|
std::vector<ASTPointer<Expression>> const& _arguments, std::vector<ASTPointer<ASTString>> const& _names): |
|
|
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; |
|
@ -1053,7 +1053,7 @@ private: |
|
|
class NewExpression: public Expression |
|
|
class NewExpression: public Expression |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
NewExpression(Location 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; |
|
@ -1074,7 +1074,7 @@ private: |
|
|
class MemberAccess: public Expression |
|
|
class MemberAccess: public Expression |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
MemberAccess(Location const& _location, ASTPointer<Expression> _expression, |
|
|
MemberAccess(SourceLocation const& _location, ASTPointer<Expression> _expression, |
|
|
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; |
|
@ -1094,7 +1094,7 @@ private: |
|
|
class IndexAccess: public Expression |
|
|
class IndexAccess: public Expression |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
IndexAccess(Location const& _location, ASTPointer<Expression> const& _base, |
|
|
IndexAccess(SourceLocation const& _location, ASTPointer<Expression> const& _base, |
|
|
ASTPointer<Expression> const& _index): |
|
|
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; |
|
@ -1116,7 +1116,7 @@ private: |
|
|
class PrimaryExpression: public Expression |
|
|
class PrimaryExpression: public Expression |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
PrimaryExpression(Location const& _location): Expression(_location) {} |
|
|
PrimaryExpression(SourceLocation const& _location): Expression(_location) {} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
/**
|
|
|
/**
|
|
@ -1125,7 +1125,7 @@ public: |
|
|
class Identifier: public PrimaryExpression |
|
|
class Identifier: public PrimaryExpression |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
Identifier(Location 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; |
|
@ -1160,7 +1160,7 @@ private: |
|
|
class ElementaryTypeNameExpression: public PrimaryExpression |
|
|
class ElementaryTypeNameExpression: public PrimaryExpression |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
ElementaryTypeNameExpression(Location const& _location, Token::Value _typeToken): |
|
|
ElementaryTypeNameExpression(SourceLocation const& _location, Token::Value _typeToken): |
|
|
PrimaryExpression(_location), m_typeToken(_typeToken) |
|
|
PrimaryExpression(_location), m_typeToken(_typeToken) |
|
|
{ |
|
|
{ |
|
|
solAssert(Token::isElementaryTypeName(_typeToken), ""); |
|
|
solAssert(Token::isElementaryTypeName(_typeToken), ""); |
|
@ -1189,7 +1189,7 @@ public: |
|
|
Finney = Token::SubFinney, |
|
|
Finney = Token::SubFinney, |
|
|
Ether = Token::SubEther |
|
|
Ether = Token::SubEther |
|
|
}; |
|
|
}; |
|
|
Literal(Location const& _location, Token::Value _token, |
|
|
Literal(SourceLocation const& _location, Token::Value _token, |
|
|
ASTPointer<ASTString> const& _value, |
|
|
ASTPointer<ASTString> const& _value, |
|
|
SubDenomination _sub = SubDenomination::None): |
|
|
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) {} |
|
|