mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #8849 from ethereum/testcithing
Fix duplicate tag assert throw
This commit is contained in:
commit
1c24814ac0
@ -11,6 +11,7 @@ Compiler Features:
|
|||||||
Bugfixes:
|
Bugfixes:
|
||||||
* ABI: Skip ``private`` or ``internal`` constructors.
|
* ABI: Skip ``private`` or ``internal`` constructors.
|
||||||
* Type Checker: Disallow accessing ``runtimeCode`` for contract types that contain immutable state variables.
|
* Type Checker: Disallow accessing ``runtimeCode`` for contract types that contain immutable state variables.
|
||||||
|
* Fixed an "Assembly Exception in Bytecode" error where requested functions were generated twice.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,6 +49,9 @@ void Compiler::compileContract(
|
|||||||
m_runtimeSub = creationCompiler.compileConstructor(_contract, _otherCompilers);
|
m_runtimeSub = creationCompiler.compileConstructor(_contract, _otherCompilers);
|
||||||
|
|
||||||
m_context.optimise(m_optimiserSettings);
|
m_context.optimise(m_optimiserSettings);
|
||||||
|
|
||||||
|
solAssert(m_context.requestedYulFunctionsRan(), "requestedYulFunctions() was not called.");
|
||||||
|
solAssert(m_runtimeContext.requestedYulFunctionsRan(), "requestedYulFunctions() was not called.");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<evmasm::Assembly> Compiler::runtimeAssemblyPtr() const
|
std::shared_ptr<evmasm::Assembly> Compiler::runtimeAssemblyPtr() const
|
||||||
|
@ -192,6 +192,9 @@ void CompilerContext::appendMissingLowLevelFunctions()
|
|||||||
|
|
||||||
pair<string, set<string>> CompilerContext::requestedYulFunctions()
|
pair<string, set<string>> CompilerContext::requestedYulFunctions()
|
||||||
{
|
{
|
||||||
|
solAssert(!m_requestedYulFunctionsRan, "requestedYulFunctions called more than once.");
|
||||||
|
m_requestedYulFunctionsRan = true;
|
||||||
|
|
||||||
set<string> empty;
|
set<string> empty;
|
||||||
swap(empty, m_externallyUsedYulFunctions);
|
swap(empty, m_externallyUsedYulFunctions);
|
||||||
return {m_yulFunctionCollector.requestedFunctions(), std::move(empty)};
|
return {m_yulFunctionCollector.requestedFunctions(), std::move(empty)};
|
||||||
|
@ -167,6 +167,7 @@ public:
|
|||||||
/// Clears the internal list, i.e. calling it again will result in an
|
/// Clears the internal list, i.e. calling it again will result in an
|
||||||
/// empty return value.
|
/// empty return value.
|
||||||
std::pair<std::string, std::set<std::string>> requestedYulFunctions();
|
std::pair<std::string, std::set<std::string>> requestedYulFunctions();
|
||||||
|
bool requestedYulFunctionsRan() const { return m_requestedYulFunctionsRan; }
|
||||||
|
|
||||||
/// Returns the distance of the given local variable from the bottom of the stack (of the current function).
|
/// Returns the distance of the given local variable from the bottom of the stack (of the current function).
|
||||||
unsigned baseStackOffsetOfVariable(Declaration const& _declaration) const;
|
unsigned baseStackOffsetOfVariable(Declaration const& _declaration) const;
|
||||||
@ -389,6 +390,8 @@ private:
|
|||||||
YulUtilFunctions m_yulUtilFunctions;
|
YulUtilFunctions m_yulUtilFunctions;
|
||||||
/// The queue of low-level functions to generate.
|
/// The queue of low-level functions to generate.
|
||||||
std::queue<std::tuple<std::string, unsigned, unsigned, std::function<void(CompilerContext&)>>> m_lowLevelFunctionGenerationQueue;
|
std::queue<std::tuple<std::string, unsigned, unsigned, std::function<void(CompilerContext&)>>> m_lowLevelFunctionGenerationQueue;
|
||||||
|
/// Flag to check that requestedYulFunctions() was called exactly once
|
||||||
|
bool m_requestedYulFunctionsRan = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -103,8 +103,6 @@ void ContractCompiler::compileContract(
|
|||||||
// and adds the function to the compilation queue. Additionally internal functions,
|
// and adds the function to the compilation queue. Additionally internal functions,
|
||||||
// which are referenced directly or indirectly will be added.
|
// which are referenced directly or indirectly will be added.
|
||||||
appendFunctionSelector(_contract);
|
appendFunctionSelector(_contract);
|
||||||
// This processes the above populated queue until it is empty.
|
|
||||||
appendMissingFunctions();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t ContractCompiler::compileConstructor(
|
size_t ContractCompiler::compileConstructor(
|
||||||
@ -215,6 +213,9 @@ size_t ContractCompiler::deployLibrary(ContractDefinition const& _contract)
|
|||||||
solAssert(!!m_runtimeCompiler, "");
|
solAssert(!!m_runtimeCompiler, "");
|
||||||
solAssert(_contract.isLibrary(), "Tried to deploy contract as library.");
|
solAssert(_contract.isLibrary(), "Tried to deploy contract as library.");
|
||||||
|
|
||||||
|
appendMissingFunctions();
|
||||||
|
m_runtimeCompiler->appendMissingFunctions();
|
||||||
|
|
||||||
CompilerContext::LocationSetter locationSetter(m_context, _contract);
|
CompilerContext::LocationSetter locationSetter(m_context, _contract);
|
||||||
|
|
||||||
solAssert(m_context.runtimeSub() != size_t(-1), "Runtime sub not registered");
|
solAssert(m_context.runtimeSub() != size_t(-1), "Runtime sub not registered");
|
||||||
|
@ -0,0 +1,28 @@
|
|||||||
|
pragma solidity ^0.6.0;
|
||||||
|
|
||||||
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
|
contract Ownable {
|
||||||
|
address private _owner;
|
||||||
|
|
||||||
|
modifier onlyOwner() {
|
||||||
|
require(msg.sender == _owner, "Ownable: caller is not the owner");
|
||||||
|
_;
|
||||||
|
}
|
||||||
|
|
||||||
|
function renounceOwnership() public onlyOwner { }
|
||||||
|
}
|
||||||
|
|
||||||
|
library VoteTiming {
|
||||||
|
function init(uint phaseLength) internal pure {
|
||||||
|
require(true, "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
contract Voting is Ownable {
|
||||||
|
constructor() public {
|
||||||
|
VoteTiming.init(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ----
|
||||||
|
// Warning: (324-340): Unused function parameter. Remove or comment out the variable name to silence this warning.
|
Loading…
Reference in New Issue
Block a user