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

Method visit

libsolidity/analysis/DeclarationTypeChecker.cpp:35–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33using namespace solidity::frontend;
34
35bool DeclarationTypeChecker::visit(ElementaryTypeName const& _typeName)
36{
37 if (_typeName.annotation().type)
38 return false;
39
40 _typeName.annotation().type = TypeProvider::fromElementaryTypeName(_typeName.typeName());
41 if (_typeName.stateMutability().has_value())
42 {
43 // for non-address types this was already caught by the parser
44 solAssert(_typeName.annotation().type->category() == Type::Category::Address, "");
45 switch (*_typeName.stateMutability())
46 {
47 case StateMutability::Payable:
48 _typeName.annotation().type = TypeProvider::payableAddress();
49 break;
50 case StateMutability::NonPayable:
51 _typeName.annotation().type = TypeProvider::address();
52 break;
53 default:
54 m_errorReporter.typeError(
55 2311_error,
56 _typeName.location(),
57 "Address types can only be payable or non-payable."
58 );
59 break;
60 }
61 }
62 return true;
63}
64
65bool DeclarationTypeChecker::visit(EnumDefinition const& _enum)
66{

Callers

nothing calls this directly

Calls 15

addressClass · 0.85
functionFunction · 0.85
typeErrorMethod · 0.80
declarationErrorMethod · 0.80
insertMethod · 0.80
eraseMethod · 0.80
fatalDeclarationErrorMethod · 0.80
finalBaseTypeMethod · 0.80
structDefinitionMethod · 0.80
fatalTypeErrorMethod · 0.80
usesBracesMethod · 0.80
isFreeMethod · 0.80

Tested by

no test coverage detected