2 // iterators.cs: Support for implementing iterators
5 // Miguel de Icaza (miguel@ximian.com)
7 // (C) 2003 Ximian, Inc.
10 // Flow analysis for Yield.
11 // Emit calls to base object constructor.
14 // Current should be defined to return T, and IEnumerator.Current returns object
18 using System.Collections;
19 using System.Reflection;
20 using System.Reflection.Emit;
22 namespace Mono.CSharp {
24 public interface IIteratorContainer {
27 // Invoked if a yield statement is found in the body
32 public class Yield : Statement {
34 ArrayList finally_blocks;
37 public Yield (Expression expr, Location l)
43 public static bool CheckContext (EmitContext ec, Location loc)
46 Report.Error (1625, loc, "Cannot yield in the body of a " +
52 Report.Error (1629, loc, "Unsafe code may not appear in iterators");
56 Report.Error (1631, loc, "Cannot yield a value in the body of a catch clause");
60 AnonymousContainer am = ec.CurrentAnonymousMethod;
61 if ((am != null) && !am.IsIterator){
62 Report.Error (1621, loc, "The yield statement cannot be used inside anonymous method blocks");
66 if (ec.CurrentBranching.InTryWithCatch ()) {
67 Report.Error (1626, loc, "Cannot yield a value in the body of a " +
68 "try block with a catch clause");
74 public override bool Resolve (EmitContext ec)
76 expr = expr.Resolve (ec);
82 if (!CheckContext (ec, loc))
85 Iterator iterator = ec.CurrentIterator;
87 if (expr.Type != iterator.IteratorType){
88 expr = Convert.ImplicitConversionRequired (
89 ec, expr, iterator.IteratorType, loc);
94 ec.CurrentBranching.StealFinallyClauses (ref finally_blocks);
98 protected override void DoEmit (EmitContext ec)
100 ec.CurrentIterator.MarkYield (ec, expr, finally_blocks);
104 public class YieldBreak : Statement {
106 public YieldBreak (Location l)
111 public override bool Resolve (EmitContext ec)
113 if (!Yield.CheckContext (ec, loc))
116 ec.CurrentBranching.CurrentUsageVector.Goto ();
120 protected override void DoEmit (EmitContext ec)
122 ec.CurrentIterator.EmitYieldBreak (ec.ig);
126 public class Iterator : Class {
127 protected ToplevelBlock original_block;
128 protected ToplevelBlock block;
131 TypeExpr iterator_type_expr;
133 public readonly bool IsStatic;
138 // The state as we generate the iterator
140 Label move_next_ok, move_next_error;
141 ArrayList resume_points = new ArrayList ();
145 // Context from the original method
147 TypeContainer container;
148 TypeExpr current_type;
150 InternalParameters parameters;
151 IMethodData orig_method;
153 MoveNextMethod move_next_method;
157 protected enum State {
163 static int proxy_count;
165 public void EmitYieldBreak (ILGenerator ig)
167 ig.Emit (OpCodes.Ldarg_0);
168 IntConstant.EmitInt (ig, (int) State.After);
169 ig.Emit (OpCodes.Stfld, pc_field.FieldBuilder);
170 ig.Emit (OpCodes.Br, move_next_error);
173 public void EmitMoveNext (EmitContext ec)
175 ILGenerator ig = ec.ig;
177 move_next_ok = ig.DefineLabel ();
178 move_next_error = ig.DefineLabel ();
180 LocalBuilder retval = ec.GetTemporaryLocal (TypeManager.int32_type);
182 ig.BeginExceptionBlock ();
184 Label dispatcher = ig.DefineLabel ();
185 ig.Emit (OpCodes.Br, dispatcher);
187 ResumePoint entry_point = new ResumePoint (null);
188 resume_points.Add (entry_point);
189 entry_point.Define (ig);
191 ec.EmitTopBlock (orig_method, original_block, parameters);
195 ig.MarkLabel (dispatcher);
197 Label [] labels = new Label [resume_points.Count];
198 for (int i = 0; i < labels.Length; i++)
199 labels [i] = ((ResumePoint) resume_points [i]).Label;
201 ig.Emit (OpCodes.Ldarg_0);
202 ig.Emit (OpCodes.Ldfld, pc_field.FieldBuilder);
203 ig.Emit (OpCodes.Switch, labels);
205 Label end = ig.DefineLabel ();
207 ig.MarkLabel (move_next_error);
208 ig.Emit (OpCodes.Ldc_I4_0);
209 ig.Emit (OpCodes.Stloc, retval);
210 ig.Emit (OpCodes.Leave, end);
212 ig.MarkLabel (move_next_ok);
213 ig.Emit (OpCodes.Ldc_I4_1);
214 ig.Emit (OpCodes.Stloc, retval);
215 ig.Emit (OpCodes.Leave, end);
217 ig.BeginFaultBlock ();
219 ig.Emit (OpCodes.Ldarg_0);
220 ig.Emit (OpCodes.Callvirt, dispose.MethodBuilder);
222 ig.EndExceptionBlock ();
225 ig.Emit (OpCodes.Ldloc, retval);
226 ig.Emit (OpCodes.Ret);
229 public void EmitDispose (EmitContext ec)
231 ILGenerator ig = ec.ig;
233 Label end = ig.DefineLabel ();
234 Label dispatcher = ig.DefineLabel ();
235 ig.Emit (OpCodes.Br, dispatcher);
237 Label [] labels = new Label [resume_points.Count];
238 for (int i = 0; i < labels.Length; i++) {
239 ResumePoint point = (ResumePoint) resume_points [i];
241 if (point.FinallyBlocks == null) {
246 labels [i] = ig.DefineLabel ();
247 ig.MarkLabel (labels [i]);
249 ig.BeginExceptionBlock ();
250 ig.BeginFinallyBlock ();
252 foreach (ExceptionStatement stmt in point.FinallyBlocks) {
254 stmt.EmitFinally (ec);
257 ig.EndExceptionBlock ();
258 ig.Emit (OpCodes.Br, end);
261 ig.MarkLabel (dispatcher);
262 ig.Emit (OpCodes.Ldarg_0);
263 ig.Emit (OpCodes.Ldfld, pc_field.FieldBuilder);
264 ig.Emit (OpCodes.Switch, labels);
266 ig.Emit (OpCodes.Ldarg_0);
267 IntConstant.EmitInt (ig, (int) State.After);
268 ig.Emit (OpCodes.Stfld, pc_field.FieldBuilder);
273 protected class ResumePoint
276 public readonly ExceptionStatement[] FinallyBlocks;
278 public ResumePoint (ArrayList list)
281 FinallyBlocks = new ExceptionStatement [list.Count];
282 list.CopyTo (FinallyBlocks, 0);
286 public void Define (ILGenerator ig)
288 Label = ig.DefineLabel ();
289 ig.MarkLabel (Label);
294 // Called back from Yield
296 public void MarkYield (EmitContext ec, Expression expr,
297 ArrayList finally_blocks)
299 ILGenerator ig = ec.ig;
301 // Store the new current
302 ig.Emit (OpCodes.Ldarg_0);
304 ig.Emit (OpCodes.Stfld, current_field.FieldBuilder);
308 ig.Emit (OpCodes.Ldarg_0);
309 IntConstant.EmitInt (ig, pc);
310 ig.Emit (OpCodes.Stfld, pc_field.FieldBuilder);
313 ig.Emit (OpCodes.Br, move_next_ok);
315 ResumePoint point = new ResumePoint (finally_blocks);
316 resume_points.Add (point);
320 public void MarkFinally (EmitContext ec, ArrayList finally_blocks)
322 ILGenerator ig = ec.ig;
326 ig.Emit (OpCodes.Ldarg_0);
327 IntConstant.EmitInt (ig, pc);
328 ig.Emit (OpCodes.Stfld, pc_field.FieldBuilder);
330 ResumePoint point = new ResumePoint (finally_blocks);
331 resume_points.Add (point);
335 private static MemberName MakeProxyName (string name)
337 int pos = name.LastIndexOf ('.');
339 name = name.Substring (pos + 1);
341 return new MemberName ("<" + name + ">__" + (proxy_count++));
347 public Iterator (IMethodData m_container, TypeContainer container,
348 InternalParameters parameters,
350 : base (container.NamespaceEntry, container, MakeProxyName (m_container.MethodName.Name),
351 (modifiers & Modifiers.UNSAFE) | Modifiers.PRIVATE, null, m_container.Location)
353 this.orig_method = m_container;
355 this.container = container;
356 this.parameters = parameters;
357 this.original_block = orig_method.Block;
358 this.block = new ToplevelBlock (orig_method.Block, parameters.Parameters, orig_method.Location);
360 fields = new Hashtable ();
362 IsStatic = (modifiers & Modifiers.STATIC) != 0;
365 public AnonymousContainer Host {
366 get { return move_next_method; }
369 public bool DefineIterator ()
371 ec = new EmitContext (this, Mono.CSharp.Location.Null, null, null, ModFlags);
372 ec.CurrentAnonymousMethod = move_next_method;
373 ec.CurrentIterator = this;
374 ec.InIterator = true;
377 Report.Error (1624, Location,
378 "The body of `{0}' cannot be an iterator block because `{1}' is not an iterator interface type",
379 orig_method.GetSignatureForError (), TypeManager.CSharpName (orig_method.ReturnType));
383 for (int i = 0; i < parameters.Count; i++){
384 Parameter.Modifier mod = parameters.ParameterModifier (i);
385 if ((mod & (Parameter.Modifier.REF | Parameter.Modifier.OUT)) != 0){
388 "Iterators cannot have ref or out parameters");
392 if ((mod & Parameter.Modifier.ARGLIST) != 0) {
393 Report.Error (1636, Location, "__arglist is not allowed in parameter list of iterators");
397 if (parameters.ParameterType (i).IsPointer) {
398 Report.Error (1637, Location, "Iterators cannot have unsafe parameters or yield types");
403 this_type = container.TypeBuilder;
405 ArrayList list = new ArrayList ();
407 list.Add (new TypeExpression (
408 TypeManager.ienumerable_type, Location));
409 list.Add (new TypeExpression (TypeManager.ienumerator_type, Location));
410 list.Add (new TypeExpression (TypeManager.idisposable_type, Location));
412 iterator_type_expr = new TypeExpression (iterator_type, Location);
414 container.AddIterator (this);
417 orig_method.Block = block;
421 protected override bool DoDefineMembers ()
423 ec.InIterator = true;
424 ec.CurrentIterator = this;
425 ec.CurrentAnonymousMethod = move_next_method;
426 ec.capture_context = cc;
428 if (!base.DoDefineMembers ())
434 public override bool Define ()
439 ec.InIterator = true;
440 ec.CurrentIterator = this;
441 ec.CurrentAnonymousMethod = move_next_method;
442 ec.capture_context = cc;
443 ec.TypeContainer = ec.TypeContainer.Parent;
445 ec.ContainerType = ec.TypeContainer.TypeBuilder;
447 ec.ig = move_next_method.method.MethodBuilder.GetILGenerator ();
454 if (!ec.ResolveTopBlock (null, original_block, parameters, orig_method, out unreachable))
457 if (!ec.ResolveTopBlock (null, block, parameters, orig_method, out unreachable))
460 original_block.CompleteContexts ();
462 cc.EmitAnonymousHelperClasses (ec);
468 // Returns the new block for the method, or null on failure
470 protected override bool DefineNestedTypes ()
472 current_type = new TypeExpression (TypeBuilder, Location);
482 Define_Constructor ();
485 Define_GetEnumerator ();
487 return base.DefineNestedTypes ();
494 LocalInfo current_local;
499 original_block.SetHaveAnonymousMethods (Location, move_next_method);
500 block.SetHaveAnonymousMethods (Location, move_next_method);
502 cc = original_block.CaptureContext;
504 int first = IsStatic ? 0 : 1;
506 ArrayList args = new ArrayList ();
508 Type t = container.TypeBuilder;
509 args.Add (new Argument (
510 new ThisParameterReference (t, Location)));
514 args.Add (new Argument (new BoolLiteral (false)));
516 for (int i = 0; i < parameters.Count; i++) {
517 Type t = parameters.ParameterType (i);
518 string name = parameters.ParameterName (i);
520 args.Add (new Argument (
521 new SimpleParameterReference (t, first + i, Location)));
523 cc.AddParameterToContext (move_next_method, name, t, first + i);
526 Expression new_expr = new New (
527 new TypeExpression (TypeBuilder, Location), args, Location);
529 block.AddStatement (new NoCheckReturn (new_expr, Location));
532 void Define_Fields ()
534 pc_field = new Field (
535 this, TypeManager.system_int32_expr, Modifiers.PRIVATE, "$PC",
536 null, null, Location);
539 current_field = new Field (
540 this, iterator_type_expr, Modifiers.PRIVATE, "$current",
541 null, null, Location);
542 AddField (current_field);
545 void Define_Constructor ()
547 Parameters ctor_params;
549 ArrayList list = new ArrayList ();
552 list.Add (new Parameter (
553 new TypeExpression (container.TypeBuilder, Location),
554 "this", Parameter.Modifier.NONE,
556 list.Add (new Parameter (
557 TypeManager.system_boolean_expr, "initialized",
558 Parameter.Modifier.NONE, null, Location));
560 Parameter[] old_fixed = parameters.Parameters.FixedParameters;
561 if (old_fixed != null)
562 list.AddRange (old_fixed);
564 Parameter[] fixed_params = new Parameter [list.Count];
565 list.CopyTo (fixed_params);
567 ctor_params = new Parameters (
568 fixed_params, parameters.Parameters.ArrayParameter);
570 ctor = new Constructor (
571 this, Name, Modifiers.PUBLIC, ctor_params,
572 new ConstructorBaseInitializer (
573 null, Parameters.EmptyReadOnlyParameters, Location),
575 AddConstructor (ctor);
577 ctor.Block = new ToplevelBlock (block, parameters.Parameters, Location);
579 int first = IsStatic ? 2 : 3;
581 State initial = is_enumerable ? State.Uninitialized : State.Running;
582 ctor.Block.AddStatement (new SetState (this, initial, Location));
584 ctor.Block.AddStatement (new If (
585 new SimpleParameterReference (
586 TypeManager.bool_type, first - 1, Location),
587 new SetState (this, State.Running, Location),
590 ctor.Block.AddStatement (new InitScope (this, cc, Location));
593 Statement Create_ThrowInvalidOperation ()
595 TypeExpr ex_type = new TypeExpression (
596 TypeManager.invalid_operation_exception_type, Location);
598 return new Throw (new New (ex_type, null, Location), Location);
601 Statement Create_ThrowNotSupported ()
603 TypeExpr ex_type = new TypeExpression (
604 TypeManager.not_supported_exception_type, Location);
606 return new Throw (new New (ex_type, null, Location), Location);
609 void Define_Current ()
611 ToplevelBlock get_block = new ToplevelBlock (
612 block, parameters.Parameters, Location);
613 MemberName left = new MemberName ("System.Collections.IEnumerator");
614 MemberName name = new MemberName (left, "Current");
616 get_block.AddStatement (new If (
618 Binary.Operator.LessThanOrEqual,
619 new FieldExpression (this, pc_field),
620 new IntLiteral ((int) State.Running), Location),
621 Create_ThrowInvalidOperation (),
623 new FieldExpression (this, current_field), Location),
626 Accessor getter = new Accessor (get_block, 0, null, Location);
628 Property current = new Property (
629 this, iterator_type_expr, 0,
630 false, name, null, getter, null, Location);
631 AddProperty (current);
634 void Define_MoveNext ()
636 move_next_method = new MoveNextMethod (this, Location);
638 original_block.ReParent (block, move_next_method);
640 move_next_method.CreateMethod (ec);
642 AddMethod (move_next_method.method);
645 void Define_GetEnumerator ()
647 MemberName left = new MemberName ("System.Collections.IEnumerable");
649 MemberName name = new MemberName (left, "GetEnumerator");
651 Method get_enumerator = new Method (
653 new TypeExpression (TypeManager.ienumerator_type, Location),
655 Parameters.EmptyReadOnlyParameters, null,
657 AddMethod (get_enumerator);
659 get_enumerator.Block = new ToplevelBlock (
660 block, parameters.Parameters, Location);
662 get_enumerator.Block.SetHaveAnonymousMethods (Location, move_next_method);
664 Expression ce = new MemberAccess (
665 new SimpleName ("System.Threading.Interlocked", Location),
666 "CompareExchange", Location);
668 Expression pc = new FieldExpression (this, pc_field);
669 Expression before = new IntLiteral ((int) State.Running);
670 Expression uninitialized = new IntLiteral ((int) State.Uninitialized);
672 ArrayList args = new ArrayList ();
673 args.Add (new Argument (pc, Argument.AType.Ref));
674 args.Add (new Argument (before, Argument.AType.Expression));
675 args.Add (new Argument (uninitialized, Argument.AType.Expression));
677 get_enumerator.Block.AddStatement (new If (
679 Binary.Operator.Equality,
680 new Invocation (ce, args, Location),
681 uninitialized, Location),
682 new Return (new ThisParameterReference (
683 TypeManager.ienumerator_type, Location),
687 args = new ArrayList ();
689 args.Add (new Argument (new CapturedThisReference (this, Location)));
692 args.Add (new Argument (new BoolLiteral (true)));
694 for (int i = 0; i < parameters.Count; i++) {
695 Expression cp = new CapturedParameterReference (
696 this, parameters.ParameterType (i),
697 parameters.ParameterName (i), Location);
698 args.Add (new Argument (cp));
701 Expression new_expr = new New (
702 new TypeExpression (TypeBuilder, Location), args, Location);
703 get_enumerator.Block.AddStatement (new Return (new_expr, Location));
706 protected class SimpleParameterReference : Expression
710 public SimpleParameterReference (Type type, int idx, Location loc)
715 eclass = ExprClass.Variable;
718 public override Expression DoResolve (EmitContext ec)
723 public override void Emit (EmitContext ec)
728 protected virtual void DoEmit (EmitContext ec)
730 ParameterReference.EmitLdArg (ec.ig, idx);
734 protected class ThisParameterReference : SimpleParameterReference, IMemoryLocation
736 public ThisParameterReference (Type type, Location loc)
737 : base (type, 0, loc)
740 protected override void DoEmit (EmitContext ec)
743 if (ec.TypeContainer is Struct)
744 ec.ig.Emit (OpCodes.Ldobj, type);
747 public void AddressOf (EmitContext ec, AddressOp mode)
749 if (ec.TypeContainer is Struct)
750 ec.ig.Emit (OpCodes.Ldarga, 0);
752 ec.ig.Emit (OpCodes.Ldarg, 0);
756 protected class CapturedParameterReference : Expression
761 public CapturedParameterReference (Iterator iterator, Type type,
762 string name, Location loc)
764 this.iterator = iterator;
768 eclass = ExprClass.Variable;
771 public override Expression DoResolve (EmitContext ec)
776 public override void Emit (EmitContext ec)
778 ec.CurrentAnonymousMethod = iterator.move_next_method;
780 iterator.cc.EmitParameter (ec, name);
784 protected class CapturedThisReference : Expression
786 public CapturedThisReference (Iterator iterator, Location loc)
789 this.type = iterator.this_type;
790 eclass = ExprClass.Variable;
793 public override Expression DoResolve (EmitContext ec)
798 public override void Emit (EmitContext ec)
804 protected class FieldExpression : Expression
809 public FieldExpression (Iterator iterator, Field field)
811 this.iterator = iterator;
813 this.loc = iterator.Location;
816 public override Expression DoResolveLValue (EmitContext ec, Expression right_side)
818 FieldExpr fexpr = new FieldExpr (field.FieldBuilder, loc);
819 fexpr.InstanceExpression = new ThisParameterReference (
820 iterator.this_type, loc);
821 return fexpr.ResolveLValue (ec, right_side, loc);
824 public override Expression DoResolve (EmitContext ec)
826 FieldExpr fexpr = new FieldExpr (field.FieldBuilder, loc);
827 fexpr.InstanceExpression = new ThisParameterReference (
828 iterator.this_type, loc);
829 return fexpr.Resolve (ec);
832 public override void Emit (EmitContext ec)
834 throw new InvalidOperationException ();
838 protected class MoveNextMethod : AnonymousContainer
842 public MoveNextMethod (Iterator iterator, Location loc)
843 : base (iterator.parameters.Parameters, iterator.original_block, loc)
845 this.iterator = iterator;
848 protected override bool CreateMethodHost (EmitContext ec)
850 method = new Method (
851 iterator, TypeManager.system_boolean_expr,
852 Modifiers.PUBLIC, false, new MemberName ("MoveNext"),
853 Parameters.EmptyReadOnlyParameters, null, loc);
855 method.Block = Block;
857 MoveNextStatement inline = new MoveNextStatement (iterator, loc);
858 Block.AddStatement (inline);
863 public bool CreateMethod (EmitContext ec)
865 return CreateMethodHost (ec);
868 public override bool IsIterator {
872 public override void CreateScopeType (EmitContext ec, ScopeInfo scope)
874 scope.ScopeTypeBuilder = iterator.TypeBuilder;
875 scope.ScopeConstructor = iterator.ctor.ConstructorBuilder;
878 public override void Emit (EmitContext ec)
880 throw new InternalErrorException ();
884 protected class MoveNextStatement : Statement {
887 public MoveNextStatement (Iterator iterator, Location loc)
890 this.iterator = iterator;
893 public override bool Resolve (EmitContext ec)
898 protected override void DoEmit (EmitContext ec)
900 ec.CurrentIterator = iterator;
901 ec.CurrentAnonymousMethod = iterator.move_next_method;
902 ec.InIterator = true;
904 iterator.EmitMoveNext (ec);
908 protected class DisposeMethod : Statement {
911 public DisposeMethod (Iterator iterator, Location loc)
914 this.iterator = iterator;
917 public override bool Resolve (EmitContext ec)
922 protected override void DoEmit (EmitContext ec)
924 iterator.EmitDispose (ec);
928 protected class StatementList : Statement {
929 ArrayList statements;
931 public StatementList (Location loc)
934 statements = new ArrayList ();
937 public void Add (Statement statement)
939 statements.Add (statement);
942 public override bool Resolve (EmitContext ec)
944 foreach (Statement stmt in statements) {
945 if (!stmt.Resolve (ec))
952 protected override void DoEmit (EmitContext ec)
954 foreach (Statement stmt in statements)
959 protected class SetState : Statement
964 public SetState (Iterator iterator, State state, Location loc)
966 this.iterator = iterator;
971 public override bool Resolve (EmitContext ec)
976 protected override void DoEmit (EmitContext ec)
978 ec.ig.Emit (OpCodes.Ldarg_0);
979 IntConstant.EmitInt (ec.ig, (int) state);
980 ec.ig.Emit (OpCodes.Stfld, iterator.pc_field.FieldBuilder);
984 protected class InitScope : Statement
989 public InitScope (Iterator iterator, CaptureContext cc, Location loc)
991 this.iterator = iterator;
996 public override bool Resolve (EmitContext ec)
1001 protected override void DoEmit (EmitContext ec)
1003 iterator.cc.EmitInitScope (ec);
1007 void Define_Reset ()
1009 Method reset = new Method (
1010 this, TypeManager.system_void_expr, Modifiers.PUBLIC,
1011 false, new MemberName ("Reset"),
1012 Parameters.EmptyReadOnlyParameters, null, Location);
1015 reset.Block = new ToplevelBlock (Location);
1016 reset.Block = new ToplevelBlock (block, parameters.Parameters, Location);
1017 reset.Block.SetHaveAnonymousMethods (Location, move_next_method);
1019 reset.Block.AddStatement (Create_ThrowNotSupported ());
1022 void Define_Dispose ()
1024 dispose = new Method (
1025 this, TypeManager.system_void_expr, Modifiers.PUBLIC,
1026 false, new MemberName ("Dispose"),
1027 Parameters.EmptyReadOnlyParameters, null, Location);
1028 AddMethod (dispose);
1030 dispose.Block = new ToplevelBlock (block, parameters.Parameters, Location);
1031 dispose.Block.SetHaveAnonymousMethods (Location, move_next_method);
1033 dispose.Block.AddStatement (new DisposeMethod (this, Location));
1036 public Type IteratorType {
1037 get { return iterator_type; }
1041 // This return statement tricks return into not flagging an error for being
1042 // used in a Yields method
1044 class NoCheckReturn : Statement {
1045 public Expression Expr;
1047 public NoCheckReturn (Expression expr, Location l)
1053 public override bool Resolve (EmitContext ec)
1055 Expr = Expr.Resolve (ec);
1059 FlowBranching.UsageVector vector = ec.CurrentBranching.CurrentUsageVector;
1060 ec.CurrentBranching.CurrentUsageVector.Return ();
1065 protected override void DoEmit (EmitContext ec)
1068 ec.ig.Emit (OpCodes.Ret);
1074 Type ret = orig_method.ReturnType;
1076 if (ret == TypeManager.ienumerable_type) {
1077 iterator_type = TypeManager.object_type;
1078 is_enumerable = true;
1081 if (ret == TypeManager.ienumerator_type) {
1082 iterator_type = TypeManager.object_type;
1083 is_enumerable = false;