當前位置: 首頁>>代碼示例>>C#>>正文


C# CSharp.HoistedThis類代碼示例

本文整理匯總了C#中Mono.CSharp.HoistedThis的典型用法代碼示例。如果您正苦於以下問題:C# HoistedThis類的具體用法?C# HoistedThis怎麽用?C# HoistedThis使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


HoistedThis類屬於Mono.CSharp命名空間,在下文中一共展示了HoistedThis類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ThisInitializer

			public ThisInitializer (HoistedThis hoisted_this)
			{
				this.hoisted_this = hoisted_this;
			}
開發者ID:rabink,項目名稱:mono,代碼行數:4,代碼來源:anonymous.cs

示例2: AddCapturedThisField

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

			initialize_hoisted_this = true;
		}
開發者ID:rabink,項目名稱:mono,代碼行數:8,代碼來源:anonymous.cs

示例3: ThisInitializer

			public ThisInitializer (HoistedThis hoisted_this, AnonymousMethodStorey parent)
			{
				this.hoisted_this = hoisted_this;
				this.parent = parent;
			}
開發者ID:erik-kallen,項目名稱:NRefactory,代碼行數:5,代碼來源:anonymous.cs

示例4: AddCapturedThisField

		public void AddCapturedThisField (EmitContext ec)
		{
			TypeExpr type_expr = new TypeExpression (ec.CurrentType, Location);
			Field f = AddCompilerGeneratedField ("<>f__this", type_expr);
			f.Define ();
			hoisted_this = new HoistedThis (this, f);

			// Inflated type instance has to be updated manually
			if (Instance.Type is InflatedTypeSpec) {
				var inflator = new TypeParameterInflator (this, Instance.Type, TypeParameterSpec.EmptyTypes, TypeSpec.EmptyTypes);
				Instance.Type.MemberCache.AddMember (f.Spec.InflateMember (inflator));

				inflator = new TypeParameterInflator (this, f.Parent.CurrentType, TypeParameterSpec.EmptyTypes, TypeSpec.EmptyTypes);
				f.Parent.CurrentType.MemberCache.AddMember (f.Spec.InflateMember (inflator));
			}
		}
開發者ID:nylen,項目名稱:SharpDevelop,代碼行數:16,代碼來源:anonymous.cs

示例5: AddCapturedThisField

		public void AddCapturedThisField (EmitContext ec)
		{
			TypeExpr type_expr = new TypeExpression (ec.CurrentType, Location);
			Field f = AddCompilerGeneratedField ("<>f__this", type_expr);
			f.Define ();
			hoisted_this = new HoistedThis (this, f);
		}
開發者ID:calumjiao,項目名稱:Mono-Class-Libraries,代碼行數:7,代碼來源:anonymous.cs

示例6: CaptureThis

		public HoistedThis CaptureThis (EmitContext ec, This t)
		{
			hoisted_this = new HoistedThis (this, t);
			return hoisted_this;
		}
開發者ID:lewurm,項目名稱:benchmarker,代碼行數:5,代碼來源:anonymous.cs

示例7: EmitStoreyInstantiation

		//
		// Initializes all hoisted variables
		//
		public void EmitStoreyInstantiation (EmitContext ec)
		{
			// There can be only one instance variable for each storey type
			if (Instance != null)
				throw new InternalErrorException ();

			//
			// A storey with hoisted `this' is an instance method
			//
			if (!HasHoistedVariables) {
				hoisted_this.RemoveHoisting ();
				hoisted_this = null;
				return;
			}

			SymbolWriter.OpenCompilerGeneratedBlock (ec.ig);

			DefineStoreyReferences ();

			//
			// Create an instance of storey type
			//
			Expression storey_type_expr;
			if (is_generic) {
				//
				// Use current method type parameter (MVAR) for top level storey only. All
				// nested storeys use class type parameter (VAR)
				//
				TypeParameter[] tparams = ec.CurrentAnonymousMethod != null && ec.CurrentAnonymousMethod.Storey != null ?
					ec.CurrentAnonymousMethod.Storey.TypeParameters :
					ec.GenericDeclContainer.TypeParameters;

				TypeArguments targs = new TypeArguments ();

				if (tparams.Length < CountTypeParameters) {
					TypeParameter[] parent_tparams = ec.DeclContainer.Parent.CurrentTypeParameters;
					for (int i = 0; i < parent_tparams.Length; ++i)
						targs.Add (new TypeParameterExpr (parent_tparams[i], Location));
				}
				
				for (int i = 0; i < tparams.Length; ++i)
					targs.Add (new TypeParameterExpr (tparams[i], Location));

				storey_type_expr = new GenericTypeExpr (TypeBuilder, targs, Location);
			} else {
				storey_type_expr = new TypeExpression (TypeBuilder, Location);
			}

			Expression e = new New (storey_type_expr, new ArrayList (0), Location).Resolve (ec);
			e.Emit (ec);

			Instance = new LocalTemporary (storey_type_expr.Type);
			Instance.Store (ec);

			EmitHoistedFieldsInitialization (ec);

			SymbolWriter.DefineScopeVariable (ID, Instance.Builder);
			SymbolWriter.CloseCompilerGeneratedBlock (ec.ig);
		}
開發者ID:lewurm,項目名稱:benchmarker,代碼行數:62,代碼來源:anonymous.cs


注:本文中的Mono.CSharp.HoistedThis類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。