• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# CSharp.AnonymousMethodStorey类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: MutateHoistedGenericType

		public override void MutateHoistedGenericType (AnonymousMethodStorey storey)
		{
			foreach (Argument a in arguments)
				a.Expr.MutateHoistedGenericType (storey);

			mg.MutateHoistedGenericType (storey);
		}
开发者ID:lewurm,项目名称:benchmarker,代码行数:7,代码来源:expression.cs


示例2: MutateHoistedGenericType

		public override void MutateHoistedGenericType (AnonymousMethodStorey storey)
		{
			expr.MutateHoistedGenericType (storey);
		}
开发者ID:lewurm,项目名称:benchmarker,代码行数:4,代码来源:ecore.cs


示例3: HoistedLocalVariable

		public HoistedLocalVariable (AnonymousMethodStorey storey, LocalVariable local, string name)
			: base (storey, name, local.Type)
		{
		}
开发者ID:rabink,项目名称:mono,代码行数:4,代码来源:anonymous.cs


示例4: HoistedVariable

		protected HoistedVariable (AnonymousMethodStorey storey, Field field)
		{
			this.storey = storey;
			this.field = field;
		}
开发者ID:rabink,项目名称:mono,代码行数:5,代码来源:anonymous.cs


示例5: GetReferencedStoreyField

		//
		// Returns a field which holds referenced storey instance
		//
		Field GetReferencedStoreyField (AnonymousMethodStorey storey)
		{
			if (used_parent_storeys == null)
				return null;

			foreach (StoreyFieldPair sf in used_parent_storeys) {
				if (sf.Storey == storey)
					return sf.Field;
			}

			return null;
		}
开发者ID:rabink,项目名称:mono,代码行数:15,代码来源:anonymous.cs


示例6: AddParentStoreyReference

		public void AddParentStoreyReference (EmitContext ec, AnonymousMethodStorey storey)
		{
			CheckMembersDefined ();

			if (used_parent_storeys == null)
				used_parent_storeys = new List<StoreyFieldPair> ();
			else if (used_parent_storeys.Exists (i => i.Storey == storey))
				return;

			TypeExpr type_expr = storey.CreateStoreyTypeExpression (ec);
			Field f = AddCompilerGeneratedField ("<>f__ref$" + storey.ID, type_expr);
			used_parent_storeys.Add (new StoreyFieldPair (storey, f));
		}
开发者ID:rabink,项目名称:mono,代码行数:13,代码来源:anonymous.cs


示例7: AddCapturedThisField

		public void AddCapturedThisField (EmitContext ec, AnonymousMethodStorey parent)
		{
			TypeExpr type_expr = new TypeExpression (ec.CurrentType, Location);
			Field f = AddCompilerGeneratedField ("$this", type_expr);
			hoisted_this = new HoistedThis (this, f);

			initialize_hoisted_this = true;
			hoisted_this_parent = parent;
		}
开发者ID:erik-kallen,项目名称:NRefactory,代码行数:9,代码来源:anonymous.cs


示例8: ThisInitializer

			public ThisInitializer (HoistedThis hoisted_this, AnonymousMethodStorey parent)
			{
				this.hoisted_this = hoisted_this;
				this.parent = parent;
			}
开发者ID:erik-kallen,项目名称:NRefactory,代码行数:5,代码来源:anonymous.cs


示例9: CreateAnonymousMethodStorey

		//
		// Creates anonymous method storey in current block
		//
		public AnonymousMethodStorey CreateAnonymousMethodStorey (ResolveContext ec)
		{
			//
			// When referencing a variable in iterator storey from children anonymous method
			//
			if (Toplevel.am_storey is IteratorStorey) {
				return Toplevel.am_storey;
			}

			//
			// An iterator has only 1 storey block
			//
			if (ec.CurrentIterator != null)
			    return ec.CurrentIterator.Storey;

			if (am_storey == null) {
				MemberBase mc = ec.MemberContext as MemberBase;
				GenericMethod gm = mc == null ? null : mc.GenericMethod;

				//
				// Creates anonymous method storey for this block
				//
				am_storey = new AnonymousMethodStorey (this, ec.CurrentMemberDefinition.Parent.PartialContainer, mc, gm, "AnonStorey");
			}

			return am_storey;
		}
