getDatatypeInfo method

DatatypeInfo getDatatypeInfo(
  1. DatatypeSort sort
)

Gets the DatatypeInfo for the given sort.

Implementation

DatatypeInfo getDatatypeInfo(DatatypeSort sort) {
  final zsort = _createSort(sort);
  final numConstructors = _z3.get_datatype_sort_num_constructors(zsort);
  final constructors = <ConstructorInfo>[];
  for (var i = 0; i < numConstructors; i++) {
    final constructor =
        _getFuncDecl(_z3.get_datatype_sort_constructor(zsort, i));
    final recognizer =
        _getFuncDecl(_z3.get_datatype_sort_recognizer(zsort, i));
    final numAccessors = _z3.get_arity(_createFuncDecl(constructor));
    final accessors = <FuncDecl>[];
    for (var j = 0; j < numAccessors; j++) {
      final accessor =
          _z3.get_datatype_sort_constructor_accessor(zsort, i, j);
      accessors.add(_getFuncDecl(accessor));
    }
    constructors.add(ConstructorInfo(
      constructor,
      recognizer,
      accessors,
    ));
  }
  return DatatypeInfo(sort, constructors);
}