Merge pull request #8105 from ethereum/functionTypeRefactor

Add a new Function Type referring to FunctionDefinition's without calling context and use it to allow selector lookup.
This commit is contained in:
chriseth
2020-01-09 17:15:46 +01:00
committed by GitHub
18 changed files with 202 additions and 34 deletions
+4 -4
View File
@@ -199,7 +199,7 @@ vector<pair<util::FixedHash<4>, FunctionTypePointer>> const& ContractDefinition:
vector<FunctionTypePointer> functions;
for (FunctionDefinition const* f: contract->definedFunctions())
if (f->isPartOfExternalInterface())
functions.push_back(TypeProvider::function(*f, false));
functions.push_back(TypeProvider::function(*f, FunctionType::Kind::External));
for (VariableDeclaration const* v: contract->stateVariables())
if (v->isPartOfExternalInterface())
functions.push_back(TypeProvider::function(*v));
@@ -311,7 +311,7 @@ FunctionTypePointer FunctionDefinition::functionType(bool _internal) const
case Visibility::Private:
case Visibility::Internal:
case Visibility::Public:
return TypeProvider::function(*this, _internal);
return TypeProvider::function(*this, FunctionType::Kind::Internal);
case Visibility::External:
return {};
}
@@ -327,7 +327,7 @@ FunctionTypePointer FunctionDefinition::functionType(bool _internal) const
return {};
case Visibility::Public:
case Visibility::External:
return TypeProvider::function(*this, _internal);
return TypeProvider::function(*this, FunctionType::Kind::External);
}
}
@@ -338,7 +338,7 @@ FunctionTypePointer FunctionDefinition::functionType(bool _internal) const
TypePointer FunctionDefinition::type() const
{
solAssert(visibility() != Visibility::External, "");
return TypeProvider::function(*this);
return TypeProvider::function(*this, FunctionType::Kind::Internal);
}
string FunctionDefinition::externalSignature() const