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

Method tupleType

libsolidity/experimental/ast/TypeSystemHelper.cpp:119–129  ·  view source on GitHub ↗

std::optional experimental::typeClassFromTypeClassName(TypeClassName const& _typeClass) { return std::visit(util::GenericVisitor{ [&](ASTPointer _path) -> optional { auto classDefinition = dynamic_cast (_path->annotation().referencedDeclaration); if (!classDefinition) return nullopt; return TypeClass{classDefinition};

Source from the content-addressed store, hash-verified

117}
118*/
119experimental::Type TypeSystemHelpers::tupleType(std::vector<Type> _elements) const
120{
121 if (_elements.empty())
122 return typeSystem.type(PrimitiveType::Unit, {});
123 if (_elements.size() == 1)
124 return _elements.front();
125 Type result = _elements.back();
126 for (Type type: _elements | ranges::views::reverse | ranges::views::drop_exactly(1))
127 result = typeSystem.type(PrimitiveType::Pair, {type, result});
128 return result;
129}
130
131std::vector<experimental::Type> TypeSystemHelpers::destTupleType(Type _tupleType) const
132{

Callers 4

TypeInferenceMethod · 0.80
endVisitMethod · 0.80
visitMethod · 0.80
endVisitMethod · 0.80

Calls 3

emptyMethod · 0.45
typeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected