aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-12-02 00:15:16 +0800
committerGitHub <noreply@github.com>2017-12-02 00:15:16 +0800
commit4cad0b224b0f0913100c5957bef98786dc5a31c2 (patch)
treee547cbbed8caa6d82d7a78c7b4e8c75beaf7c557
parent45ddfa1ac46fea1f1f11cf012d80a183ce595a8a (diff)
parentcbb3370836df17dc1edc1497a2caa6fb930cd4dd (diff)
downloaddexon-solidity-4cad0b224b0f0913100c5957bef98786dc5a31c2.tar.gz
dexon-solidity-4cad0b224b0f0913100c5957bef98786dc5a31c2.tar.zst
dexon-solidity-4cad0b224b0f0913100c5957bef98786dc5a31c2.zip
Merge pull request #3250 from ethereum/aliases
Introduce InlineAsm structs into Iulia namespace.
-rw-r--r--libjulia/AsmDataForward.h52
-rw-r--r--libjulia/backends/evm/EVMAssembly.cpp2
-rw-r--r--libjulia/backends/evm/EVMCodeTransform.cpp3
-rw-r--r--libjulia/backends/evm/EVMCodeTransform.h43
-rw-r--r--libsolidity/inlineasm/AsmDataForward.h3
5 files changed, 80 insertions, 23 deletions
diff --git a/libjulia/AsmDataForward.h b/libjulia/AsmDataForward.h
new file mode 100644
index 00000000..3806e321
--- /dev/null
+++ b/libjulia/AsmDataForward.h
@@ -0,0 +1,52 @@
+/*
+ This file is part of solidity.
+
+ solidity is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ solidity is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with solidity. If not, see <http://www.gnu.org/licenses/>.
+*/
+/**
+ * @date 2017
+ * Pull in some identifiers from the solidity::assembly namespace.
+ */
+
+#pragma once
+
+#include <libsolidity/inlineasm/AsmDataForward.h>
+
+namespace dev
+{
+namespace julia
+{
+
+using Instruction = solidity::assembly::Instruction;
+using Literal = solidity::assembly::Literal;
+using Label = solidity::assembly::Label;
+using StackAssignment = solidity::assembly::StackAssignment;
+using Identifier = solidity::assembly::Identifier;
+using Assignment = solidity::assembly::Assignment;
+using VariableDeclaration = solidity::assembly::VariableDeclaration;
+using FunctionalInstruction = solidity::assembly::FunctionalInstruction;
+using FunctionDefinition = solidity::assembly::FunctionDefinition;
+using FunctionCall = solidity::assembly::FunctionCall;
+using If = solidity::assembly::If;
+using Case = solidity::assembly::Case;
+using Switch = solidity::assembly::Switch;
+using ForLoop = solidity::assembly::ForLoop;
+using Block = solidity::assembly::Block;
+
+using TypedName = solidity::assembly::TypedName;
+
+using Statement = boost::variant<Instruction, Literal, Label, StackAssignment, Identifier, Assignment, FunctionCall, FunctionalInstruction, VariableDeclaration, FunctionDefinition, If, Switch, ForLoop, Block>;
+
+}
+}
diff --git a/libjulia/backends/evm/EVMAssembly.cpp b/libjulia/backends/evm/EVMAssembly.cpp
index 1d499b20..07ad05c9 100644
--- a/libjulia/backends/evm/EVMAssembly.cpp
+++ b/libjulia/backends/evm/EVMAssembly.cpp
@@ -26,7 +26,7 @@
using namespace std;
using namespace dev;
-using namespace julia;
+using namespace dev::julia;
namespace
{
diff --git a/libjulia/backends/evm/EVMCodeTransform.cpp b/libjulia/backends/evm/EVMCodeTransform.cpp
index 13d9d011..099b83fe 100644
--- a/libjulia/backends/evm/EVMCodeTransform.cpp
+++ b/libjulia/backends/evm/EVMCodeTransform.cpp
@@ -31,7 +31,8 @@ using namespace std;
using namespace dev;
using namespace dev::julia;
using namespace dev::solidity;
-using namespace dev::solidity::assembly;
+
+using Scope = dev::solidity::assembly::Scope;
void CodeTransform::operator()(VariableDeclaration const& _varDecl)
{
diff --git a/libjulia/backends/evm/EVMCodeTransform.h b/libjulia/backends/evm/EVMCodeTransform.h
index 387720a2..e4cb20ed 100644
--- a/libjulia/backends/evm/EVMCodeTransform.h
+++ b/libjulia/backends/evm/EVMCodeTransform.h
@@ -20,8 +20,9 @@
#include <libjulia/backends/evm/EVMAssembly.h>
+#include <libjulia/AsmDataForward.h>
+
#include <libsolidity/inlineasm/AsmScope.h>
-#include <libsolidity/inlineasm/AsmDataForward.h>
#include <boost/variant.hpp>
#include <boost/optional.hpp>
@@ -95,38 +96,38 @@ protected:
{}
public:
- void operator()(solidity::assembly::Instruction const& _instruction);
- void operator()(solidity::assembly::Literal const& _literal);
- void operator()(solidity::assembly::Identifier const& _identifier);
- void operator()(solidity::assembly::FunctionalInstruction const& _instr);
- void operator()(solidity::assembly::FunctionCall const&);
- void operator()(solidity::assembly::Label const& _label);
- void operator()(solidity::assembly::StackAssignment const& _assignment);
- void operator()(solidity::assembly::Assignment const& _assignment);
- void operator()(solidity::assembly::VariableDeclaration const& _varDecl);
- void operator()(solidity::assembly::If const& _if);
- void operator()(solidity::assembly::Switch const& _switch);
- void operator()(solidity::assembly::FunctionDefinition const&);
- void operator()(solidity::assembly::ForLoop const&);
- void operator()(solidity::assembly::Block const& _block);
+ void operator()(Instruction const& _instruction);
+ void operator()(Literal const& _literal);
+ void operator()(Identifier const& _identifier);
+ void operator()(FunctionalInstruction const& _instr);
+ void operator()(FunctionCall const&);
+ void operator()(Label const& _label);
+ void operator()(StackAssignment const& _assignment);
+ void operator()(Assignment const& _assignment);
+ void operator()(VariableDeclaration const& _varDecl);
+ void operator()(If const& _if);
+ void operator()(Switch const& _switch);
+ void operator()(FunctionDefinition const&);
+ void operator()(ForLoop const&);
+ void operator()(Block const& _block);
private:
- AbstractAssembly::LabelID labelFromIdentifier(solidity::assembly::Identifier const& _identifier);
+ AbstractAssembly::LabelID labelFromIdentifier(Identifier const& _identifier);
/// @returns the label ID corresponding to the given label, allocating a new one if
/// necessary.
AbstractAssembly::LabelID labelID(solidity::assembly::Scope::Label const& _label);
AbstractAssembly::LabelID functionEntryID(std::string const& _name, solidity::assembly::Scope::Function const& _function);
/// Generates code for an expression that is supposed to return a single value.
- void visitExpression(solidity::assembly::Statement const& _expression);
+ void visitExpression(Statement const& _expression);
- void visitStatements(std::vector<solidity::assembly::Statement> const& _statements);
+ void visitStatements(std::vector<Statement> const& _statements);
/// Pops all variables declared in the block and checks that the stack height is equal
/// to @a _blackStartStackHeight.
- void finalizeBlock(solidity::assembly::Block const& _block, int _blockStartStackHeight);
+ void finalizeBlock(Block const& _block, int _blockStartStackHeight);
- void generateMultiAssignment(std::vector<solidity::assembly::Identifier> const& _variableNames);
- void generateAssignment(solidity::assembly::Identifier const& _variableName);
+ void generateMultiAssignment(std::vector<Identifier> const& _variableNames);
+ void generateAssignment(Identifier const& _variableName);
/// Determines the stack height difference to the given variables. Throws
/// if it is not yet in scope or the height difference is too large. Returns
diff --git a/libsolidity/inlineasm/AsmDataForward.h b/libsolidity/inlineasm/AsmDataForward.h
index d627b41a..1ab62cc0 100644
--- a/libsolidity/inlineasm/AsmDataForward.h
+++ b/libsolidity/inlineasm/AsmDataForward.h
@@ -43,9 +43,12 @@ struct FunctionDefinition;
struct FunctionCall;
struct If;
struct Switch;
+struct Case;
struct ForLoop;
struct Block;
+struct TypedName;
+
using Statement = boost::variant<Instruction, Literal, Label, StackAssignment, Identifier, Assignment, FunctionCall, FunctionalInstruction, VariableDeclaration, FunctionDefinition, If, Switch, ForLoop, Block>;
}