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


C# GenericMethod.SetParameterInfo方法代码示例

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


在下文中一共展示了GenericMethod.SetParameterInfo方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: case_166

void case_166()
#line 1283 "cs-parser.jay"
{
		lexer.ConstraintsParsing = false;
		valid_param_mod = 0;
		MemberName name = (MemberName) yyVals[-6+yyTop];
		current_local_parameters = (ParametersCompiled) yyVals[-3+yyTop];

		GenericMethod generic = null;
		if (name.TypeArguments != null) {
			generic = new GenericMethod (current_namespace, current_class, name,
						     (FullNamedExpression) yyVals[-7+yyTop], current_local_parameters);

			generic.SetParameterInfo ((List<Constraints>) yyVals[0+yyTop]);
		} else if (yyVals[0+yyTop] != null) {
			Report.Error (80, GetLocation (yyVals[0+yyTop]),
				"Constraints are not allowed on non-generic declarations");
		}

		Method method = new Method (current_class, generic, (FullNamedExpression) yyVals[-7+yyTop], (Modifiers) yyVals[-8+yyTop],
				     name, current_local_parameters, (Attributes) yyVals[-9+yyTop]);
				     
		if (yyVals[0+yyTop] != null && ((method.ModFlags & Modifiers.OVERRIDE) != 0 || method.IsExplicitImpl)) {
			Report.Error (460, method.Location,
				"`{0}': Cannot specify constraints for overrides and explicit interface implementation methods",
				method.GetSignatureForError ());
		}

		if (RootContext.Documentation != null)
			method.DocComment = Lexer.consume_doc_comment ();

		lbag.AddMember (method, GetModifierLocations (), GetLocation (yyVals[-5+yyTop]), GetLocation (yyVals[-2+yyTop]));
		yyVal = method;
	  }
开发者ID:Ein,项目名称:monodevelop,代码行数:34,代码来源:cs-parser.cs

示例2: case_169

void case_169()
#line 1328 "cs-parser.jay"
{
		lexer.ConstraintsParsing = false;
		valid_param_mod = 0;

		MemberName name = (MemberName) yyVals[-6+yyTop];
		current_local_parameters = (ParametersCompiled) yyVals[-3+yyTop];

		if (yyVals[-1+yyTop] != null && name.TypeArguments == null)
			Report.Error (80, lexer.Location,
				      "Constraints are not allowed on non-generic declarations");

		Method method;
		GenericMethod generic = null;
		if (name.TypeArguments != null) {
			generic = new GenericMethod (current_namespace, current_class, name,
				new TypeExpression (TypeManager.void_type, GetLocation (yyVals[-7+yyTop])),
				current_local_parameters);

			generic.SetParameterInfo ((List<Constraints>) yyVals[0+yyTop]);
		}

		var modifiers = (Modifiers) yyVals[-9+yyTop];


		const Modifiers invalid_partial_mod = Modifiers.AccessibilityMask | Modifiers.ABSTRACT | Modifiers.EXTERN |
			Modifiers.NEW | Modifiers.OVERRIDE | Modifiers.SEALED | Modifiers.VIRTUAL;

		if ((modifiers & invalid_partial_mod) != 0) {
			Report.Error (750, name.Location, "A partial method cannot define access modifier or " +
       			"any of abstract, extern, new, override, sealed, or virtual modifiers");
			modifiers &= ~invalid_partial_mod;
		}

		if ((current_class.ModFlags & Modifiers.PARTIAL) == 0) {
			Report.Error (751, name.Location, "A partial method must be declared within a " +
       			"partial class or partial struct");
		}
		
		modifiers |= Modifiers.PARTIAL | Modifiers.PRIVATE;
		
		method = new Method (current_class, generic, new TypeExpression (TypeManager.void_type, GetLocation (yyVals[-7+yyTop])),
				     modifiers, name, current_local_parameters, (Attributes) yyVals[-10+yyTop]);

		if (RootContext.Documentation != null)
			method.DocComment = Lexer.consume_doc_comment ();

		/* TODO: lbag, push void*/
		StoreModifierLocation (Modifiers.PARTIAL, GetLocation (yyVals[-8+yyTop]));
		lbag.AddMember (method, GetModifierLocations (), GetLocation (yyVals[-5+yyTop]), GetLocation (yyVals[-2+yyTop]));
		yyVal = method;
	  }
开发者ID:Ein,项目名称:monodevelop,代码行数:53,代码来源:cs-parser.cs

示例3: yyparse


