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


C# CSharp.TypeArguments类代码示例

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


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

示例1: MemberName

		private MemberName (MemberName left, string name, bool is_double_colon,
				    TypeArguments args, Location loc)
			: this (left, name, is_double_colon, loc)
		{
			if (args != null && args.Count > 0)
				this.TypeArguments = args;
		}
开发者ID:constructor-igor,项目名称:cudafy,代码行数:7,代码来源:decl.cs

示例2: MemberName

		public MemberName (string name, TypeArguments args, Location loc)
		{
			this.Name = name;
			this.Location = loc;

			if (args != null && args.Count > 0)
				this.TypeArguments = args;
		}
开发者ID:Tenere,项目名称:mono,代码行数:8,代码来源:decl.cs

示例3: MakeMemberName

		protected static MemberName MakeMemberName (MemberBase host, string name, int unique_id, TypeParameter[] tparams, Location loc)
		{
			string host_name = host == null ? null : host.Name;
			string tname = MakeName (host_name, "c", name, unique_id);
			TypeArguments args = null;
			if (tparams != null) {
				args = new TypeArguments ();
				foreach (TypeParameter tparam in tparams)
					args.Add (new TypeParameterName (tparam.Name, null, loc));
			}

			return new MemberName (tname, args, loc);
		}
开发者ID:nzaugg,项目名称:mono,代码行数:13,代码来源:anonymous.cs

示例4: CreateExpressionFactoryCall

		public static Expression CreateExpressionFactoryCall (string name, TypeArguments typeArguments, ArrayList args, Location loc)
		{
			return new Invocation (new MemberAccess (CreateExpressionTypeExpression (loc), name, typeArguments, loc), args);
		}
开发者ID:lewurm,项目名称:benchmarker,代码行数:4,代码来源:ecore.cs

