Isolating libyul library API into its own namespace yul.

This commit is contained in:
Christian Parpart
2018-11-23 14:29:00 +01:00
parent 3734f40d31
commit ec47c8946b
105 changed files with 366 additions and 582 deletions
+9 -9
View File
@@ -41,6 +41,12 @@
#include <vector>
#include <memory>
namespace yul
{
// Forward-declaration to <yul/AsmData.h>
struct Block;
}
namespace dev
{
namespace solidity
@@ -1028,12 +1034,6 @@ public:
StatementAnnotation& annotation() const override;
};
namespace assembly
{
// Forward-declaration to AsmData.h
struct Block;
}
/**
* Inline assembly.
*/
@@ -1043,18 +1043,18 @@ public:
InlineAssembly(
SourceLocation const& _location,
ASTPointer<ASTString> const& _docString,
std::shared_ptr<assembly::Block> const& _operations
std::shared_ptr<yul::Block> const& _operations
):
Statement(_location, _docString), m_operations(_operations) {}
void accept(ASTVisitor& _visitor) override;
void accept(ASTConstVisitor& _visitor) const override;
assembly::Block const& operations() const { return *m_operations; }
yul::Block const& operations() const { return *m_operations; }
InlineAssemblyAnnotation& annotation() const override;
private:
std::shared_ptr<assembly::Block> m_operations;
std::shared_ptr<yul::Block> m_operations;
};
/**
+8 -8
View File
@@ -30,6 +30,12 @@
#include <vector>
#include <set>
namespace yul
{
struct AsmAnalysisInfo;
struct Identifier;
}
namespace dev
{
namespace solidity
@@ -120,12 +126,6 @@ struct StatementAnnotation: ASTAnnotation, DocumentedAnnotation
{
};
namespace assembly
{
struct AsmAnalysisInfo;
struct Identifier;
}
struct InlineAssemblyAnnotation: StatementAnnotation
{
struct ExternalIdentifierInfo
@@ -137,9 +137,9 @@ struct InlineAssemblyAnnotation: StatementAnnotation
};
/// Mapping containing resolved references to external identifiers and their value size
std::map<assembly::Identifier const*, ExternalIdentifierInfo> externalReferences;
std::map<yul::Identifier const*, ExternalIdentifierInfo> externalReferences;
/// Information generated during analysis phase.
std::shared_ptr<assembly::AsmAnalysisInfo> analysisInfo;
std::shared_ptr<yul::AsmAnalysisInfo> analysisInfo;
};
struct ReturnAnnotation: StatementAnnotation
+2 -2
View File
@@ -172,7 +172,7 @@ void ASTJsonConverter::appendExpressionAttributes(
_attributes += exprAttributes;
}
Json::Value ASTJsonConverter::inlineAssemblyIdentifierToJson(pair<assembly::Identifier const* ,InlineAssemblyAnnotation::ExternalIdentifierInfo> _info) const
Json::Value ASTJsonConverter::inlineAssemblyIdentifierToJson(pair<yul::Identifier const* ,InlineAssemblyAnnotation::ExternalIdentifierInfo> _info) const
{
Json::Value tuple(Json::objectValue);
tuple["src"] = sourceLocationToString(_info.first->location);
@@ -465,7 +465,7 @@ bool ASTJsonConverter::visit(InlineAssembly const& _node)
}
}
setJsonNode(_node, "InlineAssembly", {
make_pair("operations", Json::Value(assembly::AsmPrinter()(_node.operations()))),
make_pair("operations", Json::Value(yul::AsmPrinter()(_node.operations()))),
make_pair("externalReferences", std::move(externalReferences))
});
return false;
+1 -1
View File
@@ -135,7 +135,7 @@ private:
{
return _node ? toJson(*_node) : Json::nullValue;
}
Json::Value inlineAssemblyIdentifierToJson(std::pair<assembly::Identifier const* , InlineAssemblyAnnotation::ExternalIdentifierInfo> _info) const;
Json::Value inlineAssemblyIdentifierToJson(std::pair<yul::Identifier const* , InlineAssemblyAnnotation::ExternalIdentifierInfo> _info) const;
static std::string location(VariableDeclaration::Location _location);
static std::string contractKind(ContractDefinition::ContractKind _kind);
static std::string functionCallKind(FunctionCallKind _kind);