readDenseArray method

  1. @override
VoltronArray readDenseArray()
override

Implementation

@override
VoltronArray readDenseArray() {
  var length = reader.getVarint();
  if (length < 0) {
    throw RangeError("readDenseArray expected length : $length");
  }
  var array = VoltronArray();
  assignId(array);
  for (var i = 0; i < length; i++) {
    var tag = readTag();
    if (tag != SerializationTag.kTheHole) {
      array.push(readValue(
          tag: tag, location: StringLocation.denseArrayItem, relatedKey: i));
    }
  }

  var read = _readJSProperties(null, SerializationTag.kEndDenseJsArray);
  var expected = reader.getVarint();
  if (read != expected) {
    throw UnsupportedError("unexpected number of properties");
  }

  var length2 = reader.getVarint();
  if (length != length2) {
    throw AssertionError("length ambiguity");
  }
  return array;
}