| 33 | using namespace solidity::frontend; |
| 34 | |
| 35 | bool 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 | |
| 65 | bool DeclarationTypeChecker::visit(EnumDefinition const& _enum) |
| 66 | { |
nothing calls this directly
no test coverage detected