开发者ID:tgiphil,项目名称:mono,代码行数:30,代码来源:statement.cs


示例10: AnonymousMethodMethod

			public AnonymousMethodMethod (TypeDefinition parent, AnonymousExpression am, AnonymousMethodStorey storey,
							  TypeExpr return_type,
							  Modifiers mod, MemberName name,
							  ParametersCompiled parameters)
				: base (parent, return_type, mod | Modifiers.COMPILER_GENERATED,
						name, parameters, null)
			{
				this.AnonymousMethod = am;
				this.Storey = storey;

				Parent.PartialContainer.Members.Add (this);
				Block = new ToplevelBlock (am.block, parameters);
			}
开发者ID:rabink,项目名称:mono,代码行数:13,代码来源:anonymous.cs


示例11: CreateAnonymousMethodStorey

		//
		// Creates anonymous method storey in current block
		//
		public AnonymousMethodStorey CreateAnonymousMethodStorey (ResolveContext ec)
		{
			//
			// An iterator has only 1 storey block
			//
			if (ec.CurrentIterator != null)
			    return ec.CurrentIterator.Storey;

			//
			// When referencing a variable in iterator storey from children anonymous method
			//
			if (ParametersBlock.am_storey is IteratorStorey) {
				return ParametersBlock.am_storey;
			}

			if (am_storey == null) {
				MemberBase mc = ec.MemberContext as MemberBase;

				//
				// Creates anonymous method storey for this block
				//
				am_storey = new AnonymousMethodStorey (this, ec.CurrentMemberDefinition.Parent.PartialContainer, mc, ec.CurrentTypeParameters, "AnonStorey");
			}

			return am_storey;
		}
开发者ID:alisci01,项目名称:mono,代码行数:29,代码来源:statement.cs


示例12: StoreyFieldPair

			public StoreyFieldPair (AnonymousMethodStorey storey, Field field)
			{
				this.Storey = storey;
				this.Field = field;
			}
开发者ID:rabink,项目名称:mono,代码行数:5,代码来源:anonymous.cs


示例13: HoistedLocalVariable

		public HoistedLocalVariable (AnonymousMethodStorey scope, LocalInfo local, string name)
			: base (scope, name, local.VariableType)
		{
			this.name = local.Name;
		}
开发者ID:pgoron,项目名称:monodevelop,代码行数:5,代码来源:anonymous.cs


示例14: SetNestedStoryParent

		public void SetNestedStoryParent (AnonymousMethodStorey parentStorey)
		{
			Parent = parentStorey;
			spec.IsGeneric = false;
			spec.DeclaringType = parentStorey.CurrentType;
			MemberName.TypeParameters = null;
		}
开发者ID:rabink,项目名称:mono,代码行数:7,代码来源:anonymous.cs


示例15: AnonymousMethodMethod

			public AnonymousMethodMethod (DeclSpace parent, AnonymousExpression am, AnonymousMethodStorey storey,
							  GenericMethod generic, TypeExpr return_type,
							  Modifiers mod, string real_name, MemberName name,
							  ParametersCompiled parameters)
				: base (parent, generic, return_type, mod | Modifiers.COMPILER_GENERATED,
						name, parameters, null)
			{
				this.AnonymousMethod = am;
				this.Storey = storey;
				this.RealName = real_name;

				Parent.PartialContainer.AddMethod (this);
				Block = new ToplevelBlock (am.block, parameters);
			}
开发者ID:nzaugg,项目名称:mono,代码行数:14,代码来源:anonymous.cs


