+ if(kind==FUNCTION)
+ {
+ if(function_insert_point==block.body.end())
+ function_insert_point = i;
+
+ if(needed_funcs.empty())
+ {
+ ordered_funcs.insert(i->get());
+ if(i!=function_insert_point)
+ {
+ block.body.insert(function_insert_point, *i);
+ moved = true;
+ }
+ else
+ ++function_insert_point;
+ ordered_any_funcs = true;
+ }
+ else
+ ++unordered_func_count;
+ }
+