mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Minor fixes plus a rebase merge fix
This commit is contained in:
parent
dcd47be6ca
commit
04190798eb
5
AST.cpp
5
AST.cpp
@ -83,7 +83,6 @@ map<FixedHash<4>, FunctionTypePointer> ContractDefinition::getInterfaceFunctions
|
||||
|
||||
map<FixedHash<4>, FunctionTypePointer> exportedFunctions;
|
||||
for (auto const& it: exportedFunctionList)
|
||||
// exportedFunctions.insert(make_pair(std::get<0>(it), FunctionDescription(std::get<1>(it), std::get<2>(it))));
|
||||
exportedFunctions.insert(it);
|
||||
|
||||
solAssert(exportedFunctionList.size() == exportedFunctions.size(),
|
||||
@ -139,12 +138,12 @@ void ContractDefinition::checkIllegalOverrides() const
|
||||
}
|
||||
}
|
||||
|
||||
vector<pair<FixedHash<4>, shared_ptr<FunctionType const>>> const& ContractDefinition::getInterfaceFunctionList() const
|
||||
vector<pair<FixedHash<4>, FunctionTypePointer>> const& ContractDefinition::getInterfaceFunctionList() const
|
||||
{
|
||||
if (!m_interfaceFunctionList)
|
||||
{
|
||||
set<string> functionsSeen;
|
||||
m_interfaceFunctionList.reset(new vector<pair<FixedHash<4>, shared_ptr<FunctionType const>>>());
|
||||
m_interfaceFunctionList.reset(new vector<pair<FixedHash<4>, FunctionTypePointer>>());
|
||||
for (ContractDefinition const* contract: getLinearizedBaseContracts())
|
||||
{
|
||||
for (ASTPointer<FunctionDefinition> const& f: contract->getDefinedFunctions())
|
||||
|
31
AST.h
31
AST.h
@ -156,6 +156,37 @@ private:
|
||||
Declaration const* m_scope;
|
||||
};
|
||||
|
||||
/**
|
||||
* Abstract class that is added to each AST node that can store local variables.
|
||||
*/
|
||||
class VariableScope
|
||||
{
|
||||
public:
|
||||
void addLocalVariable(VariableDeclaration const& _localVariable) { m_localVariables.push_back(&_localVariable); }
|
||||
std::vector<VariableDeclaration const*> const& getLocalVariables() const { return m_localVariables; }
|
||||
|
||||
private:
|
||||
std::vector<VariableDeclaration const*> m_localVariables;
|
||||
};
|
||||
|
||||
/**
|
||||
* Abstract class that is added to each AST node that can receive documentation.
|
||||
*/
|
||||
class Documented
|
||||
{
|
||||
public:
|
||||
explicit Documented(ASTPointer<ASTString> const& _documentation): m_documentation(_documentation) {}
|
||||
|
||||
/// @return A shared pointer of an ASTString.
|
||||
/// Can contain a nullptr in which case indicates absence of documentation
|
||||
ASTPointer<ASTString> const& getDocumentation() const { return m_documentation; }
|
||||
|
||||
protected:
|
||||
ASTPointer<ASTString> m_documentation;
|
||||
};
|
||||
|
||||
/// @}
|
||||
|
||||
/**
|
||||
* Definition of a contract. This is the only AST nodes where child nodes are not visited in
|
||||
* document order. It first visits all struct declarations, then all variable declarations and
|
||||
|
@ -160,7 +160,7 @@ void Compiler::appendFunctionSelector(ContractDefinition const& _contract)
|
||||
|
||||
for (auto const& it: interfaceFunctions)
|
||||
{
|
||||
FunctionTypePointer functionType = it.second;
|
||||
FunctionTypePointer const& functionType = it.second;
|
||||
m_context << callDataUnpackerEntryPoints.at(it.first);
|
||||
eth::AssemblyItem returnTag = m_context.pushNewTag();
|
||||
appendCalldataUnpacker(functionType->getParameterTypes());
|
||||
|
@ -60,6 +60,7 @@ std::unique_ptr<std::string> InterfaceHandler::getABIInterface(ContractDefinitio
|
||||
return params;
|
||||
};
|
||||
|
||||
solAssert(it.second->getDeclaration(), "All function interface types should contain a declaration");
|
||||
method["name"] = it.second->getDeclaration()->getName();
|
||||
method["constant"] = it.second->isConstant();
|
||||
method["inputs"] = populateParameters(it.second->getParameterNames(),
|
||||
|
@ -591,7 +591,7 @@ u256 StructType::getStorageOffsetOfMember(string const& _name) const
|
||||
FunctionType::FunctionType(FunctionDefinition const& _function, bool _isInternal):
|
||||
m_location(_isInternal ? Location::INTERNAL : Location::EXTERNAL),
|
||||
m_isConstant(_function.isDeclaredConst()),
|
||||
m_declaration(&_function)
|
||||
m_declaration(&_function)
|
||||
{
|
||||
TypePointers params;
|
||||
vector<string> paramNames;
|
||||
@ -641,6 +641,9 @@ bool FunctionType::operator==(Type const& _other) const
|
||||
|
||||
if (m_location != other.m_location)
|
||||
return false;
|
||||
if (m_isConstant != other.isConstant())
|
||||
return false;
|
||||
|
||||
if (m_parameterTypes.size() != other.m_parameterTypes.size() ||
|
||||
m_returnParameterTypes.size() != other.m_returnParameterTypes.size())
|
||||
return false;
|
||||
@ -763,7 +766,7 @@ vector<string> const FunctionType::getReturnParameterTypeNames() const
|
||||
|
||||
ASTPointer<ASTString> FunctionType::getDocumentation() const
|
||||
{
|
||||
auto function = dynamic_cast<FunctionDefinition const*>(m_declaration);
|
||||
auto function = dynamic_cast<Documented const*>(m_declaration);
|
||||
if (function)
|
||||
return function->getDocumentation();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user