| 787 | } |
| 788 | |
| 789 | void ArrayUtils::accessCallDataArrayElement(ArrayType const& _arrayType, bool _doBoundsCheck) const |
| 790 | { |
| 791 | solAssert(_arrayType.location() == DataLocation::CallData, ""); |
| 792 | if (_arrayType.baseType()->isDynamicallyEncoded()) |
| 793 | { |
| 794 | // stack layout: <base_ref> <length> <index> |
| 795 | ArrayUtils(m_context).accessIndex(_arrayType, _doBoundsCheck, true); |
| 796 | // stack layout: <base_ref> <ptr_to_tail> |
| 797 | |
| 798 | CompilerUtils(m_context).accessCalldataTail(*_arrayType.baseType()); |
| 799 | // stack layout: <tail_ref> [length] |
| 800 | } |
| 801 | else |
| 802 | { |
| 803 | ArrayUtils(m_context).accessIndex(_arrayType, _doBoundsCheck); |
| 804 | if (_arrayType.baseType()->isValueType()) |
| 805 | { |
| 806 | solAssert(_arrayType.baseType()->storageBytes() <= 32, ""); |
| 807 | if ( |
| 808 | !_arrayType.isByteArrayOrString() && |
| 809 | _arrayType.baseType()->storageBytes() < 32 && |
| 810 | m_context.useABICoderV2() |
| 811 | ) |
| 812 | { |
| 813 | m_context << u256(32); |
| 814 | CompilerUtils(m_context).abiDecodeV2({_arrayType.baseType()}, false); |
| 815 | } |
| 816 | else |
| 817 | CompilerUtils(m_context).loadFromMemoryDynamic( |
| 818 | *_arrayType.baseType(), |
| 819 | true, |
| 820 | !_arrayType.isByteArrayOrString(), |
| 821 | false |
| 822 | ); |
| 823 | } |
| 824 | else |
| 825 | solAssert( |
| 826 | _arrayType.baseType()->category() == Type::Category::Struct || |
| 827 | _arrayType.baseType()->category() == Type::Category::Array, |
| 828 | "Invalid statically sized non-value base type on array access." |
| 829 | ); |
| 830 | } |
| 831 | } |
| 832 | |
| 833 | void ArrayUtils::incrementByteOffset(unsigned _byteSize, unsigned _byteOffsetPosition, unsigned _storageOffsetPosition) const |
| 834 | { |
no test coverage detected