mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Remove redundancy in FunctionType::getSizeOnStack.
This commit is contained in:
parent
22f0a4fde1
commit
d1e05ac416
20
Types.cpp
20
Types.cpp
@ -546,7 +546,8 @@ u256 StructType::getStorageOffsetOfMember(string const& _name) const
|
|||||||
BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Storage offset of non-existing member requested."));
|
BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Storage offset of non-existing member requested."));
|
||||||
}
|
}
|
||||||
|
|
||||||
FunctionType::FunctionType(FunctionDefinition const& _function, bool _isInternal)
|
FunctionType::FunctionType(FunctionDefinition const& _function, bool _isInternal):
|
||||||
|
m_location(_isInternal ? Location::INTERNAL : Location::EXTERNAL)
|
||||||
{
|
{
|
||||||
TypePointers params;
|
TypePointers params;
|
||||||
TypePointers retParams;
|
TypePointers retParams;
|
||||||
@ -558,22 +559,6 @@ FunctionType::FunctionType(FunctionDefinition const& _function, bool _isInternal
|
|||||||
retParams.push_back(var->getType());
|
retParams.push_back(var->getType());
|
||||||
swap(params, m_parameterTypes);
|
swap(params, m_parameterTypes);
|
||||||
swap(retParams, m_returnParameterTypes);
|
swap(retParams, m_returnParameterTypes);
|
||||||
m_location = _isInternal ? Location::INTERNAL : Location::EXTERNAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
FunctionType::FunctionType(TypePointers const& _parameterTypes, TypePointers const& _returnParameterTypes,
|
|
||||||
FunctionType::Location _location, bool _gasSet, bool _valueSet):
|
|
||||||
m_parameterTypes(_parameterTypes), m_returnParameterTypes(_returnParameterTypes),
|
|
||||||
m_location(_location), m_gasSet(_gasSet), m_valueSet(_valueSet)
|
|
||||||
{
|
|
||||||
if (m_location == Location::EXTERNAL)
|
|
||||||
m_sizeOnStack = 2;
|
|
||||||
else if (m_location == Location::INTERNAL || m_location == Location::BARE)
|
|
||||||
m_sizeOnStack = 1;
|
|
||||||
if (m_gasSet)
|
|
||||||
m_sizeOnStack++;
|
|
||||||
if (m_valueSet)
|
|
||||||
m_sizeOnStack++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FunctionType::operator==(Type const& _other) const
|
bool FunctionType::operator==(Type const& _other) const
|
||||||
@ -680,7 +665,6 @@ TypePointer FunctionType::copyAndSetGasOrValue(bool _setGas, bool _setValue) con
|
|||||||
m_gasSet || _setGas, m_valueSet || _setValue);
|
m_gasSet || _setGas, m_valueSet || _setValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool MappingType::operator==(Type const& _other) const
|
bool MappingType::operator==(Type const& _other) const
|
||||||
{
|
{
|
||||||
if (_other.getCategory() != getCategory())
|
if (_other.getCategory() != getCategory())
|
||||||
|
11
Types.h
11
Types.h
@ -365,7 +365,9 @@ public:
|
|||||||
_location) {}
|
_location) {}
|
||||||
FunctionType(TypePointers const& _parameterTypes, TypePointers const& _returnParameterTypes,
|
FunctionType(TypePointers const& _parameterTypes, TypePointers const& _returnParameterTypes,
|
||||||
Location _location = Location::INTERNAL,
|
Location _location = Location::INTERNAL,
|
||||||
bool _gasSet = false, bool _valueSet = false);
|
bool _gasSet = false, bool _valueSet = false):
|
||||||
|
m_parameterTypes(_parameterTypes), m_returnParameterTypes(_returnParameterTypes),
|
||||||
|
m_location(_location), m_gasSet(_gasSet), m_valueSet(_valueSet) {}
|
||||||
|
|
||||||
TypePointers const& getParameterTypes() const { return m_parameterTypes; }
|
TypePointers const& getParameterTypes() const { return m_parameterTypes; }
|
||||||
TypePointers const& getReturnParameterTypes() const { return m_returnParameterTypes; }
|
TypePointers const& getReturnParameterTypes() const { return m_returnParameterTypes; }
|
||||||
@ -393,10 +395,9 @@ private:
|
|||||||
|
|
||||||
TypePointers m_parameterTypes;
|
TypePointers m_parameterTypes;
|
||||||
TypePointers m_returnParameterTypes;
|
TypePointers m_returnParameterTypes;
|
||||||
Location m_location;
|
Location const m_location;
|
||||||
unsigned m_sizeOnStack = 0;
|
bool const m_gasSet = false; ///< true iff the gas value to be used is on the stack
|
||||||
bool m_gasSet = false; ///< true iff the gas value to be used is on the stack
|
bool const m_valueSet = false; ///< true iff the value to be sent is on the stack
|
||||||
bool m_valueSet = false; ///< true iff the value to be sent is on the stack
|
|
||||||
mutable std::unique_ptr<MemberList> m_members;
|
mutable std::unique_ptr<MemberList> m_members;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user