当前位置: 首页>>代码示例>>C#>>正文


C# CSharp.Iterator类代码示例

本文整理汇总了C#中Mono.CSharp.Iterator的典型用法代码示例。如果您正苦于以下问题:C# Iterator类的具体用法?C# Iterator怎么用?C# Iterator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Iterator类属于Mono.CSharp命名空间,在下文中一共展示了Iterator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Resolve

		public override bool Resolve (BlockContext ec)
		{
			expr = expr.Resolve (ec);
			if (expr == null)
				return false;

			Report.Debug (64, "RESOLVE YIELD #1", this, ec, expr, expr.GetType (),
				      ec.CurrentAnonymousMethod, ec.CurrentIterator);

			if (!CheckContext (ec, loc))
				return false;

			iterator = ec.CurrentIterator;
			if (expr.Type != iterator.OriginalIteratorType) {
				expr = Convert.ImplicitConversionRequired (
					ec, expr, iterator.OriginalIteratorType, loc);
				if (expr == null)
					return false;
			}

			if (!ec.CurrentBranching.CurrentUsageVector.IsUnreachable)
				unwind_protect = ec.CurrentBranching.AddResumePoint (this, loc, out resume_pc);

			return true;
		}
开发者ID:Tak,项目名称:monodevelop-novell,代码行数:25,代码来源:iterators.cs

示例2: StartFlowBranching

		public FlowBranchingIterator StartFlowBranching (Iterator iterator, FlowBranching parent)
		{
			FlowBranchingIterator branching = new FlowBranchingIterator (parent, iterator);
			current_flow_branching = branching;
			return branching;
		}
开发者ID:KAW0,项目名称:Alter-Native,代码行数:6,代码来源:context.cs

示例3: DisposeMethodStatement

 public DisposeMethodStatement(Iterator iterator)
 {
     this.iterator = iterator;
     this.loc = iterator.Location;
 }
开发者ID:speier,项目名称:shake,代码行数:5,代码来源:iterators.cs

示例4: IteratorStorey

        public IteratorStorey(Iterator iterator)
            : base(iterator.Container.Toplevel, iterator.Host,
			  iterator.OriginalMethod as MemberBase, iterator.GenericMethod, "Iterator")
        {
            this.Iterator = iterator;
        }
开发者ID:speier,项目名称:shake,代码行数:6,代码来源:iterators.cs

示例5: IteratorStatement

 public IteratorStatement(Iterator iterator, Block original_block)
 {
     this.iterator = iterator;
     this.original_block = original_block;
     this.loc = iterator.Location;
 }
开发者ID:speier,项目名称:shake,代码行数:6,代码来源:iterators.cs

示例6: DoResolve

 protected override bool DoResolve(BlockContext ec)
 {
     iterator = ec.CurrentIterator;
     return Yield.CheckContext (ec, loc);
 }
开发者ID:speier,项目名称:shake,代码行数:5,代码来源:iterators.cs

