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

Method typeCheckERC7201Builtin

libsolidity/analysis/TypeChecker.cpp:2397–2423  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2395}
2396
2397void TypeChecker::typeCheckERC7201Builtin(FunctionCall const& _functionCall, FunctionType const* _functionType)
2398{
2399 // erc7201 builtin accepts only 1 argument. Invalid cases with different number
2400 // of arguments are treated after by function `typeCheckFunctionGeneralChecks`
2401 if (_functionCall.arguments().size() > 0)
2402 {
2403 Type const* argumentType = _functionCall.arguments()[0].get()->annotation().type;
2404 solAssert(argumentType);
2405 auto const* arrayType = dynamic_cast<ArrayType const*>(argumentType);
2406
2407 if (
2408 !dynamic_cast<StringLiteralType const*>(argumentType) &&
2409 (!arrayType || !arrayType->isString())
2410 )
2411 {
2412 std::string errorMsg = "The argument to erc7201 builtin must be a string.";
2413 if (arrayType && arrayType->isByteArray())
2414 errorMsg += " The supplied argument has type bytes.";
2415 m_errorReporter.typeError(
2416 6896_error,
2417 _functionCall.arguments()[0]->location(),
2418 errorMsg
2419 );
2420 }
2421 }
2422 typeCheckFunctionGeneralChecks(_functionCall, _functionType);
2423}
2424
2425void TypeChecker::typeCheckFunctionGeneralChecks(
2426 FunctionCall const& _functionCall,

Callers

nothing calls this directly

Calls 7

isStringMethod · 0.80
isByteArrayMethod · 0.80
typeErrorMethod · 0.80
sizeMethod · 0.45
argumentsMethod · 0.45
getMethod · 0.45
locationMethod · 0.45

Tested by

no test coverage detected