From fcedaba7f77c1ed4ca5eb26550ab7d686a502f58 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Wed, 28 Oct 2020 23:40:06 +0000 Subject: [PATCH] [ewasm] Allow compiling abstract/interface contracts --- libsolidity/interface/CompilerStack.cpp | 3 +++ .../cmdlineTests/standard_ewasm_requested_abstract/output.json | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp index 5961e58a9..dee9940e6 100644 --- a/libsolidity/interface/CompilerStack.cpp +++ b/libsolidity/interface/CompilerStack.cpp @@ -1256,6 +1256,9 @@ void CompilerStack::generateEwasm(ContractDefinition const& _contract) if (m_hasError) BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Called generateEwasm with errors.")); + if (!_contract.canBeDeployed()) + return; + Contract& compiledContract = m_contracts.at(_contract.fullyQualifiedName()); solAssert(!compiledContract.yulIROptimized.empty(), ""); if (!compiledContract.ewasm.empty()) diff --git a/test/cmdlineTests/standard_ewasm_requested_abstract/output.json b/test/cmdlineTests/standard_ewasm_requested_abstract/output.json index 55ff78db9..2858515df 100644 --- a/test/cmdlineTests/standard_ewasm_requested_abstract/output.json +++ b/test/cmdlineTests/standard_ewasm_requested_abstract/output.json @@ -1,2 +1 @@ -{"errors":[{"component":"general","formattedMessage":"InternalCompilerError: -","message":"Internal compiler error (/project/solidity/libsolidity/interface/CompilerStack.cpp:1260):","severity":"error","type":"InternalCompilerError"}],"sources":{"A":{"id":0}}} +{"contracts":{"A":{"C":{"ewasm":{"wasm":"","wast":""}}}},"sources":{"A":{"id":0}}}