示例16: HoistedParameter

		public HoistedParameter (AnonymousMethodStorey scope, ParameterReference par)
			: base (scope, par.Name, par.Type)
		{
			this.parameter = par;
		}
开发者ID:rabink,项目名称:mono,代码行数:5,代码来源:anonymous.cs


示例17: HoistedLocalVariable

		//
		// For compiler generated local variables
		//
		public HoistedLocalVariable (AnonymousMethodStorey storey, Field field)
			: base (storey, field)
		{
		}
开发者ID:nylen,项目名称:SharpDevelop,代码行数:7,代码来源:anonymous.cs


示例18: HoistedThis

		public HoistedThis (AnonymousMethodStorey storey, Field field)
			: base (storey, field)
		{
		}
开发者ID:rabink,项目名称:mono,代码行数:4,代码来源:anonymous.cs


示例19: MutateHoistedGenericType

		public override void MutateHoistedGenericType (AnonymousMethodStorey storey)
		{
			// A constant cannot be of generic type
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:4,代码来源:constant.cs


示例20: DoCreateMethodHost

		//
		// Creates a host for the anonymous method
		//
		AnonymousMethodMethod DoCreateMethodHost (EmitContext ec)
		{
			//
			// Anonymous method body can be converted to
			//
			// 1, an instance method in current scope when only `this' is hoisted
			// 2, a static method in current scope when neither `this' nor any variable is hoisted
			// 3, an instance method in compiler generated storey when any hoisted variable exists
			//

			Modifiers modifiers;
			TypeDefinition parent = null;

			var src_block = Block.Original.Explicit;
			if (src_block.HasCapturedVariable || src_block.HasCapturedThis) {
				parent = storey = FindBestMethodStorey ();

				if (storey == null) {
					var sm = src_block.ParametersBlock.TopBlock.StateMachine;

					//
					// Remove hoisted this demand when simple instance method is enough (no hoisted variables only this)
					//
					if (src_block.HasCapturedThis && src_block.ParametersBlock.StateMachine == null) {
						src_block.ParametersBlock.TopBlock.RemoveThisReferenceFromChildrenBlock (src_block);

						//
						// Special case where parent class is used to emit instance method
						// because currect storey is of value type (async host) and we don't
						// want to create another childer storey to host this reference only
						//
						if (sm != null && sm.Kind == MemberKind.Struct)
							parent = sm.Parent.PartialContainer;
					}

					//
					// For iterators we can host everything in one class
					//
					if (sm is IteratorStorey)
						parent = storey = sm;
				}

				modifiers = storey != null ? Modifiers.INTERNAL : Modifiers.PRIVATE;
			} else {
				if (ec.CurrentAnonymousMethod != null)
					parent = storey = ec.CurrentAnonymousMethod.Storey;

				modifiers = Modifiers.STATIC | Modifiers.PRIVATE;
			}

			if (parent == null)
				parent = ec.CurrentTypeDefinition.Parent.PartialContainer;

			string name = CompilerGeneratedContainer.MakeName (parent != storey ? block_name : null,
				"m", null, ec.Module.CounterAnonymousMethods++);

			MemberName member_name;
			if (storey == null && ec.CurrentTypeParameters != null) {

				var hoisted_tparams = ec.CurrentTypeParameters;
				var type_params = new TypeParameters (hoisted_tparams.Count);
				for (int i = 0; i < hoisted_tparams.Count; ++i) {
				    type_params.Add (hoisted_tparams[i].CreateHoistedCopy (null));
				}

				member_name = new MemberName (name, type_params, Location);
			} else {
				member_name = new MemberName (name, Location);
			}

			return new AnonymousMethodMethod (parent,
				this, storey, new TypeExpression (ReturnType, Location), modifiers,
				member_name, parameters);
		}
开发者ID:rabink,项目名称:mono,代码行数:77,代码来源:anonymous.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CSharp.AnonymousTypeClass类代码示例发布时间:2022-05-26
下一篇:
C# CSharp.AnonymousMethodExpression类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap