| 834 | } |
| 835 | |
| 836 | std::set<VariableDeclaration::Location> VariableDeclaration::allowedDataLocations() const |
| 837 | { |
| 838 | using Location = VariableDeclaration::Location; |
| 839 | |
| 840 | if (isStateVariable()) |
| 841 | return std::set<Location>{Location::Unspecified, Location::Transient}; |
| 842 | else if (!hasReferenceOrMappingType() || isEventOrErrorParameter()) |
| 843 | return std::set<Location>{ Location::Unspecified }; |
| 844 | else if (isCallableOrCatchParameter()) |
| 845 | { |
| 846 | std::set<Location> locations{ Location::Memory }; |
| 847 | if ( |
| 848 | isConstructorParameter() || |
| 849 | isInternalCallableParameter() || |
| 850 | isLibraryFunctionParameter() |
| 851 | ) |
| 852 | locations.insert(Location::Storage); |
| 853 | if (!isTryCatchParameter() && !isConstructorParameter()) |
| 854 | locations.insert(Location::CallData); |
| 855 | |
| 856 | return locations; |
| 857 | } |
| 858 | else if (isLocalVariable()) |
| 859 | // Further restrictions will be imposed later on. |
| 860 | return std::set<Location>{ Location::Memory, Location::Storage, Location::CallData }; |
| 861 | else |
| 862 | // Struct members etc. |
| 863 | return std::set<Location>{ Location::Unspecified }; |
| 864 | } |
| 865 | |
| 866 | std::string VariableDeclaration::externalIdentifierHex() const |
| 867 | { |