|
|
|
@@ -38,6 +38,7 @@
|
|
|
|
|
#include <memory>
|
|
|
|
|
#include <optional>
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <utility>
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
namespace solidity::yul
|
|
|
|
@@ -82,7 +83,7 @@ public:
|
|
|
|
|
|
|
|
|
|
using SourceLocation = langutil::SourceLocation;
|
|
|
|
|
|
|
|
|
|
explicit ASTNode(int64_t _id, SourceLocation const& _location);
|
|
|
|
|
explicit ASTNode(int64_t _id, SourceLocation _location);
|
|
|
|
|
virtual ~ASTNode() {}
|
|
|
|
|
|
|
|
|
|
/// @returns an identifier of this AST node that is unique for a single compilation run.
|
|
|
|
@@ -155,8 +156,8 @@ std::vector<T const*> ASTNode::filteredNodes(std::vector<ASTPointer<ASTNode>> co
|
|
|
|
|
class SourceUnit: public ASTNode
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
SourceUnit(int64_t _id, SourceLocation const& _location, std::vector<ASTPointer<ASTNode>> const& _nodes):
|
|
|
|
|
ASTNode(_id, _location), m_nodes(_nodes) {}
|
|
|
|
|
SourceUnit(int64_t _id, SourceLocation const& _location, std::vector<ASTPointer<ASTNode>> _nodes):
|
|
|
|
|
ASTNode(_id, _location), m_nodes(std::move(_nodes)) {}
|
|
|
|
|
|
|
|
|
|
void accept(ASTVisitor& _visitor) override;
|
|
|
|
|
void accept(ASTConstVisitor& _visitor) const override;
|
|
|
|
@@ -224,10 +225,10 @@ public:
|
|
|
|
|
Declaration(
|
|
|
|
|
int64_t _id,
|
|
|
|
|
SourceLocation const& _location,
|
|
|
|
|
ASTPointer<ASTString> const& _name,
|
|
|
|
|
ASTPointer<ASTString> _name,
|
|
|
|
|
Visibility _visibility = Visibility::Default
|
|
|
|
|
):
|
|
|
|
|
ASTNode(_id, _location), m_name(_name), m_visibility(_visibility) {}
|
|
|
|
|
ASTNode(_id, _location), m_name(std::move(_name)), m_visibility(_visibility) {}
|
|
|
|
|
|
|
|
|
|
/// @returns the declared name.
|
|
|
|
|
ASTString const& name() const { return *m_name; }
|
|
|
|
@@ -275,9 +276,9 @@ public:
|
|
|
|
|
PragmaDirective(
|
|
|
|
|
int64_t _id,
|
|
|
|
|
SourceLocation const& _location,
|
|
|
|
|
std::vector<Token> const& _tokens,
|
|
|
|
|
std::vector<ASTString> const& _literals
|
|
|
|
|
): ASTNode(_id, _location), m_tokens(_tokens), m_literals(_literals)
|
|
|
|
|
std::vector<Token> _tokens,
|
|
|
|
|
std::vector<ASTString> _literals
|
|
|
|
|
): ASTNode(_id, _location), m_tokens(std::move(_tokens)), m_literals(std::move(_literals))
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
void accept(ASTVisitor& _visitor) override;
|
|
|
|
@@ -318,12 +319,12 @@ public:
|
|
|
|
|
ImportDirective(
|
|
|
|
|
int64_t _id,
|
|
|
|
|
SourceLocation const& _location,
|
|
|
|
|
ASTPointer<ASTString> const& _path,
|
|
|
|
|
ASTPointer<ASTString> _path,
|
|
|
|
|
ASTPointer<ASTString> const& _unitAlias,
|
|
|
|
|
SymbolAliasList _symbolAliases
|
|
|
|
|
):
|
|
|
|
|
Declaration(_id, _location, _unitAlias),
|
|
|
|
|
m_path(_path),
|
|
|
|
|
m_path(std::move(_path)),
|
|
|
|
|
m_symbolAliases(move(_symbolAliases))
|
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
@@ -372,8 +373,8 @@ public:
|
|
|
|
|
StructuredDocumentation(
|
|
|
|
|
int64_t _id,
|
|
|
|
|
SourceLocation const& _location,
|
|
|
|
|
ASTPointer<ASTString> const& _text
|
|
|
|
|
): ASTNode(_id, _location), m_text(_text)
|
|
|
|
|
ASTPointer<ASTString> _text
|
|
|
|
|
): ASTNode(_id, _location), m_text(std::move(_text))
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
void accept(ASTVisitor& _visitor) override;
|
|
|
|
@@ -394,7 +395,7 @@ class Documented
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
virtual ~Documented() = default;
|
|
|
|
|
explicit Documented(ASTPointer<ASTString> const& _documentation): m_documentation(_documentation) {}
|
|
|
|
|
explicit Documented(ASTPointer<ASTString> _documentation): m_documentation(std::move(_documentation)) {}
|
|
|
|
|
|
|
|
|
|
/// @return A shared pointer of an ASTString.
|
|
|
|
|
/// Can contain a nullptr in which case indicates absence of documentation
|
|
|
|
@@ -411,7 +412,7 @@ class StructurallyDocumented
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
virtual ~StructurallyDocumented() = default;
|
|
|
|
|
explicit StructurallyDocumented(ASTPointer<StructuredDocumentation> const& _documentation): m_documentation(_documentation) {}
|
|
|
|
|
explicit StructurallyDocumented(ASTPointer<StructuredDocumentation> _documentation): m_documentation(std::move(_documentation)) {}
|
|
|
|
|
|
|
|
|
|
/// @return A shared pointer of a FormalDocumentation.
|
|
|
|
|
/// Can contain a nullptr in which case indicates absence of documentation
|
|
|
|
@@ -453,15 +454,15 @@ public:
|
|
|
|
|
SourceLocation const& _location,
|
|
|
|
|
ASTPointer<ASTString> const& _name,
|
|
|
|
|
ASTPointer<StructuredDocumentation> const& _documentation,
|
|
|
|
|
std::vector<ASTPointer<InheritanceSpecifier>> const& _baseContracts,
|
|
|
|
|
std::vector<ASTPointer<ASTNode>> const& _subNodes,
|
|
|
|
|
std::vector<ASTPointer<InheritanceSpecifier>> _baseContracts,
|
|
|
|
|
std::vector<ASTPointer<ASTNode>> _subNodes,
|
|
|
|
|
ContractKind _contractKind = ContractKind::Contract,
|
|
|
|
|
bool _abstract = false
|
|
|
|
|
):
|
|
|
|
|
Declaration(_id, _location, _name),
|
|
|
|
|
StructurallyDocumented(_documentation),
|
|
|
|
|
m_baseContracts(_baseContracts),
|
|
|
|
|
m_subNodes(_subNodes),
|
|
|
|
|
m_baseContracts(std::move(_baseContracts)),
|
|
|
|
|
m_subNodes(std::move(_subNodes)),
|
|
|
|
|
m_contractKind(_contractKind),
|
|
|
|
|
m_abstract(_abstract)
|
|
|
|
|
{}
|
|
|
|
@@ -538,10 +539,10 @@ public:
|
|
|
|
|
InheritanceSpecifier(
|
|
|
|
|
int64_t _id,
|
|
|
|
|
SourceLocation const& _location,
|
|
|
|
|
ASTPointer<UserDefinedTypeName> const& _baseName,
|
|
|
|
|
ASTPointer<UserDefinedTypeName> _baseName,
|
|
|
|
|
std::unique_ptr<std::vector<ASTPointer<Expression>>> _arguments
|
|
|
|
|
):
|
|
|
|
|
ASTNode(_id, _location), m_baseName(_baseName), m_arguments(std::move(_arguments)) {}
|
|
|
|
|
ASTNode(_id, _location), m_baseName(std::move(_baseName)), m_arguments(std::move(_arguments)) {}
|
|
|
|
|
|
|
|
|
|
void accept(ASTVisitor& _visitor) override;
|
|
|
|
|
void accept(ASTConstVisitor& _visitor) const override;
|
|
|
|
@@ -568,10 +569,10 @@ public:
|
|
|
|
|
UsingForDirective(
|
|
|
|
|
int64_t _id,
|
|
|
|
|
SourceLocation const& _location,
|
|
|
|
|
ASTPointer<UserDefinedTypeName> const& _libraryName,
|
|
|
|
|
ASTPointer<TypeName> const& _typeName
|
|
|
|
|
ASTPointer<UserDefinedTypeName> _libraryName,
|
|
|
|
|
ASTPointer<TypeName> _typeName
|
|
|
|
|
):
|
|
|
|
|
ASTNode(_id, _location), m_libraryName(_libraryName), m_typeName(_typeName) {}
|
|
|
|
|
ASTNode(_id, _location), m_libraryName(std::move(_libraryName)), m_typeName(std::move(_typeName)) {}
|
|
|
|
|
|
|
|
|
|
void accept(ASTVisitor& _visitor) override;
|
|
|
|
|
void accept(ASTConstVisitor& _visitor) const override;
|
|
|
|
@@ -592,9 +593,9 @@ public:
|
|
|
|
|
int64_t _id,
|
|
|
|
|
SourceLocation const& _location,
|
|
|
|
|
ASTPointer<ASTString> const& _name,
|
|
|
|
|
std::vector<ASTPointer<VariableDeclaration>> const& _members
|
|
|
|
|
std::vector<ASTPointer<VariableDeclaration>> _members
|
|
|
|
|
):
|
|
|
|
|
Declaration(_id, _location, _name), m_members(_members) {}
|
|
|
|
|
Declaration(_id, _location, _name), m_members(std::move(_members)) {}
|
|
|
|
|
|
|
|
|
|
void accept(ASTVisitor& _visitor) override;
|
|
|
|
|
void accept(ASTConstVisitor& _visitor) const override;
|
|
|
|
@@ -619,9 +620,9 @@ public:
|
|
|
|
|
int64_t _id,
|
|
|
|
|
SourceLocation const& _location,
|
|
|
|
|
ASTPointer<ASTString> const& _name,
|
|
|
|
|
std::vector<ASTPointer<EnumValue>> const& _members
|
|
|
|
|
std::vector<ASTPointer<EnumValue>> _members
|
|
|
|
|
):
|
|
|
|
|
Declaration(_id, _location, _name), m_members(_members) {}
|
|
|
|
|
Declaration(_id, _location, _name), m_members(std::move(_members)) {}
|
|
|
|
|
void accept(ASTVisitor& _visitor) override;
|
|
|
|
|
void accept(ASTConstVisitor& _visitor) const override;
|
|
|
|
|
|
|
|
|
@@ -664,9 +665,9 @@ public:
|
|
|
|
|
ParameterList(
|
|
|
|
|
int64_t _id,
|
|
|
|
|
SourceLocation const& _location,
|
|
|
|
|
std::vector<ASTPointer<VariableDeclaration>> const& _parameters
|
|
|
|
|
std::vector<ASTPointer<VariableDeclaration>> _parameters
|
|
|
|
|
):
|
|
|
|
|
ASTNode(_id, _location), m_parameters(_parameters) {}
|
|
|
|
|
ASTNode(_id, _location), m_parameters(std::move(_parameters)) {}
|
|
|
|
|
void accept(ASTVisitor& _visitor) override;
|
|
|
|
|
void accept(ASTConstVisitor& _visitor) const override;
|
|
|
|
|
|
|
|
|
@@ -688,15 +689,15 @@ public:
|
|
|
|
|
SourceLocation const& _location,
|
|
|
|
|
ASTPointer<ASTString> const& _name,
|
|
|
|
|
Visibility _visibility,
|
|
|
|
|
ASTPointer<ParameterList> const& _parameters,
|
|
|
|
|
ASTPointer<ParameterList> _parameters,
|
|
|
|
|
bool _isVirtual = false,
|
|
|
|
|
ASTPointer<OverrideSpecifier> const& _overrides = nullptr,
|
|
|
|
|
ASTPointer<ParameterList> const& _returnParameters = ASTPointer<ParameterList>()
|
|
|
|
|
ASTPointer<OverrideSpecifier> _overrides = nullptr,
|
|
|
|
|
ASTPointer<ParameterList> _returnParameters = ASTPointer<ParameterList>()
|
|
|
|
|
):
|
|
|
|
|
Declaration(_id, _location, _name, _visibility),
|
|
|
|
|
m_parameters(_parameters),
|
|
|
|
|
m_overrides(_overrides),
|
|
|
|
|
m_returnParameters(_returnParameters),
|
|
|
|
|
m_parameters(std::move(_parameters)),
|
|
|
|
|
m_overrides(std::move(_overrides)),
|
|
|
|
|
m_returnParameters(std::move(_returnParameters)),
|
|
|
|
|
m_isVirtual(_isVirtual)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
@@ -740,10 +741,10 @@ public:
|
|
|
|
|
OverrideSpecifier(
|
|
|
|
|
int64_t _id,
|
|
|
|
|
SourceLocation const& _location,
|
|
|
|
|
std::vector<ASTPointer<UserDefinedTypeName>> const& _overrides
|
|
|
|
|
std::vector<ASTPointer<UserDefinedTypeName>> _overrides
|
|
|
|
|
):
|
|
|
|
|
ASTNode(_id, _location),
|
|
|
|
|
m_overrides(_overrides)
|
|
|
|
|
m_overrides(std::move(_overrides))
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -771,7 +772,7 @@ public:
|
|
|
|
|
ASTPointer<OverrideSpecifier> const& _overrides,
|
|
|
|
|
ASTPointer<StructuredDocumentation> const& _documentation,
|
|
|
|
|
ASTPointer<ParameterList> const& _parameters,
|
|
|
|
|
std::vector<ASTPointer<ModifierInvocation>> const& _modifiers,
|
|
|
|
|
std::vector<ASTPointer<ModifierInvocation>> _modifiers,
|
|
|
|
|
ASTPointer<ParameterList> const& _returnParameters,
|
|
|
|
|
ASTPointer<Block> const& _body
|
|
|
|
|
):
|
|
|
|
@@ -780,7 +781,7 @@ public:
|
|
|
|
|
ImplementationOptional(_body != nullptr),
|
|
|
|
|
m_stateMutability(_stateMutability),
|
|
|
|
|
m_kind(_kind),
|
|
|
|
|
m_functionModifiers(_modifiers),
|
|
|
|
|
m_functionModifiers(std::move(_modifiers)),
|
|
|
|
|
m_body(_body)
|
|
|
|
|
{
|
|
|
|
|
solAssert(_kind == Token::Constructor || _kind == Token::Function || _kind == Token::Fallback || _kind == Token::Receive, "");
|
|
|
|
@@ -869,23 +870,23 @@ public:
|
|
|
|
|
VariableDeclaration(
|
|
|
|
|
int64_t _id,
|
|
|
|
|
SourceLocation const& _location,
|
|
|
|
|
ASTPointer<TypeName> const& _type,
|
|
|
|
|
ASTPointer<TypeName> _type,
|
|
|
|
|
ASTPointer<ASTString> const& _name,
|
|
|
|
|
ASTPointer<Expression> _value,
|
|
|
|
|
Visibility _visibility,
|
|
|
|
|
bool _isStateVar = false,
|
|
|
|
|
bool _isIndexed = false,
|
|
|
|
|
Mutability _mutability = Mutability::Mutable,
|
|
|
|
|
ASTPointer<OverrideSpecifier> const& _overrides = nullptr,
|
|
|
|
|
ASTPointer<OverrideSpecifier> _overrides = nullptr,
|
|
|
|
|
Location _referenceLocation = Location::Unspecified
|
|
|
|
|
):
|
|
|
|
|
Declaration(_id, _location, _name, _visibility),
|
|
|
|
|
m_typeName(_type),
|
|
|
|
|
m_value(_value),
|
|
|
|
|
m_typeName(std::move(_type)),
|
|
|
|
|
m_value(std::move(_value)),
|
|
|
|
|
m_isStateVariable(_isStateVar),
|
|
|
|
|
m_isIndexed(_isIndexed),
|
|
|
|
|
m_mutability(_mutability),
|
|
|
|
|
m_overrides(_overrides),
|
|
|
|
|
m_overrides(std::move(_overrides)),
|
|
|
|
|
m_location(_referenceLocation) {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -977,11 +978,11 @@ public:
|
|
|
|
|
ASTPointer<ParameterList> const& _parameters,
|
|
|
|
|
bool _isVirtual,
|
|
|
|
|
ASTPointer<OverrideSpecifier> const& _overrides,
|
|
|
|
|
ASTPointer<Block> const& _body
|
|
|
|
|
ASTPointer<Block> _body
|
|
|
|
|
):
|
|
|
|
|
CallableDeclaration(_id, _location, _name, Visibility::Internal, _parameters, _isVirtual, _overrides),
|
|
|
|
|
StructurallyDocumented(_documentation),
|
|
|
|
|
m_body(_body)
|
|
|
|
|
m_body(std::move(_body))
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1015,10 +1016,10 @@ public:
|
|
|
|
|
ModifierInvocation(
|
|
|
|
|
int64_t _id,
|
|
|
|
|
SourceLocation const& _location,
|
|
|
|
|
ASTPointer<Identifier> const& _name,
|
|
|
|
|
ASTPointer<Identifier> _name,
|
|
|
|
|
std::unique_ptr<std::vector<ASTPointer<Expression>>> _arguments
|
|
|
|
|
):
|
|
|
|
|
ASTNode(_id, _location), m_modifierName(_name), m_arguments(std::move(_arguments)) {}
|
|
|
|
|
ASTNode(_id, _location), m_modifierName(std::move(_name)), m_arguments(std::move(_arguments)) {}
|
|
|
|
|
|
|
|
|
|
void accept(ASTVisitor& _visitor) override;
|
|
|
|
|
void accept(ASTConstVisitor& _visitor) const override;
|
|
|
|
@@ -1159,8 +1160,8 @@ private:
|
|
|
|
|
class UserDefinedTypeName: public TypeName
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
UserDefinedTypeName(int64_t _id, SourceLocation const& _location, std::vector<ASTString> const& _namePath):
|
|
|
|
|
TypeName(_id, _location), m_namePath(_namePath) {}
|
|
|
|
|
UserDefinedTypeName(int64_t _id, SourceLocation const& _location, std::vector<ASTString> _namePath):
|
|
|
|
|
TypeName(_id, _location), m_namePath(std::move(_namePath)) {}
|
|
|
|
|
void accept(ASTVisitor& _visitor) override;
|
|
|
|
|
void accept(ASTConstVisitor& _visitor) const override;
|
|
|
|
|
|
|
|
|
@@ -1181,12 +1182,12 @@ public:
|
|
|
|
|
FunctionTypeName(
|
|
|
|
|
int64_t _id,
|
|
|
|
|
SourceLocation const& _location,
|
|
|
|
|
ASTPointer<ParameterList> const& _parameterTypes,
|
|
|
|
|
ASTPointer<ParameterList> const& _returnTypes,
|
|
|
|
|
ASTPointer<ParameterList> _parameterTypes,
|
|
|
|
|
ASTPointer<ParameterList> _returnTypes,
|
|
|
|
|
Visibility _visibility,
|
|
|
|
|
StateMutability _stateMutability
|
|
|
|
|
):
|
|
|
|
|
TypeName(_id, _location), m_parameterTypes(_parameterTypes), m_returnTypes(_returnTypes),
|
|
|
|
|
TypeName(_id, _location), m_parameterTypes(std::move(_parameterTypes)), m_returnTypes(std::move(_returnTypes)),
|
|
|
|
|
m_visibility(_visibility), m_stateMutability(_stateMutability)
|
|
|
|
|
{}
|
|
|
|
|
void accept(ASTVisitor& _visitor) override;
|
|
|
|
@@ -1220,10 +1221,10 @@ public:
|
|
|
|
|
Mapping(
|
|
|
|
|
int64_t _id,
|
|
|
|
|
SourceLocation const& _location,
|
|
|
|
|
ASTPointer<TypeName> const& _keyType,
|
|
|
|
|
ASTPointer<TypeName> const& _valueType
|
|
|
|
|
ASTPointer<TypeName> _keyType,
|
|
|
|
|
ASTPointer<TypeName> _valueType
|
|
|
|
|
):
|
|
|
|
|
TypeName(_id, _location), m_keyType(_keyType), m_valueType(_valueType) {}
|
|
|
|
|
TypeName(_id, _location), m_keyType(std::move(_keyType)), m_valueType(std::move(_valueType)) {}
|
|
|
|
|
void accept(ASTVisitor& _visitor) override;
|
|
|
|
|
void accept(ASTConstVisitor& _visitor) const override;
|
|
|
|
|
|
|
|
|
@@ -1244,10 +1245,10 @@ public:
|
|
|
|
|
ArrayTypeName(
|
|
|
|
|
int64_t _id,
|
|
|
|
|
SourceLocation const& _location,
|
|
|
|
|
ASTPointer<TypeName> const& _baseType,
|
|
|
|
|
ASTPointer<Expression> const& _length
|
|
|
|
|
ASTPointer<TypeName> _baseType,
|
|
|
|
|
ASTPointer<Expression> _length
|
|
|
|
|
):
|
|
|
|
|
TypeName(_id, _location), m_baseType(_baseType), m_length(_length) {}
|
|
|
|
|
TypeName(_id, _location), m_baseType(std::move(_baseType)), m_length(std::move(_length)) {}
|
|
|
|
|
void accept(ASTVisitor& _visitor) override;
|
|
|
|
|
void accept(ASTConstVisitor& _visitor) const override;
|
|
|
|
|
|
|
|
|
@@ -1291,9 +1292,9 @@ public:
|
|
|
|
|
SourceLocation const& _location,
|
|
|
|
|
ASTPointer<ASTString> const& _docString,
|
|
|
|
|
yul::Dialect const& _dialect,
|
|
|
|
|
std::shared_ptr<yul::Block> const& _operations
|
|
|
|
|
std::shared_ptr<yul::Block> _operations
|
|
|
|
|
):
|
|
|
|
|
Statement(_id, _location, _docString), m_dialect(_dialect), m_operations(_operations) {}
|
|
|
|
|
Statement(_id, _location, _docString), m_dialect(_dialect), m_operations(std::move(_operations)) {}
|
|
|
|
|
void accept(ASTVisitor& _visitor) override;
|
|
|
|
|
void accept(ASTConstVisitor& _visitor) const override;
|
|
|
|
|
|
|
|
|
@@ -1317,9 +1318,9 @@ public:
|
|
|
|
|
int64_t _id,
|
|
|
|
|
SourceLocation const& _location,
|
|
|
|
|
ASTPointer<ASTString> const& _docString,
|
|
|
|
|
std::vector<ASTPointer<Statement>> const& _statements
|
|
|
|
|
std::vector<ASTPointer<Statement>> _statements
|
|
|
|
|
):
|
|
|
|
|
Statement(_id, _location, _docString), m_statements(_statements) {}
|
|
|
|
|
Statement(_id, _location, _docString), m_statements(std::move(_statements)) {}
|
|
|
|
|
void accept(ASTVisitor& _visitor) override;
|
|
|
|
|
void accept(ASTConstVisitor& _visitor) const override;
|
|
|
|
|
|
|
|
|
@@ -1359,14 +1360,14 @@ public:
|
|
|
|
|
int64_t _id,
|
|
|
|
|
SourceLocation const& _location,
|
|
|
|
|
ASTPointer<ASTString> const& _docString,
|
|
|
|
|
ASTPointer<Expression> const& _condition,
|
|
|
|
|
ASTPointer<Statement> const& _trueBody,
|
|
|
|
|
ASTPointer<Statement> const& _falseBody
|
|
|
|
|
ASTPointer<Expression> _condition,
|
|
|
|
|
ASTPointer<Statement> _trueBody,
|
|
|
|
|
ASTPointer<Statement> _falseBody
|
|
|
|
|
):
|
|
|
|
|
Statement(_id, _location, _docString),
|
|
|
|
|
m_condition(_condition),
|
|
|
|
|
m_trueBody(_trueBody),
|
|
|
|
|
m_falseBody(_falseBody)
|
|
|
|
|
m_condition(std::move(_condition)),
|
|
|
|
|
m_trueBody(std::move(_trueBody)),
|
|
|
|
|
m_falseBody(std::move(_falseBody))
|
|
|
|
|
{}
|
|
|
|
|
void accept(ASTVisitor& _visitor) override;
|
|
|
|
|
void accept(ASTConstVisitor& _visitor) const override;
|
|
|
|
@@ -1393,14 +1394,14 @@ public:
|
|
|
|
|
TryCatchClause(
|
|
|
|
|
int64_t _id,
|
|
|
|
|
SourceLocation const& _location,
|
|
|
|
|
ASTPointer<ASTString> const& _errorName,
|
|
|
|
|
ASTPointer<ParameterList> const& _parameters,
|
|
|
|
|
ASTPointer<Block> const& _block
|
|
|
|
|
ASTPointer<ASTString> _errorName,
|
|
|
|
|
ASTPointer<ParameterList> _parameters,
|
|
|
|
|
ASTPointer<Block> _block
|
|
|
|
|
):
|
|
|
|
|
ASTNode(_id, _location),
|
|
|
|
|
m_errorName(_errorName),
|
|
|
|
|
m_parameters(_parameters),
|
|
|
|
|
m_block(_block)
|
|
|
|
|
m_errorName(std::move(_errorName)),
|
|
|
|
|
m_parameters(std::move(_parameters)),
|
|
|
|
|
m_block(std::move(_block))
|
|
|
|
|
{}
|
|
|
|
|
void accept(ASTVisitor& _visitor) override;
|
|
|
|
|
void accept(ASTConstVisitor& _visitor) const override;
|
|
|
|
@@ -1438,12 +1439,12 @@ public:
|
|
|
|
|
int64_t _id,
|
|
|
|
|
SourceLocation const& _location,
|
|
|
|
|
ASTPointer<ASTString> const& _docString,
|
|
|
|
|
ASTPointer<Expression> const& _externalCall,
|
|
|
|
|
std::vector<ASTPointer<TryCatchClause>> const& _clauses
|
|
|
|
|
ASTPointer<Expression> _externalCall,
|
|
|
|
|
std::vector<ASTPointer<TryCatchClause>> _clauses
|
|
|
|
|
):
|
|
|
|
|
Statement(_id, _location, _docString),
|
|
|
|
|
m_externalCall(_externalCall),
|
|
|
|
|
m_clauses(_clauses)
|
|
|
|
|
m_externalCall(std::move(_externalCall)),
|
|
|
|
|
m_clauses(std::move(_clauses))
|
|
|
|
|
{}
|
|
|
|
|
void accept(ASTVisitor& _visitor) override;
|
|
|
|
|
void accept(ASTConstVisitor& _visitor) const override;
|
|
|
|
@@ -1480,11 +1481,11 @@ public:
|
|
|
|
|
int64_t _id,
|
|
|
|
|
SourceLocation const& _location,
|
|
|
|
|
ASTPointer<ASTString> const& _docString,
|
|
|
|
|
ASTPointer<Expression> const& _condition,
|
|
|
|
|
ASTPointer<Statement> const& _body,
|
|
|
|
|
ASTPointer<Expression> _condition,
|
|
|
|
|
ASTPointer<Statement> _body,
|
|
|
|
|
bool _isDoWhile
|
|
|
|
|
):
|
|
|
|
|
BreakableStatement(_id, _location, _docString), m_condition(_condition), m_body(_body),
|
|
|
|
|
BreakableStatement(_id, _location, _docString), m_condition(std::move(_condition)), m_body(std::move(_body)),
|
|
|
|
|
m_isDoWhile(_isDoWhile) {}
|
|
|
|
|
void accept(ASTVisitor& _visitor) override;
|
|
|
|
|
void accept(ASTConstVisitor& _visitor) const override;
|
|
|
|
@@ -1509,16 +1510,16 @@ public:
|
|
|
|
|
int64_t _id,
|
|
|
|
|
SourceLocation const& _location,
|
|
|
|
|
ASTPointer<ASTString> const& _docString,
|
|
|
|
|
ASTPointer<Statement> const& _initExpression,
|
|
|
|
|
ASTPointer<Expression> const& _conditionExpression,
|
|
|
|
|
ASTPointer<ExpressionStatement> const& _loopExpression,
|
|
|
|
|
ASTPointer<Statement> const& _body
|
|
|
|
|
ASTPointer<Statement> _initExpression,
|
|
|
|
|
ASTPointer<Expression> _conditionExpression,
|
|
|
|
|
ASTPointer<ExpressionStatement> _loopExpression,
|
|
|
|
|
ASTPointer<Statement> _body
|
|
|
|
|
):
|
|
|
|
|
BreakableStatement(_id, _location, _docString),
|
|
|
|
|
m_initExpression(_initExpression),
|
|
|
|
|
m_condExpression(_conditionExpression),
|
|
|
|
|
m_loopExpression(_loopExpression),
|
|
|
|
|
m_body(_body)
|
|
|
|
|
m_initExpression(std::move(_initExpression)),
|
|
|
|
|
m_condExpression(std::move(_conditionExpression)),
|
|
|
|
|
m_loopExpression(std::move(_loopExpression)),
|
|
|
|
|
m_body(std::move(_body))
|
|
|
|
|
{}
|
|
|
|
|
void accept(ASTVisitor& _visitor) override;
|
|
|
|
|
void accept(ASTConstVisitor& _visitor) const override;
|
|
|
|
@@ -1567,7 +1568,7 @@ public:
|
|
|
|
|
SourceLocation const& _location,
|
|
|
|
|
ASTPointer<ASTString> const& _docString,
|
|
|
|
|
ASTPointer<Expression> _expression
|
|
|
|
|
): Statement(_id, _location, _docString), m_expression(_expression) {}
|
|
|
|
|
): Statement(_id, _location, _docString), m_expression(std::move(_expression)) {}
|
|
|
|
|
void accept(ASTVisitor& _visitor) override;
|
|
|
|
|
void accept(ASTConstVisitor& _visitor) const override;
|
|
|
|
|
|
|
|
|
@@ -1601,9 +1602,9 @@ public:
|
|
|
|
|
int64_t _id,
|
|
|
|
|
SourceLocation const& _location,
|
|
|
|
|
ASTPointer<ASTString> const& _docString,
|
|
|
|
|
ASTPointer<FunctionCall> const& _functionCall
|
|
|
|
|
ASTPointer<FunctionCall> _functionCall
|
|
|
|
|
):
|
|
|
|
|
Statement(_id, _location, _docString), m_eventCall(_functionCall) {}
|
|
|
|
|
Statement(_id, _location, _docString), m_eventCall(std::move(_functionCall)) {}
|
|
|
|
|
void accept(ASTVisitor& _visitor) override;
|
|
|
|
|
void accept(ASTConstVisitor& _visitor) const override;
|
|
|
|
|
|
|
|
|
@@ -1628,10 +1629,10 @@ public:
|
|
|
|
|
int64_t _id,
|
|
|
|
|
SourceLocation const& _location,
|
|
|
|
|
ASTPointer<ASTString> const& _docString,
|
|
|
|
|
std::vector<ASTPointer<VariableDeclaration>> const& _variables,
|
|
|
|
|
ASTPointer<Expression> const& _initialValue
|
|
|
|
|
std::vector<ASTPointer<VariableDeclaration>> _variables,
|
|
|
|
|
ASTPointer<Expression> _initialValue
|
|
|
|
|
):
|
|
|
|
|
Statement(_id, _location, _docString), m_variables(_variables), m_initialValue(_initialValue) {}
|
|
|
|
|
Statement(_id, _location, _docString), m_variables(std::move(_variables)), m_initialValue(std::move(_initialValue)) {}
|
|
|
|
|
void accept(ASTVisitor& _visitor) override;
|
|
|
|
|
void accept(ASTConstVisitor& _visitor) const override;
|
|
|
|
|
|
|
|
|
@@ -1660,7 +1661,7 @@ public:
|
|
|
|
|
ASTPointer<ASTString> const& _docString,
|
|
|
|
|
ASTPointer<Expression> _expression
|
|
|
|
|
):
|
|
|
|
|
Statement(_id, _location, _docString), m_expression(_expression) {}
|
|
|
|
|
Statement(_id, _location, _docString), m_expression(std::move(_expression)) {}
|
|
|
|
|
void accept(ASTVisitor& _visitor) override;
|
|
|
|
|
void accept(ASTConstVisitor& _visitor) const override;
|
|
|
|
|
|
|
|
|
@@ -1694,14 +1695,14 @@ public:
|
|
|
|
|
Conditional(
|
|
|
|
|
int64_t _id,
|
|
|
|
|
SourceLocation const& _location,
|
|
|
|
|
ASTPointer<Expression> const& _condition,
|
|
|
|
|
ASTPointer<Expression> const& _trueExpression,
|
|
|
|
|
ASTPointer<Expression> const& _falseExpression
|
|
|
|
|
ASTPointer<Expression> _condition,
|
|
|
|
|
ASTPointer<Expression> _trueExpression,
|
|
|
|
|
ASTPointer<Expression> _falseExpression
|
|
|
|
|
):
|
|
|
|
|
Expression(_id, _location),
|
|
|
|
|
m_condition(_condition),
|
|
|
|
|
m_trueExpression(_trueExpression),
|
|
|
|
|
m_falseExpression(_falseExpression)
|
|
|
|
|
m_condition(std::move(_condition)),
|
|
|
|
|
m_trueExpression(std::move(_trueExpression)),
|
|
|
|
|
m_falseExpression(std::move(_falseExpression))
|
|
|
|
|
{}
|
|
|
|
|
void accept(ASTVisitor& _visitor) override;
|
|
|
|
|
void accept(ASTConstVisitor& _visitor) const override;
|
|
|
|
@@ -1724,14 +1725,14 @@ public:
|
|
|
|
|
Assignment(
|
|
|
|
|
int64_t _id,
|
|
|
|
|
SourceLocation const& _location,
|
|
|
|
|
ASTPointer<Expression> const& _leftHandSide,
|
|
|
|
|
ASTPointer<Expression> _leftHandSide,
|
|
|
|
|
Token _assignmentOperator,
|
|
|
|
|
ASTPointer<Expression> const& _rightHandSide
|
|
|
|
|
ASTPointer<Expression> _rightHandSide
|
|
|
|
|
):
|
|
|
|
|
Expression(_id, _location),
|
|
|
|
|
m_leftHandSide(_leftHandSide),
|
|
|
|
|
m_leftHandSide(std::move(_leftHandSide)),
|
|
|
|
|
m_assigmentOperator(_assignmentOperator),
|
|
|
|
|
m_rightHandSide(_rightHandSide)
|
|
|
|
|
m_rightHandSide(std::move(_rightHandSide))
|
|
|
|
|
{
|
|
|
|
|
solAssert(TokenTraits::isAssignmentOp(_assignmentOperator), "");
|
|
|
|
|
}
|
|
|
|
@@ -1762,11 +1763,11 @@ public:
|
|
|
|
|
TupleExpression(
|
|
|
|
|
int64_t _id,
|
|
|
|
|
SourceLocation const& _location,
|
|
|
|
|
std::vector<ASTPointer<Expression>> const& _components,
|
|
|
|
|
std::vector<ASTPointer<Expression>> _components,
|
|
|
|
|
bool _isArray
|
|
|
|
|
):
|
|
|
|
|
Expression(_id, _location),
|
|
|
|
|
m_components(_components),
|
|
|
|
|
m_components(std::move(_components)),
|
|
|
|
|
m_isArray(_isArray) {}
|
|
|
|
|
void accept(ASTVisitor& _visitor) override;
|
|
|
|
|
void accept(ASTConstVisitor& _visitor) const override;
|
|
|
|
@@ -1790,12 +1791,12 @@ public:
|
|
|
|
|
int64_t _id,
|
|
|
|
|
SourceLocation const& _location,
|
|
|
|
|
Token _operator,
|
|
|
|
|
ASTPointer<Expression> const& _subExpression,
|
|
|
|
|
ASTPointer<Expression> _subExpression,
|
|
|
|
|
bool _isPrefix
|
|
|
|
|
):
|
|
|
|
|
Expression(_id, _location),
|
|
|
|
|
m_operator(_operator),
|
|
|
|
|
m_subExpression(_subExpression),
|
|
|
|
|
m_subExpression(std::move(_subExpression)),
|
|
|
|
|
m_isPrefix(_isPrefix)
|
|
|
|
|
{
|
|
|
|
|
solAssert(TokenTraits::isUnaryOp(_operator), "");
|
|
|
|
@@ -1823,11 +1824,11 @@ public:
|
|
|
|
|
BinaryOperation(
|
|
|
|
|
int64_t _id,
|
|
|
|
|
SourceLocation const& _location,
|
|
|
|
|
ASTPointer<Expression> const& _left,
|
|
|
|
|
ASTPointer<Expression> _left,
|
|
|
|
|
Token _operator,
|
|
|
|
|
ASTPointer<Expression> const& _right
|
|
|
|
|
ASTPointer<Expression> _right
|
|
|
|
|
):
|
|
|
|
|
Expression(_id, _location), m_left(_left), m_operator(_operator), m_right(_right)
|
|
|
|
|
Expression(_id, _location), m_left(std::move(_left)), m_operator(_operator), m_right(std::move(_right))
|
|
|
|
|
{
|
|
|
|
|
solAssert(TokenTraits::isBinaryOp(_operator) || TokenTraits::isCompareOp(_operator), "");
|
|
|
|
|
}
|
|
|
|
@@ -1855,11 +1856,11 @@ public:
|
|
|
|
|
FunctionCall(
|
|
|
|
|
int64_t _id,
|
|
|
|
|
SourceLocation const& _location,
|
|
|
|
|
ASTPointer<Expression> const& _expression,
|
|
|
|
|
std::vector<ASTPointer<Expression>> const& _arguments,
|
|
|
|
|
std::vector<ASTPointer<ASTString>> const& _names
|
|
|
|
|
ASTPointer<Expression> _expression,
|
|
|
|
|
std::vector<ASTPointer<Expression>> _arguments,
|
|
|
|
|
std::vector<ASTPointer<ASTString>> _names
|
|
|
|
|
):
|
|
|
|
|
Expression(_id, _location), m_expression(_expression), m_arguments(_arguments), m_names(_names) {}
|
|
|
|
|
Expression(_id, _location), m_expression(std::move(_expression)), m_arguments(std::move(_arguments)), m_names(std::move(_names)) {}
|
|
|
|
|
void accept(ASTVisitor& _visitor) override;
|
|
|
|
|
void accept(ASTConstVisitor& _visitor) const override;
|
|
|
|
|
|
|
|
|
@@ -1885,11 +1886,11 @@ public:
|
|
|
|
|
FunctionCallOptions(
|
|
|
|
|
int64_t _id,
|
|
|
|
|
SourceLocation const& _location,
|
|
|
|
|
ASTPointer<Expression> const& _expression,
|
|
|
|
|
std::vector<ASTPointer<Expression>> const& _options,
|
|
|
|
|
std::vector<ASTPointer<ASTString>> const& _names
|
|
|
|
|
ASTPointer<Expression> _expression,
|
|
|
|
|
std::vector<ASTPointer<Expression>> _options,
|
|
|
|
|
std::vector<ASTPointer<ASTString>> _names
|
|
|
|
|
):
|
|
|
|
|
Expression(_id, _location), m_expression(_expression), m_options(_options), m_names(_names) {}
|
|
|
|
|
Expression(_id, _location), m_expression(std::move(_expression)), m_options(std::move(_options)), m_names(std::move(_names)) {}
|
|
|
|
|
void accept(ASTVisitor& _visitor) override;
|
|
|
|
|
void accept(ASTConstVisitor& _visitor) const override;
|
|
|
|
|
|
|
|
|
@@ -1914,9 +1915,9 @@ public:
|
|
|
|
|
NewExpression(
|
|
|
|
|
int64_t _id,
|
|
|
|
|
SourceLocation const& _location,
|
|
|
|
|
ASTPointer<TypeName> const& _typeName
|
|
|
|
|
ASTPointer<TypeName> _typeName
|
|
|
|
|
):
|
|
|
|
|
Expression(_id, _location), m_typeName(_typeName) {}
|
|
|
|
|
Expression(_id, _location), m_typeName(std::move(_typeName)) {}
|
|
|
|
|
void accept(ASTVisitor& _visitor) override;
|
|
|
|
|
void accept(ASTConstVisitor& _visitor) const override;
|
|
|
|
|
|
|
|
|
@@ -1936,9 +1937,9 @@ public:
|
|
|
|
|
int64_t _id,
|
|
|
|
|
SourceLocation const& _location,
|
|
|
|
|
ASTPointer<Expression> _expression,
|
|
|
|
|
ASTPointer<ASTString> const& _memberName
|
|
|
|
|
ASTPointer<ASTString> _memberName
|
|
|
|
|
):
|
|
|
|
|
Expression(_id, _location), m_expression(_expression), m_memberName(_memberName) {}
|
|
|
|
|
Expression(_id, _location), m_expression(std::move(_expression)), m_memberName(std::move(_memberName)) {}
|
|
|
|
|
void accept(ASTVisitor& _visitor) override;
|
|
|
|
|
void accept(ASTConstVisitor& _visitor) const override;
|
|
|
|
|
Expression const& expression() const { return *m_expression; }
|
|
|
|
@@ -1960,10 +1961,10 @@ public:
|
|
|
|
|
IndexAccess(
|
|
|
|
|
int64_t _id,
|
|
|
|
|
SourceLocation const& _location,
|
|
|
|
|
ASTPointer<Expression> const& _base,
|
|
|
|
|
ASTPointer<Expression> const& _index
|
|
|
|
|
ASTPointer<Expression> _base,
|
|
|
|
|
ASTPointer<Expression> _index
|
|
|
|
|
):
|
|
|
|
|
Expression(_id, _location), m_base(_base), m_index(_index) {}
|
|
|
|
|
Expression(_id, _location), m_base(std::move(_base)), m_index(std::move(_index)) {}
|
|
|
|
|
void accept(ASTVisitor& _visitor) override;
|
|
|
|
|
void accept(ASTConstVisitor& _visitor) const override;
|
|
|
|
|
|
|
|
|
@@ -1984,11 +1985,11 @@ public:
|
|
|
|
|
IndexRangeAccess(
|
|
|
|
|
int64_t _id,
|
|
|
|
|
SourceLocation const& _location,
|
|
|
|
|
ASTPointer<Expression> const& _base,
|
|
|
|
|
ASTPointer<Expression> const& _start,
|
|
|
|
|
ASTPointer<Expression> const& _end
|
|
|
|
|
ASTPointer<Expression> _base,
|
|
|
|
|
ASTPointer<Expression> _start,
|
|
|
|
|
ASTPointer<Expression> _end
|
|
|
|
|
):
|
|
|
|
|
Expression(_id, _location), m_base(_base), m_start(_start), m_end(_end) {}
|
|
|
|
|
Expression(_id, _location), m_base(std::move(_base)), m_start(std::move(_start)), m_end(std::move(_end)) {}
|
|
|
|
|
void accept(ASTVisitor& _visitor) override;
|
|
|
|
|
void accept(ASTConstVisitor& _visitor) const override;
|
|
|
|
|
|
|
|
|
@@ -2021,9 +2022,9 @@ public:
|
|
|
|
|
Identifier(
|
|
|
|
|
int64_t _id,
|
|
|
|
|
SourceLocation const& _location,
|
|
|
|
|
ASTPointer<ASTString> const& _name
|
|
|
|
|
ASTPointer<ASTString> _name
|
|
|
|
|
):
|
|
|
|
|
PrimaryExpression(_id, _location), m_name(_name) {}
|
|
|
|
|
PrimaryExpression(_id, _location), m_name(std::move(_name)) {}
|
|
|
|
|
void accept(ASTVisitor& _visitor) override;
|
|
|
|
|
void accept(ASTConstVisitor& _visitor) const override;
|
|
|
|
|
|
|
|
|
@@ -2046,10 +2047,10 @@ public:
|
|
|
|
|
ElementaryTypeNameExpression(
|
|
|
|
|
int64_t _id,
|
|
|
|
|
SourceLocation const& _location,
|
|
|
|
|
ASTPointer<ElementaryTypeName> const& _type
|
|
|
|
|
ASTPointer<ElementaryTypeName> _type
|
|
|
|
|
):
|
|
|
|
|
PrimaryExpression(_id, _location),
|
|
|
|
|
m_type(_type)
|
|
|
|
|
m_type(std::move(_type))
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
void accept(ASTVisitor& _visitor) override;
|
|
|
|
@@ -2085,10 +2086,10 @@ public:
|
|
|
|
|
int64_t _id,
|
|
|
|
|
SourceLocation const& _location,
|
|
|
|
|
Token _token,
|
|
|
|
|
ASTPointer<ASTString> const& _value,
|
|
|
|
|
ASTPointer<ASTString> _value,
|
|
|
|
|
SubDenomination _sub = SubDenomination::None
|
|
|
|
|
):
|
|
|
|
|
PrimaryExpression(_id, _location), m_token(_token), m_value(_value), m_subDenomination(_sub) {}
|
|
|
|
|
PrimaryExpression(_id, _location), m_token(_token), m_value(std::move(_value)), m_subDenomination(_sub) {}
|
|
|
|
|
void accept(ASTVisitor& _visitor) override;
|
|
|
|
|
void accept(ASTConstVisitor& _visitor) const override;
|
|
|
|
|
|
|
|
|
|