aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/inlineasm/AsmCodeGen.h
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2017-03-14 22:41:23 +0800
committerchriseth <chris@ethereum.org>2017-04-25 22:49:03 +0800
commite0849f2f3bbb23ebddb37cd770f46266967e789d (patch)
tree53c454ea354e032963ef246e11210de44731155c /libsolidity/inlineasm/AsmCodeGen.h
parent5d6747eb32f56f6b8b818eff5635888d250d62e1 (diff)
downloaddexon-solidity-e0849f2f3bbb23ebddb37cd770f46266967e789d.tar
dexon-solidity-e0849f2f3bbb23ebddb37cd770f46266967e789d.tar.gz
dexon-solidity-e0849f2f3bbb23ebddb37cd770f46266967e789d.tar.bz2
dexon-solidity-e0849f2f3bbb23ebddb37cd770f46266967e789d.tar.lz
dexon-solidity-e0849f2f3bbb23ebddb37cd770f46266967e789d.tar.xz
dexon-solidity-e0849f2f3bbb23ebddb37cd770f46266967e789d.tar.zst
dexon-solidity-e0849f2f3bbb23ebddb37cd770f46266967e789d.zip
Split external identifier access into resolving and code generation.
Diffstat (limited to 'libsolidity/inlineasm/AsmCodeGen.h')
-rw-r--r--libsolidity/inlineasm/AsmCodeGen.h18
1 files changed, 6 insertions, 12 deletions
diff --git a/libsolidity/inlineasm/AsmCodeGen.h b/libsolidity/inlineasm/AsmCodeGen.h
index bd71812e..f259a36c 100644
--- a/libsolidity/inlineasm/AsmCodeGen.h
+++ b/libsolidity/inlineasm/AsmCodeGen.h
@@ -22,8 +22,10 @@
#pragma once
-#include <functional>
#include <libsolidity/interface/Exceptions.h>
+#include <libsolidity/inlineasm/AsmStack.h>
+
+#include <functional>
namespace dev
{
@@ -36,27 +38,19 @@ namespace solidity
namespace assembly
{
struct Block;
-struct Identifier;
class CodeGenerator
{
public:
- enum class IdentifierContext { LValue, RValue };
- /// Function type that is called for external identifiers. Such a function should search for
- /// the identifier and append appropriate assembly items to the assembly. If in lvalue context,
- /// the value to assign is assumed to be on the stack and an assignment is to be performed.
- /// If in rvalue context, the function is assumed to append instructions to
- /// push the value of the identifier onto the stack. On error, the function should return false.
- using IdentifierAccess = std::function<bool(assembly::Identifier const&, eth::Assembly&, IdentifierContext)>;
CodeGenerator(Block const& _parsedData, ErrorList& _errors):
m_parsedData(_parsedData), m_errors(_errors) {}
/// Performs type checks and @returns false on error.
/// Actually runs the full code generation but discards the result.
- bool typeCheck(IdentifierAccess const& _identifierAccess = IdentifierAccess());
+ bool typeCheck(ExternalIdentifierAccess const& _identifierAccess = ExternalIdentifierAccess());
/// Performs code generation and @returns the result.
- eth::Assembly assemble(IdentifierAccess const& _identifierAccess = IdentifierAccess());
+ eth::Assembly assemble(ExternalIdentifierAccess const& _identifierAccess = ExternalIdentifierAccess());
/// Performs code generation and appends generated to to _assembly.
- void assemble(eth::Assembly& _assembly, IdentifierAccess const& _identifierAccess = IdentifierAccess());
+ void assemble(eth::Assembly& _assembly, ExternalIdentifierAccess const& _identifierAccess = ExternalIdentifierAccess());
private:
Block const& m_parsedData;