示例5: DoDefineMembers

		protected override bool DoDefineMembers ()
		{
			if (!base.DoDefineMembers ())
				return false;

			Location loc = Location;

			var equals_parameters = ParametersCompiled.CreateFullyResolved (
				new Parameter (new TypeExpression (Compiler.BuiltinTypes.Object, loc), "obj", 0, null, loc), Compiler.BuiltinTypes.Object);

			Method equals = new Method (this, new TypeExpression (Compiler.BuiltinTypes.Bool, loc),
				Modifiers.PUBLIC | Modifiers.OVERRIDE | Modifiers.DEBUGGER_HIDDEN, new MemberName ("Equals", loc),
				equals_parameters, null);

			equals_parameters[0].Resolve (equals, 0);

			Method tostring = new Method (this, new TypeExpression (Compiler.BuiltinTypes.String, loc),
				Modifiers.PUBLIC | Modifiers.OVERRIDE | Modifiers.DEBUGGER_HIDDEN, new MemberName ("ToString", loc),
				Mono.CSharp.ParametersCompiled.EmptyReadOnlyParameters, null);

			ToplevelBlock equals_block = new ToplevelBlock (Compiler, equals.ParameterInfo, loc);

			TypeExpr current_type;
			if (CurrentTypeParameters != null) {
				var targs = new TypeArguments ();
				for (int i = 0; i < CurrentTypeParameters.Count; ++i) {
					targs.Add (new TypeParameterExpr (CurrentTypeParameters[i], Location));
				}

				current_type = new GenericTypeExpr (Definition, targs, loc);
			} else {
				current_type = new TypeExpression (Definition, loc);
			}

			var li_other = LocalVariable.CreateCompilerGenerated (CurrentType, equals_block, loc);
			equals_block.AddStatement (new BlockVariableDeclaration (new TypeExpression (li_other.Type, loc), li_other));
			var other_variable = new LocalVariableReference (li_other, loc);

			MemberAccess system_collections_generic = new MemberAccess (new MemberAccess (
				new QualifiedAliasMember ("global", "System", loc), "Collections", loc), "Generic", loc);

			Expression rs_equals = null;
			Expression string_concat = new StringConstant (Compiler.BuiltinTypes, "{", loc);
			Expression rs_hashcode = new IntConstant (Compiler.BuiltinTypes, -2128831035, loc);
			for (int i = 0; i < parameters.Count; ++i) {
				var p = parameters [i];
				var f = (Field) Members [i * 2];

				MemberAccess equality_comparer = new MemberAccess (new MemberAccess (
					system_collections_generic, "EqualityComparer",
						new TypeArguments (new SimpleName (CurrentTypeParameters [i].Name, loc)), loc),
						"Default", loc);

				Arguments arguments_equal = new Arguments (2);
				arguments_equal.Add (new Argument (new MemberAccess (new This (f.Location), f.Name)));
				arguments_equal.Add (new Argument (new MemberAccess (other_variable, f.Name)));

				Expression field_equal = new Invocation (new MemberAccess (equality_comparer,
					"Equals", loc), arguments_equal);

				Arguments arguments_hashcode = new Arguments (1);
				arguments_hashcode.Add (new Argument (new MemberAccess (new This (f.Location), f.Name)));
				Expression field_hashcode = new Invocation (new MemberAccess (equality_comparer,
					"GetHashCode", loc), arguments_hashcode);

				IntConstant FNV_prime = new IntConstant (Compiler.BuiltinTypes, 16777619, loc);				
				rs_hashcode = new Binary (Binary.Operator.Multiply,
					new Binary (Binary.Operator.ExclusiveOr, rs_hashcode, field_hashcode),
					FNV_prime);

				Expression field_to_string = new Conditional (new BooleanExpression (new Binary (Binary.Operator.Inequality,
					new MemberAccess (new This (f.Location), f.Name), new NullLiteral (loc))),
					new Invocation (new MemberAccess (
						new MemberAccess (new This (f.Location), f.Name), "ToString"), null),
					new StringConstant (Compiler.BuiltinTypes, string.Empty, loc), loc);

				if (rs_equals == null) {
					rs_equals = field_equal;
					string_concat = new Binary (Binary.Operator.Addition,
						string_concat,
						new Binary (Binary.Operator.Addition,
							new StringConstant (Compiler.BuiltinTypes, " " + p.Name + " = ", loc),
							field_to_string));
					continue;
				}

				//
				// Implementation of ToString () body using string concatenation
				//				
				string_concat = new Binary (Binary.Operator.Addition,
					new Binary (Binary.Operator.Addition,
						string_concat,
						new StringConstant (Compiler.BuiltinTypes, ", " + p.Name + " = ", loc)),
					field_to_string);

				rs_equals = new Binary (Binary.Operator.LogicalAnd, rs_equals, field_equal);
			}

			string_concat = new Binary (Binary.Operator.Addition,
				string_concat,
//.........这里部分代码省略.........
开发者ID:rabink,项目名称:mono,代码行数:101,代码来源:anonymous.cs

示例6: CompletionMemberAccess

		public CompletionMemberAccess (Expression e, string partial_name, TypeArguments targs, Location l)
		{
			this.expr = e;
			this.loc = l;
			this.partial_name = partial_name;
			this.targs = targs;
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:7,代码来源:complete.cs

示例7: CreateHoistedBaseCallProxy

		//
		// Creates a proxy base method call inside this container for hoisted base member calls
		//
		public MethodSpec CreateHoistedBaseCallProxy (ResolveContext rc, MethodSpec method)
		{
			Method proxy_method;

			//
			// One proxy per base method is enough
			//
			if (hoisted_base_call_proxies == null) {
				hoisted_base_call_proxies = new Dictionary<MethodSpec, Method> ();
				proxy_method = null;
			} else {
				hoisted_base_call_proxies.TryGetValue (method, out proxy_method);
			}

			if (proxy_method == null) {
				string name = CompilerGeneratedClass.MakeName (method.Name, null, "BaseCallProxy", hoisted_base_call_proxies.Count);
				var base_parameters = new Parameter[method.Parameters.Count];
				for (int i = 0; i < base_parameters.Length; ++i) {
					var base_param = method.Parameters.FixedParameters[i];
					base_parameters[i] = new Parameter (new TypeExpression (method.Parameters.Types[i], Location),
						base_param.Name, base_param.ModFlags, null, Location);
					base_parameters[i].Resolve (this, i);
				}

				var cloned_params = ParametersCompiled.CreateFullyResolved (base_parameters, method.Parameters.Types);
				if (method.Parameters.HasArglist) {
					cloned_params.FixedParameters[0] = new Parameter (null, "__arglist", Parameter.Modifier.NONE, null, Location);
					cloned_params.Types[0] = Module.PredefinedTypes.RuntimeArgumentHandle.Resolve (Location);
				}

				GenericMethod generic_method;
				MemberName member_name;
				if (method.IsGeneric) {
					//
					// Copy all base generic method type parameters info
					//
					var hoisted_tparams = method.GenericDefinition.TypeParameters;
					var targs = new TypeArguments ();
					var type_params = new TypeParameter[hoisted_tparams.Length];
					for (int i = 0; i < type_params.Length; ++i) {
						var tp = hoisted_tparams[i];
						targs.Add (new TypeParameterName (tp.Name, null, Location));
						type_params[i] = new TypeParameter (tp, this, null, new MemberName (tp.Name), null);
					}

					member_name = new MemberName (name, targs, Location);
					generic_method = new GenericMethod (NamespaceEntry, this, member_name, type_params,
						new TypeExpression (method.ReturnType, Location), cloned_params);
				} else {
					member_name = new MemberName (name);
					generic_method = null;
				}

				// Compiler generated proxy
				proxy_method = new Method (this, generic_method, new TypeExpression (method.ReturnType, Location),
					Modifiers.PRIVATE | Modifiers.COMPILER_GENERATED | Modifiers.DEBUGGER_HIDDEN,
					member_name, cloned_params, null);

				var block = new ToplevelBlock (Compiler, proxy_method.ParameterInfo, Location);

				var mg = MethodGroupExpr.CreatePredefined (method, method.DeclaringType, Location);
				mg.InstanceExpression = new BaseThis (method.DeclaringType, Location);

				// Get all the method parameters and pass them as arguments
				var real_base_call = new Invocation (mg, block.GetAllParametersArguments ());
				Statement statement;
				if (method.ReturnType == TypeManager.void_type)
					statement = new StatementExpression (real_base_call);
				else
					statement = new Return (real_base_call, Location);

				block.AddStatement (statement);
				proxy_method.Block = block;

				methods.Add (proxy_method);
				proxy_method.Define ();

				hoisted_base_call_proxies.Add (method, proxy_method);
			}

			return proxy_method.Spec;
		}
开发者ID:famousthom,项目名称:monodevelop,代码行数:85,代码来源:class.cs

示例8: case_350

void case_350()
#line 2895 "cs-parser.jay"
{
		TypeArguments type_args = new TypeArguments ();
		type_args.Add ((FullNamedExpression) yyVals[0+yyTop]);
		yyVal = type_args;
		locationListStack.Push (new List<Location> ());
	  }
开发者ID:segaman,项目名称:NRefactory,代码行数:8,代码来源:cs-parser.cs

示例9: ATypeNameExpression

 protected ATypeNameExpression(string name, TypeArguments targs, Location l)
 {
     this.name = name;
     this.targs = targs;
     loc = l;
 }
开发者ID:speier,项目名称:shake,代码行数:6,代码来源:ecore.cs

示例10: CreateExpressionFactoryCall

 public static Expression CreateExpressionFactoryCall(ResolveContext ec, string name, TypeArguments typeArguments, Arguments args, Location loc)
 {
     return new Invocation (new MemberAccess (CreateExpressionTypeExpression (ec, loc), name, typeArguments, loc), args);
 }
开发者ID:speier,项目名称:shake,代码行数:4,代码来源:ecore.cs

示例11: InvokeCallSite

		public override Expression InvokeCallSite(ResolveContext rc, Expression site, Arguments args, TypeSpec returnType, bool isStatement)
		{
			var obj = args[0].Expr;

			bool isSet = IsSetter(site);
			isSet |= (flags & CSharpBinderFlags.ValueFromCompoundAssignment) != 0;
			if (!isSet) {
				if (NeedsCastToObject(returnType)) {
					var site_args = new Arguments(1);
					site_args.Add(new Argument(obj));
					return new Invocation(new MemberAccess(site, "GetMemberAsObject"), site_args);
				} else {
					var site_args = new Arguments(1);
					site_args.Add(new Argument(obj));

					var type_args = new TypeArguments();
					type_args.Add(new TypeExpression(returnType, loc));
					return new Invocation(new MemberAccess(site, "GetMember", type_args, loc), site_args);
				}
			} else {
				var setVal = args[1].Expr;

				if (NeedsCastToObject(setVal.Type)) {
					var site_args = new Arguments(3);
					site_args.Add(new Argument(obj));
					site_args.Add(new Argument(new Cast(new TypeExpression(rc.BuiltinTypes.Object, loc), setVal, loc)));
					site_args.Add(new Argument(new BoolLiteral(rc.BuiltinTypes, false, loc)));
					return new Invocation(new MemberAccess(site, "SetMemberAsObject"), site_args);
				} else {
					var site_args = new Arguments(2);
					site_args.Add(new Argument(obj));
					site_args.Add(new Argument(setVal));

					var type_args = new TypeArguments();
					type_args.Add(new TypeExpression(setVal.Type, loc));
					return new Invocation(new MemberAccess(site, "SetMember", type_args, loc), site_args);
				}
			}
		}
开发者ID:rlfqudxo,项目名称:playscript-mono,代码行数:39,代码来源:dynamic.cs

示例12: SetTypeArguments

		public override void SetTypeArguments (TypeArguments ta)
		{
			type_arguments = ta;
		}
开发者ID:lewurm,项目名称:benchmarker,代码行数:4,代码来源:ecore.cs

示例13: ResolveNested

		FullNamedExpression ResolveNested (IResolveContext ec, Type t)
		{
			if (!TypeManager.IsGenericTypeDefinition (t) && !TypeManager.IsGenericType (t))
				return null;

			DeclSpace ds = ec.DeclContainer;
			while (ds != null && !IsNestedChild (t, ds.TypeBuilder))
				ds = ds.Parent;

			if (ds == null)
				return null;

			Type[] gen_params = TypeManager.GetTypeArguments (t);

			int arg_count = targs != null ? targs.Count : 0;

			for (; (ds != null) && ds.IsGeneric; ds = ds.Parent) {
				if (arg_count + ds.CountTypeParameters == gen_params.Length) {
					TypeArguments new_args = new TypeArguments ();
					foreach (TypeParameter param in ds.TypeParameters)
						new_args.Add (new TypeParameterExpr (param, loc));

					if (targs != null)
						new_args.Add (targs);

					return new GenericTypeExpr (t, new_args, loc);
				}
			}

			return null;
		}
开发者ID:lewurm,项目名称:benchmarker,代码行数:31,代码来源:ecore.cs

示例14: SimpleName

		public SimpleName (string name, TypeParameter[] type_params, Location l)
			: base (name, l)
		{
			targs = new TypeArguments ();
			foreach (TypeParameter type_param in type_params)
				targs.Add (new TypeParameterExpr (type_param, l));
		}
开发者ID:lewurm,项目名称:benchmarker,代码行数:7,代码来源:ecore.cs

示例15: case_349

void case_349()
#line 2887 "cs-parser.jay"
{
		Error_TypeExpected (lexer.Location);
		yyVal = new TypeArguments ();
	  }
开发者ID:segaman,项目名称:NRefactory,代码行数:6,代码来源:cs-parser.cs


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