diff options
author | chriseth <c@ethdev.com> | 2016-08-26 05:53:03 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2016-08-30 21:31:50 +0800 |
commit | 4bfe09897e3346038b95eb10d74dd0d8c9a8f40e (patch) | |
tree | 795ec36c69ef1b946d2e34ec39cad82c174b1d0b /libsolidity | |
parent | cf974fd103dbb56313eee40ce9ffe4d03d6c1b04 (diff) | |
download | dexon-solidity-4bfe09897e3346038b95eb10d74dd0d8c9a8f40e.tar.gz dexon-solidity-4bfe09897e3346038b95eb10d74dd0d8c9a8f40e.tar.zst dexon-solidity-4bfe09897e3346038b95eb10d74dd0d8c9a8f40e.zip |
Make fallback function throw by default.
Diffstat (limited to 'libsolidity')
-rw-r--r-- | libsolidity/analysis/TypeChecker.cpp | 2 | ||||
-rw-r--r-- | libsolidity/codegen/ContractCompiler.cpp | 5 |
2 files changed, 3 insertions, 4 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 235fcabd..bc03da01 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -92,6 +92,8 @@ bool TypeChecker::visit(ContractDefinition const& _contract) else { fallbackFunction = function; + if (_contract.isLibrary()) + typeError(fallbackFunction->location(), "Libraries cannot have fallback functions."); if (!fallbackFunction->parameters().empty()) typeError(fallbackFunction->parameterList().location(), "Fallback function cannot take parameters."); if (!fallbackFunction->returnParameters().empty()) diff --git a/libsolidity/codegen/ContractCompiler.cpp b/libsolidity/codegen/ContractCompiler.cpp index 715852be..9d77ccdc 100644 --- a/libsolidity/codegen/ContractCompiler.cpp +++ b/libsolidity/codegen/ContractCompiler.cpp @@ -247,11 +247,8 @@ void ContractCompiler::appendFunctionSelector(ContractDefinition const& _contrac m_context << returnTag; appendReturnValuePacker(FunctionType(*fallback).returnParameterTypes(), _contract.isLibrary()); } - else if (_contract.isLibrary()) - // Reject invalid library calls and ether sent to a library. - m_context.appendJumpTo(m_context.errorTag()); else - m_context << Instruction::STOP; // function not found + m_context.appendJumpTo(m_context.errorTag()); for (auto const& it: interfaceFunctions) { |