diff options
author | chriseth <chris@ethereum.org> | 2017-03-22 02:38:37 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2017-04-25 22:49:03 +0800 |
commit | c6fa78c73e3a23661014fd03b92d74d2e7df9e81 (patch) | |
tree | 7ad6f3ff22eb5bccd72cd868d153f0370203783a /libsolidity/inlineasm/AsmStack.h | |
parent | e0849f2f3bbb23ebddb37cd770f46266967e789d (diff) | |
download | dexon-solidity-c6fa78c73e3a23661014fd03b92d74d2e7df9e81.tar.gz dexon-solidity-c6fa78c73e3a23661014fd03b92d74d2e7df9e81.tar.zst dexon-solidity-c6fa78c73e3a23661014fd03b92d74d2e7df9e81.zip |
Use actual type checking phase of assembler.
Diffstat (limited to 'libsolidity/inlineasm/AsmStack.h')
-rw-r--r-- | libsolidity/inlineasm/AsmStack.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/libsolidity/inlineasm/AsmStack.h b/libsolidity/inlineasm/AsmStack.h index b6e4952a..77a7e02a 100644 --- a/libsolidity/inlineasm/AsmStack.h +++ b/libsolidity/inlineasm/AsmStack.h @@ -47,13 +47,15 @@ enum class IdentifierContext { LValue, RValue }; /// to inline assembly (not used in standalone assembly mode). struct ExternalIdentifierAccess { + using Resolver = std::function<size_t(assembly::Identifier const&, IdentifierContext)>; /// Resolve a an external reference given by the identifier in the given context. /// @returns the size of the value (number of stack slots) or size_t(-1) if not found. - std::function<size_t(assembly::Identifier const&, IdentifierContext)> resolve; + Resolver resolve; + using CodeGenerator = std::function<void(assembly::Identifier const&, IdentifierContext, eth::Assembly&)>; /// Generate code for retrieving the value (rvalue context) or storing the value (lvalue context) /// of an identifier. The code should be appended to the assembly. In rvalue context, the value is supposed /// to be put onto the stack, in lvalue context, the value is assumed to be at the top of the stack. - std::function<void(assembly::Identifier const&, IdentifierContext, eth::Assembly&)> generateCode; + CodeGenerator generateCode; }; class InlineAssemblyStack @@ -61,7 +63,10 @@ class InlineAssemblyStack public: /// Parse the given inline assembly chunk starting with `{` and ending with the corresponding `}`. /// @return false or error. - bool parse(std::shared_ptr<Scanner> const& _scanner); + bool parse( + std::shared_ptr<Scanner> const& _scanner, + ExternalIdentifierAccess::Resolver const& _externalIdentifierResolver = ExternalIdentifierAccess::Resolver() + ); /// Converts the parser result back into a string form (not necessarily the same form /// as the source form, but it should parse into the same parsed form again). std::string toString(); |