mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Introduce contract inheritance
This commit is contained in:
parent
d56dfcf750
commit
23e76926ea
@ -229,12 +229,15 @@ string ContractGenerator::visit()
|
|||||||
ostringstream os;
|
ostringstream os;
|
||||||
string inheritance;
|
string inheritance;
|
||||||
if (state->sourceUnitState[state->currentPath()]->contractType())
|
if (state->sourceUnitState[state->currentPath()]->contractType())
|
||||||
inheritance = state->sourceUnitState[state->currentPath()]->randomContract();
|
inheritance = state->currentSourceState()->randomContract();
|
||||||
string name = state->newContract();
|
string name = state->newContract();
|
||||||
state->updateContract(name);
|
state->updateContract(name);
|
||||||
os << "contract " << name;
|
os << "contract " << name;
|
||||||
if (!inheritance.empty())
|
if (!inheritance.empty())
|
||||||
|
{
|
||||||
os << " is " << inheritance;
|
os << " is " << inheritance;
|
||||||
|
state->currentContractState()->functions += state->contractState[inheritance]->functions;
|
||||||
|
}
|
||||||
os << " {" << endl;
|
os << " {" << endl;
|
||||||
set();
|
set();
|
||||||
os << visitChildren();
|
os << visitChildren();
|
||||||
@ -723,7 +726,7 @@ SolidityTypePtr TypeProvider::type()
|
|||||||
case Type::ADDRESS:
|
case Type::ADDRESS:
|
||||||
return make_shared<AddressType>();
|
return make_shared<AddressType>();
|
||||||
case Type::FUNCTION:
|
case Type::FUNCTION:
|
||||||
return make_shared<FunctionType>(false);
|
return make_shared<FunctionType>(true);
|
||||||
case Type::CONTRACT:
|
case Type::CONTRACT:
|
||||||
if (state->sourceUnitState[state->currentPath()]->contractType())
|
if (state->sourceUnitState[state->currentPath()]->contractType())
|
||||||
return state->sourceUnitState[state->currentPath()]->randomContractType();
|
return state->sourceUnitState[state->currentPath()]->randomContractType();
|
||||||
@ -840,6 +843,7 @@ string FunctionCallGenerator::callStmt(shared_ptr<FunctionState> _callee)
|
|||||||
// Create lhs expression only if function outputs non-zero return values.
|
// Create lhs expression only if function outputs non-zero return values.
|
||||||
if (!_callee->outputs.empty())
|
if (!_callee->outputs.empty())
|
||||||
lhsExpr = lhs(_callee->outputs);
|
lhsExpr = lhs(_callee->outputs);
|
||||||
|
|
||||||
callStmtStream << indentation()
|
callStmtStream << indentation()
|
||||||
<< lhsExpr
|
<< lhsExpr
|
||||||
<< rhsExpr;
|
<< rhsExpr;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user