From ae6251effd0474cd25379f09148da95b3486e9b4 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Fri, 9 Jun 2017 11:36:36 +0100 Subject: Use inline assembly directly and not via AsmStack --- libsolidity/codegen/CompilerContext.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'libsolidity/codegen') diff --git a/libsolidity/codegen/CompilerContext.cpp b/libsolidity/codegen/CompilerContext.cpp index 9c4fbcbb..d98efcad 100644 --- a/libsolidity/codegen/CompilerContext.cpp +++ b/libsolidity/codegen/CompilerContext.cpp @@ -25,8 +25,11 @@ #include #include #include -#include -#include +#include +#include +#include +#include +#include #include @@ -302,7 +305,18 @@ void CompilerContext::appendInlineAssembly( } }; - solAssert(assembly::InlineAssemblyStack().parseAndAssemble(*assembly, *m_asm, identifierAccess), "Failed to assemble inline assembly block."); + ErrorList errors; + ErrorReporter errorReporter(errors); + auto scanner = make_shared(CharStream(*assembly), "--CODEGEN--"); + auto parserResult = assembly::Parser(errorReporter).parse(scanner); + solAssert(parserResult, "Failed to parse inline assembly block."); + solAssert(errorReporter.errors().empty(), "Failed to parse inline assembly block."); + + assembly::AsmAnalysisInfo analysisInfo; + assembly::AsmAnalyzer analyzer(analysisInfo, errorReporter, false, identifierAccess.resolve); + solAssert(analyzer.analyze(*parserResult), "Failed to analyze inline assembly block."); + solAssert(errorReporter.errors().empty(), "Failed to analyze inline assembly block."); + assembly::CodeGenerator::assemble(*parserResult, analysisInfo, *m_asm, identifierAccess); } FunctionDefinition const& CompilerContext::resolveVirtualFunction( -- cgit