public void visit_foriter(ForIterStmt foriter_stmt) { execute(foriter_stmt.counter_definition); WavyObject iterator_obj = (WavyObject)evaluate(foriter_stmt.iterator_object); while (true) { try { // Try to get the next @iter object object value = call_func_on_obj(iterator_obj, WavyObject.at_method_names[AtMethod.ITER], new List <object>()); // Set the value of the for variable to the @iter object value this.local_scope.assign(foriter_stmt.counter_definition.name, value); } // Catch the NullIterException catch (InterruptException interrupt) { if (interrupt.obj.the_class.name == "NullIterException") { break; } } // If we still have more to go, execute the body execute(foriter_stmt.body); } }
public void visit_foriter(ForIterStmt foriter_stmt) { bool enclosing_loop = in_loop; in_loop = true; resolve(foriter_stmt.counter_definition); resolve(foriter_stmt.iterator_object); resolve(foriter_stmt.body); in_loop = enclosing_loop; }