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/analysis | |
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/analysis')
-rw-r--r-- | libsolidity/analysis/ReferencesResolver.cpp | 10 | ||||
-rw-r--r-- | libsolidity/analysis/TypeChecker.cpp | 11 |
2 files changed, 10 insertions, 11 deletions
diff --git a/libsolidity/analysis/ReferencesResolver.cpp b/libsolidity/analysis/ReferencesResolver.cpp index 5ff4ee2d..a50fc6a0 100644 --- a/libsolidity/analysis/ReferencesResolver.cpp +++ b/libsolidity/analysis/ReferencesResolver.cpp @@ -25,7 +25,7 @@ #include <libsolidity/analysis/NameAndTypeResolver.h> #include <libsolidity/interface/Exceptions.h> #include <libsolidity/analysis/ConstantEvaluator.h> -#include <libsolidity/inlineasm/AsmCodeGen.h> +#include <libsolidity/inlineasm/AsmAnalysis.h> #include <libsolidity/inlineasm/AsmData.h> using namespace std; @@ -163,9 +163,8 @@ bool ReferencesResolver::visit(InlineAssembly const& _inlineAssembly) // The only purpose of this step is to fill the inline assembly annotation with // external references. ErrorList errorsIgnored; - assembly::CodeGenerator codeGen(_inlineAssembly.operations(), errorsIgnored); - assembly::ExternalIdentifierAccess identifierAccess; - identifierAccess.resolve = [&](assembly::Identifier const& _identifier, assembly::IdentifierContext) { + assembly::ExternalIdentifierAccess::Resolver resolver = + [&](assembly::Identifier const& _identifier, assembly::IdentifierContext) { auto declarations = m_resolver.nameFromCurrentScope(_identifier.name); if (declarations.size() != 1) return size_t(-1); @@ -173,7 +172,8 @@ bool ReferencesResolver::visit(InlineAssembly const& _inlineAssembly) // At this stage we do not yet know the stack size of the identifier, so we just return 1. return size_t(1); }; - codeGen.typeCheck(identifierAccess); + assembly::AsmAnalyzer::Scopes scopes; + assembly::AsmAnalyzer(scopes, errorsIgnored, resolver).analyze(_inlineAssembly.operations()); return false; } diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 808914ae..11c27238 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -24,8 +24,7 @@ #include <memory> #include <boost/range/adaptor/reversed.hpp> #include <libsolidity/ast/AST.h> -#include <libevmasm/Assembly.h> // needed for inline assembly -#include <libsolidity/inlineasm/AsmCodeGen.h> +#include <libsolidity/inlineasm/AsmAnalysis.h> using namespace std; using namespace dev; @@ -630,8 +629,7 @@ bool TypeChecker::visit(InlineAssembly const& _inlineAssembly) { // External references have already been resolved in a prior stage and stored in the annotation. // We run the resolve step again regardless. - assembly::ExternalIdentifierAccess identifierAccess; - identifierAccess.resolve = [&]( + assembly::ExternalIdentifierAccess::Resolver identifierAccess = [&]( assembly::Identifier const& _identifier, assembly::IdentifierContext _context ) @@ -682,8 +680,9 @@ bool TypeChecker::visit(InlineAssembly const& _inlineAssembly) ref->second.valueSize = valueSize; return valueSize; }; - assembly::CodeGenerator codeGen(_inlineAssembly.operations(), m_errors); - if (!codeGen.typeCheck(identifierAccess)) + assembly::AsmAnalyzer::Scopes scopes; + assembly::AsmAnalyzer analyzer(scopes, m_errors, identifierAccess); + if (!analyzer.analyze(_inlineAssembly.operations())) return false; return true; } |