示例7: FlowBranchingIterator

		public FlowBranchingIterator (FlowBranching parent, Iterator iterator)
			: base (parent, BranchingType.Iterator, SiblingType.Block, iterator.Block, iterator.Location)
		{
			this.iterator = iterator;
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:5,代码来源:flowanalysis.cs

示例8: EmitForDispose

		public override void EmitForDispose (EmitContext ec, Iterator iterator, Label end, bool have_dispatcher)
		{
			if (emitted_dispose)
				return;

			emitted_dispose = true;

			Label end_of_try = ec.DefineLabel ();

			// Ensure that the only way we can get into this code is through a dispatcher
			if (have_dispatcher)
				ec.Emit (OpCodes.Br, end);

			ec.BeginExceptionBlock ();

			ec.MarkLabel (dispose_try_block);

			Label [] labels = null;
			for (int i = 0; i < resume_points.Count; ++i) {
				ResumableStatement s = (ResumableStatement) resume_points [i];
				Label ret = s.PrepareForDispose (ec, end_of_try);
				if (ret.Equals (end_of_try) && labels == null)
					continue;
				if (labels == null) {
					labels = new Label [resume_points.Count];
					for (int j = 0; j < i; ++j)
						labels [j] = end_of_try;
				}
				labels [i] = ret;
			}

			if (labels != null) {
				int j;
				for (j = 1; j < labels.Length; ++j)
					if (!labels [0].Equals (labels [j]))
						break;
				bool emit_dispatcher = j < labels.Length;

				if (emit_dispatcher) {
					//SymbolWriter.StartIteratorDispatcher (ec.ig);
					ec.Emit (OpCodes.Ldloc, iterator.CurrentPC);
					ec.EmitInt (first_resume_pc);
					ec.Emit (OpCodes.Sub);
					ec.Emit (OpCodes.Switch, labels);
					//SymbolWriter.EndIteratorDispatcher (ec.ig);
				}

				foreach (ResumableStatement s in resume_points)
					s.EmitForDispose (ec, iterator, end_of_try, emit_dispatcher);
			}

			ec.MarkLabel (end_of_try);

			ec.BeginFinallyBlock ();

			EmitFinallyBody (ec);

			ec.EndExceptionBlock ();
		}
开发者ID:alisci01,项目名称:mono,代码行数:59,代码来源:statement.cs

示例9: Resolve

		public override bool Resolve (BlockContext ec)
		{
			// System.Reflection.Emit automatically emits a 'leave' at the end of a try clause
			// So, ensure there's some IL code after this statement.
			if (!code_follows && resume_points == null && ec.CurrentBranching.CurrentUsageVector.IsUnreachable)
				ec.NeedReturnLabel ();

			iter = ec.CurrentIterator;
			return true;
		}
开发者ID:alisci01,项目名称:mono,代码行数:10,代码来源:statement.cs

示例10: WrapIntoIterator

		public void WrapIntoIterator (IMethodData method, TypeContainer host, TypeSpec iterator_type, bool is_enumerable)
		{
			ParametersBlock pb = new ParametersBlock (this, ParametersCompiled.EmptyReadOnlyParameters, StartLocation);
			pb.EndLocation = EndLocation;
			pb.statements = statements;

			var iterator = new Iterator (pb, method, host, iterator_type, is_enumerable);
			am_storey = new IteratorStorey (iterator);

			statements = new List<Statement> (1);
			AddStatement (new Return (iterator, iterator.Location));
		}
开发者ID:alisci01,项目名称:mono,代码行数:12,代码来源:statement.cs

示例11: ChangeToIterator

		//
		// Reformats this block to be top-level iterator block
		//
		public IteratorStorey ChangeToIterator (Iterator iterator, ToplevelBlock source)
		{
			IsIterator = true;

			// Creates block with original statements
			AddStatement (new IteratorStatement (iterator, new Block (this, source)));

			source.statements = new List<Statement> (1);
			source.AddStatement (new Return (iterator, iterator.Location));
			source.IsIterator = false;

			IteratorStorey iterator_storey = new IteratorStorey (iterator);
			source.am_storey = iterator_storey;
			return iterator_storey;
		}
开发者ID:tgiphil,项目名称:mono,代码行数:18,代码来源:statement.cs

示例12: MoveNextMethodStatement

			public MoveNextMethodStatement (Iterator iterator)
			{
				this.iterator = iterator;
				this.loc = iterator.Location;
			}
开发者ID:Tak,项目名称:monodevelop-novell,代码行数:5,代码来源:iterators.cs

示例13: IteratorStorey

		public IteratorStorey (Iterator iterator)
			: base (iterator.Container.ParametersBlock, iterator.Host,
			  iterator.OriginalMethod as MemberBase, iterator.GenericMethod == null ? null : iterator.GenericMethod.CurrentTypeParameters, "Iterator")
		{
			this.Iterator = iterator;
		}
开发者ID:Tak,项目名称:monodevelop-novell,代码行数:6,代码来源:iterators.cs

示例14: CreateIterator

		public static void CreateIterator (IMethodData method, TypeContainer parent, int modifiers, CompilerContext ctx)
		{
			bool is_enumerable;
			Type iterator_type;

			Type ret = method.ReturnType;
			if (ret == null)
				return;

			if (!CheckType (ret, out iterator_type, out is_enumerable)) {
				ctx.Report.Error (1624, method.Location,
					      "The body of `{0}' cannot be an iterator block " +
					      "because `{1}' is not an iterator interface type",
					      method.GetSignatureForError (),
					      TypeManager.CSharpName (ret));
				return;
			}

			ParametersCompiled parameters = method.ParameterInfo;
			for (int i = 0; i < parameters.Count; i++) {
				Parameter p = parameters [i];
				Parameter.Modifier mod = p.ModFlags;
				if ((mod & Parameter.Modifier.ISBYREF) != 0) {
					ctx.Report.Error (1623, p.Location,
						"Iterators cannot have ref or out parameters");
					return;
				}

				if (p is ArglistParameter) {
					ctx.Report.Error (1636, method.Location,
						"__arglist is not allowed in parameter list of iterators");
					return;
				}

				if (parameters.Types [i].IsPointer) {
					ctx.Report.Error (1637, p.Location,
							  "Iterators cannot have unsafe parameters or " +
							  "yield types");
					return;
				}
			}

			if ((modifiers & Modifiers.UNSAFE) != 0) {
				ctx.Report.Error (1629, method.Location, "Unsafe code may not appear in iterators");
				return;
			}

			Iterator iter = new Iterator (ctx, method, parent, iterator_type, is_enumerable);
			iter.Storey.DefineType ();
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:50,代码来源:iterators.cs

示例15: StartFlowBranching

		public FlowBranchingIterator StartFlowBranching (Iterator iterator)
		{
			FlowBranchingIterator branching = new FlowBranchingIterator (CurrentBranching, iterator);
			current_flow_branching = branching;
			return branching;
		}
开发者ID:ikvm,项目名称:mono,代码行数:6,代码来源:context.cs


注:本文中的Mono.CSharp.Iterator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。