| 661 | } |
| 662 | |
| 663 | void ArrayUtils::retrieveLength(ArrayType const& _arrayType, unsigned _stackDepth) const |
| 664 | { |
| 665 | if (!_arrayType.isDynamicallySized()) |
| 666 | m_context << _arrayType.length(); |
| 667 | else |
| 668 | { |
| 669 | m_context << dupInstruction(1 + _stackDepth); |
| 670 | switch (_arrayType.location()) |
| 671 | { |
| 672 | case DataLocation::CallData: |
| 673 | // length is stored on the stack |
| 674 | break; |
| 675 | case DataLocation::Memory: |
| 676 | m_context << Instruction::MLOAD; |
| 677 | break; |
| 678 | case DataLocation::Storage: |
| 679 | m_context << Instruction::SLOAD; |
| 680 | if (_arrayType.isByteArrayOrString()) |
| 681 | m_context.callYulFunction(m_context.utilFunctions().extractByteArrayLengthFunction(), 1, 1); |
| 682 | break; |
| 683 | case DataLocation::Transient: |
| 684 | solUnimplemented("Transient data location is only supported for value types."); |
| 685 | break; |
| 686 | } |
| 687 | } |
| 688 | } |
| 689 | |
| 690 | void ArrayUtils::accessIndex(ArrayType const& _arrayType, bool _doBoundsCheck, bool _keepReference) const |
| 691 | { |
no test coverage detected