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) {
    List<CandidType> in_types = [];
    List<CandidType> out_types = [];
    CandidBytes_i next_types_list_start_i = start_i;
    for (List<CandidType> types_list in [in_types, out_types]) {
        FindLeb128BytesTuple types_len_leb128bytes_tuple = find_leb128bytes(candidbytes, next_types_list_start_i);
        int types_len = leb128.decodeUnsigned(types_len_leb128bytes_tuple.item1).toInt();
        CandidBytes_i next_type_start_i = types_len_leb128bytes_tuple.item2;
        for (int type_i=0;type_i < types_len;type_i++) {
            TfuncTuple type_t_func_tuple = crawl_type_table_whirlpool(candidbytes, next_type_start_i);
            types_list.add(type_t_func_tuple.item1);
            next_type_start_i = type_t_func_tuple.item2;
        }
        next_types_list_start_i = next_type_start_i;
    }
    CandidBytes_i func_marks_len_leb128bytes_start_i = next_types_list_start_i;
    FindLeb128BytesTuple func_marks_len_leb128bytes_tuple = find_leb128bytes(candidbytes, func_marks_len_leb128bytes_start_i);
    int func_marks_len = leb128.decodeUnsigned(func_marks_len_leb128bytes_tuple.item1).toInt();
    CandidBytes_i next_func_mark_start_i = func_marks_len_leb128bytes_tuple.item2;
    bool isQuery = false;
    bool isOneWay = false;
    for (int func_mark_i = 0; func_mark_i < func_marks_len; func_mark_i++) {
        int func_mark_code = candidbytes[next_func_mark_start_i];
        if (func_mark_code == 1) {
            isQuery = true;
        }
        else if (func_mark_code == 2) {
            isOneWay = true;
        }
        next_func_mark_start_i = next_func_mark_start_i + 1;
    }
    FunctionReference func_fer = FunctionReference(in_types: in_types, out_types: out_types, isQuery: isQuery, isOneWay: isOneWay, isTypeStance: true);
    return TfuncTuple(func_fer, next_func_mark_start_i);
}