//.........这里部分代码省略.........
case 88:
#line 885 "cs-parser.jay"
  { 
		yyVal = Argument.AType.Out;
	  }
  break;
case 104:
#line 917 "cs-parser.jay"
  {
		Report.Error (1519, lexer.Location, "Unexpected symbol `{0}' in class, struct, or interface member declaration",
			GetSymbolName (yyToken));
		yyVal = null;
		lexer.parsing_generic_declaration = false;
	  }
  break;
case 105:
#line 930 "cs-parser.jay"
  {
		lexer.ConstraintsParsing = true;
	  }
  break;
case 106:
#line 934 "cs-parser.jay"
  { 
		MemberName name = MakeName ((MemberName) yyVals[0+yyTop]);
		push_current_class (new Struct (current_namespace, current_class, name, (Modifiers) yyVals[-4+yyTop], (Attributes) yyVals[-5+yyTop]), yyVals[-3+yyTop]);
	  }
  break;
case 107:
#line 940 "cs-parser.jay"
  {
		lexer.ConstraintsParsing = false;

		current_class.SetParameterInfo ((List<Constraints>) yyVals[0+yyTop]);

		if (RootContext.Documentation != null)
			current_container.DocComment = Lexer.consume_doc_comment ();
	  }
  break;
case 108:
#line 949 "cs-parser.jay"
  {
		--lexer.parsing_declaration;	  
		if (RootContext.Documentation != null)
			Lexer.doc_state = XmlCommentState.Allowed;
	  }
  break;
case 109:
#line 955 "cs-parser.jay"
  {
		yyVal = pop_current_class ();
	  }
  break;
case 110:
#line 958 "cs-parser.jay"
  {
		CheckIdentifierToken (yyToken, GetLocation (yyVals[0+yyTop]));
	  }
  break;
case 111:
#line 965 "cs-parser.jay"
  {
		if (RootContext.Documentation != null)
			Lexer.doc_state = XmlCommentState.Allowed;
	  }
  break;
开发者ID:speier,项目名称:shake,代码行数:67,代码来源:cs-parser.cs

示例4: 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
			//

			int modifiers;
			if (Block.HasCapturedVariable || Block.HasCapturedThis) {
				storey = FindBestMethodStorey ();
				modifiers = storey != null ? Modifiers.INTERNAL : Modifiers.PRIVATE;
			} else {
				if (ec.CurrentAnonymousMethod != null)
					storey = ec.CurrentAnonymousMethod.Storey;

				modifiers = Modifiers.STATIC | Modifiers.PRIVATE;
			}

			TypeContainer parent = storey != null ? storey : ec.CurrentTypeDefinition;

			MemberCore mc = ec.MemberContext as MemberCore;
			string name = CompilerGeneratedClass.MakeName (parent != storey ? block_name : null,
				"m", null, unique_id++);

			MemberName member_name;
			GenericMethod generic_method;
			if (storey == null && mc.MemberName.TypeArguments != null) {
				member_name = new MemberName (name, mc.MemberName.TypeArguments.Clone (), Location);

				generic_method = new GenericMethod (parent.NamespaceEntry, parent, member_name,
					new TypeExpression (ReturnType, Location), parameters);

				ArrayList list = new ArrayList ();
				foreach (TypeParameter tparam in ec.CurrentTypeParameters) {
					if (tparam.Constraints != null)
						list.Add (tparam.Constraints.Clone ());
				}
				generic_method.SetParameterInfo (list);
			} else {
				member_name = new MemberName (name, Location);
				generic_method = null;
			}

			string real_name = String.Format (
				"{0}~{1}{2}", mc.GetSignatureForError (), GetSignatureForError (),
				parameters.GetSignatureForError ());

			return new AnonymousMethodMethod (parent,
				this, storey, generic_method, new TypeExpression (ReturnType, Location), modifiers,
				real_name, member_name, parameters);
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:57,代码来源:anonymous.cs

示例5: case_149

