Term* loop_find_done_call(Block* block) { for (int i=0; i < block->length(); i++) { Term* term = block->get(i); Value* methodName = term->getProp(s_method_name); if (methodName && string_equals(methodName, "done")) return term; } return NULL; }
Term* loop_find_iterator_advance(Block* block) { Term* iterator = loop_find_iterator(block); for (int i=0; i < block->length(); i++) { Term* term = block->get(i); if (term->input(0) != iterator) continue; Value* methodName = term->getProp(s_method_name); if (methodName && string_equals(methodName, "advance")) return term; } return NULL; }