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

Method instantiateClass

libsolidity/experimental/ast/TypeSystem.cpp:357–371  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

355}
356
357std::optional<std::string> TypeSystem::instantiateClass(Type _instanceVariable, Arity _arity)
358{
359 if (!TypeSystemHelpers{*this}.isTypeConstant(_instanceVariable))
360 return "Invalid instance variable.";
361 auto [typeConstructor, typeArguments] = TypeSystemHelpers{*this}.destTypeConstant(_instanceVariable);
362 auto& typeConstructorInfo = m_typeConstructors.at(typeConstructor.m_index);
363 if (_arity.argumentSorts.size() != typeConstructorInfo.arguments())
364 return "Invalid arity.";
365 if (typeArguments.size() != typeConstructorInfo.arguments())
366 return "Invalid arity.";
367
368 typeConstructorInfo.arities.emplace_back(_arity);
369
370 return std::nullopt;
371}

Callers 1

visitMethod · 0.80

Calls 5

isTypeConstantMethod · 0.80
destTypeConstantMethod · 0.80
atMethod · 0.80
sizeMethod · 0.45
argumentsMethod · 0.45

Tested by

no test coverage detected