void case_149()
#line 1346 "cs-parser.jay"
{
		lexer.ConstraintsParsing = false;
		valid_param_mod = 0;

		MemberName name = (MemberName) yyVals[-6+yyTop];
		current_local_parameters = (ParametersCompiled) yyVals[-3+yyTop];

		if (yyVals[-1+yyTop] != null && name.TypeArguments == null)
			report.Error (80, lexer.Location,
				      "Constraints are not allowed on non-generic declarations");

		GenericMethod generic = null;
		if (name.TypeArguments != null) {
			generic = new GenericMethod (current_namespace, current_class, name,
				new TypeExpression (compiler.BuiltinTypes.Void, GetLocation (yyVals[-8+yyTop])),
				current_local_parameters);

			generic.SetParameterInfo ((List<Constraints>) yyVals[-1+yyTop]);
		}

		var modifiers = (Modifiers) yyVals[-10+yyTop];
		modifiers |= Modifiers.PARTIAL;

		var method = Method.Create (current_class, generic, new TypeExpression (compiler.BuiltinTypes.Void, GetLocation (yyVals[-8+yyTop])),
				     modifiers, name, current_local_parameters, (Attributes) yyVals[-11+yyTop], yyVals[-1+yyTop] != null);

		if (doc_support)
			method.DocComment = Lexer.consume_doc_comment ();

		StoreModifierLocation (Modifiers.PARTIAL, GetLocation (yyVals[-9+yyTop]));
		lbag.AddMember (method, mod_locations, GetLocation (yyVals[-5+yyTop]), GetLocation (yyVals[-2+yyTop]));
		yyVal = method;
	  }
开发者ID:holmak,项目名称:NRefactory,代码行数:35,代码来源:cs-parser.cs

示例6: case_145

void case_145()
#line 1302 "cs-parser.jay"
{
		lexer.ConstraintsParsing = false;
		valid_param_mod = 0;
		MemberName name = (MemberName) yyVals[-6+yyTop];
		current_local_parameters = (ParametersCompiled) yyVals[-3+yyTop];

		GenericMethod generic = null;
		if (name.TypeArguments != null) {
			generic = new GenericMethod (current_namespace, current_class, name,
						     (FullNamedExpression) yyVals[-7+yyTop], current_local_parameters);

			generic.SetParameterInfo ((List<Constraints>) yyVals[0+yyTop]);
		} else if (yyVals[0+yyTop] != null) {
			report.Error (80, GetLocation (yyVals[0+yyTop]),
				"Constraints are not allowed on non-generic declarations");
		}

		var method = Method.Create (current_class, generic, (FullNamedExpression) yyVals[-7+yyTop], (Modifiers) yyVals[-8+yyTop],
				     name, current_local_parameters, (Attributes) yyVals[-9+yyTop], yyVals[0+yyTop] != null);
				     
		if (doc_support)
			method.DocComment = Lexer.consume_doc_comment ();

		lbag.AddMember (method, GetModifierLocations (), GetLocation (yyVals[-5+yyTop]), GetLocation (yyVals[-2+yyTop]));
		yyVal = method;
	  }
开发者ID:holmak,项目名称:NRefactory,代码行数:28,代码来源:cs-parser.cs

示例7: yyparse


//.........这里部分代码省略.........
case 84:
#line 876 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
  {
		lexer.parsing_modifiers = true;
	  }
  break;
case 97:
#line 895 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
  {
		report.Error (1519, lexer.Location, "Unexpected symbol `{0}' in class, struct, or interface member declaration",
			GetSymbolName (yyToken));
		yyVal = null;
		lexer.parsing_generic_declaration = false;
	  }
  break;
case 98:
#line 908 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
  {
		lexer.ConstraintsParsing = true;
	  }
  break;
case 99:
#line 912 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
  { 
		MemberName name = MakeName ((MemberName) yyVals[0+yyTop]);
		push_current_class (new Struct (current_namespace, current_class, name, (Modifiers) yyVals[-4+yyTop], (Attributes) yyVals[-5+yyTop]), yyVals[-3+yyTop]);
	  }
  break;
case 100:
#line 918 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
  {
		lexer.ConstraintsParsing = false;

		current_class.SetParameterInfo ((List<Constraints>) yyVals[0+yyTop]);

		if (doc_support)
			current_container.DocComment = Lexer.consume_doc_comment ();

		lbag.AddMember (current_class, mod_locations, GetLocation (yyVals[-5+yyTop]));
		
		lexer.parsing_modifiers = true;
	  }
  break;
case 101:
#line 931 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
  {
		if (doc_support)
			Lexer.doc_state = XmlCommentState.Allowed;
	  }
  break;
case 102:
#line 936 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
  {
		--lexer.parsing_declaration;
		if (doc_support)
			Lexer.doc_state = XmlCommentState.Allowed;
	  }
  break;
case 103:
#line 942 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
  {
		lbag.AppendToMember (current_class, GetLocation (yyVals[-5+yyTop]), GetLocation (yyVals[-2+yyTop]), GetLocation (yyVals[0+yyTop]));
		yyVal = pop_current_class ();
	  }
  break;
case 104:
开发者ID:runefs,项目名称:Marvin,代码行数:67,代码来源:cs-parser.cs


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