def build_set(context, builder, set_type, items):
 nitems = len(items)
 inst = SetInstance.allocate(context, builder, set_type, nitems)
 array = cgutils.pack_array(builder, items)
 array_ptr = cgutils.alloca_once_value(builder, array)
 count = context.get_constant(types.intp, nitems)
 with cgutils.for_range(builder, count) as loop:
  item = builder.load(cgutils.gep(builder, array_ptr, 0, loop.index))
  inst.add(item)
 return impl_ret_new_ref(context, builder, set_type, inst.value)

def build_set ( context , builder , set_type , items ) : nitems = len ( items ) inst = SetInstance . allocate ( context , builder , set_type , nitems ) array = cgutils . pack_array ( builder , items ) array_ptr = cgutils . alloca_once_value ( builder , array ) count = context . get_constant ( types . intp , nitems ) with cgutils . for_range ( builder , count ) as loop : item = builder . load ( cgutils . gep ( builder , array_ptr , 0 , loop . index ) ) inst . add ( item ) return impl_ret_new_ref ( context , builder , set_type , inst . value )
build a set of the given type .