32 lines
526 B
Plaintext
32 lines
526 B
Plaintext
|
///removeType(con)
|
||
|
/**
|
||
|
* removeType :: TypeConLink -> ()
|
||
|
*
|
||
|
* Removes a type con and all orphaned children.
|
||
|
*
|
||
|
* @param con the type con to remove
|
||
|
*/
|
||
|
|
||
|
var con = argument0;
|
||
|
|
||
|
assertInstanceof(con, TypeConLink);
|
||
|
|
||
|
var visited = ds_set_create();
|
||
|
|
||
|
repeat (ds_list_size(con.to)) {
|
||
|
var to = con.to[|0];
|
||
|
removeLink(con, to);
|
||
|
if (ds_set_empty(to.from))
|
||
|
removeType(to);
|
||
|
}
|
||
|
|
||
|
repeat (ds_set_size(con.from)) {
|
||
|
removeLink(ds_set_first(con.from), con);
|
||
|
}
|
||
|
|
||
|
if (instanceof(con, TypeCon1Link))
|
||
|
delete(con.type);
|
||
|
|
||
|
delete(con);
|
||
|
|