T_backward static method

TfuncTuple T_backward(
  1. Uint8List candidbytes,
  2. CandidBytes_i start_i
)

Implementation

static TfuncTuple T_backward(Uint8List candidbytes, CandidBytes_i start_i) {
    Record record_type = Record(isTypeStance: true);
    FindLeb128BytesTuple record_len_find_leb128bytes_tuple = find_leb128bytes(candidbytes, start_i);
    dynamic record_len = leb128.decodeUnsigned(record_len_find_leb128bytes_tuple.item1);
    if (record_len is int) { record_len = BigInt.from(record_len); }
    CandidBytes_i next_field_start_candidbytes_i = record_len_find_leb128bytes_tuple.item2;
    for (BigInt i=BigInt.from(0);i<record_len;i=i+BigInt.one) {
        FindLeb128BytesTuple leb128_bytes_tuple = find_leb128bytes(candidbytes, next_field_start_candidbytes_i);
        Uint8List field_id_hash_leb128_bytes = leb128_bytes_tuple.item1;
        int field_id_hash = leb128.decodeUnsigned(field_id_hash_leb128_bytes).toInt();
        for (int k in record_type.keys) {
            if (k >= field_id_hash) {
                throw Exception('key of the record is out of order');
            }
        }
        CandidBytes_i field_type_code_byte_candidbytes_i = leb128_bytes_tuple.item2;
        TfuncTuple t_func_tuple = crawl_type_table_whirlpool(candidbytes, field_type_code_byte_candidbytes_i);
        CandidType ctype = t_func_tuple.item1;
        next_field_start_candidbytes_i = t_func_tuple.item2;
        record_type[field_id_hash] = ctype;
    }
    return TfuncTuple(record_type, next_field_start_candidbytes_i);
}