MCPcopy Create free account
hub / github.com/argotorg/solidity / FunctionType

Method FunctionType

libsolidity/ast/Types.cpp:2832–2866  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2830}
2831
2832FunctionType::FunctionType(FunctionDefinition const& _function, Kind _kind):
2833 m_kind(_kind),
2834 m_stateMutability(_function.stateMutability()),
2835 m_declaration(&_function)
2836{
2837 solAssert(
2838 _kind == Kind::Internal || _kind == Kind::External || _kind == Kind::Declaration,
2839 "Only internal or external function types or function declaration types can be created from function definitions."
2840 );
2841 if (_kind == Kind::Internal && m_stateMutability == StateMutability::Payable)
2842 m_stateMutability = StateMutability::NonPayable;
2843
2844 for (ASTPointer<VariableDeclaration> const& var: _function.parameters())
2845 {
2846 solAssert(var->annotation().type, "Parameter type is not yet available in the AST.");
2847 m_parameterNames.push_back(var->name());
2848 m_parameterTypes.push_back(var->annotation().type);
2849 }
2850 for (ASTPointer<VariableDeclaration> const& var: _function.returnParameters())
2851 {
2852 solAssert(var->annotation().type, "Return parameter type is not yet available in the AST.");
2853 m_returnParameterNames.push_back(var->name());
2854 m_returnParameterTypes.push_back(var->annotation().type);
2855 }
2856
2857 solAssert(
2858 m_parameterNames.size() == m_parameterTypes.size(),
2859 "Parameter names list must match parameter types list!"
2860 );
2861
2862 solAssert(
2863 m_returnParameterNames.size() == m_returnParameterTypes.size(),
2864 "Return parameter names list must match return parameter types list!"
2865 );
2866}
2867
2868FunctionType::FunctionType(VariableDeclaration const& _varDecl):
2869 m_kind(Kind::External),

Callers

nothing calls this directly

Calls 14

parametersMethod · 0.80
valueTypeMethod · 0.80
isByteArrayOrStringMethod · 0.80
parameterTypesMethod · 0.80
stateMutabilityMethod · 0.45
nameMethod · 0.45
sizeMethod · 0.45
keyTypeMethod · 0.45
keyNameMethod · 0.45
valueNameMethod · 0.45
baseTypeMethod · 0.45
categoryMethod · 0.45

Tested by

no test coverage detected