claimMemory method

int claimMemory (int size, int nextOutOfLineDepth)

Implementation

int claimMemory(int size, int nextOutOfLineDepth) {
  if (nextOutOfLineDepth > _maxOutOfLineDepth) {
    throw FidlError('Exceeded maxOutOfLineDepth',
        FidlErrorCode.fidlExceededMaxOutOfLineDepth);
  }
  final int result = _nextOffset;
  _nextOffset += _align(size);
  if (_nextOffset > data.lengthInBytes) {
    throw FidlError('Cannot access out of range memory');
  }
  return result;
}