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


C# TypeContainer.AddMethod方法代码示例

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


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

示例1: yyparse


//.........这里部分代码省略.........
case 156:
#line 1237 "cs-parser.jay"
  {
	  	lexer.parsing_generic_declaration = false;
		yyVal = new VariableMemberDeclaration ((MemberName) yyVals[0+yyTop], null);
	  }
  break;
case 157:
#line 1242 "cs-parser.jay"
  {
		lexer.parsing_generic_declaration = false;	  
		yyVal = null;
	  }
  break;
case 158:
#line 1250 "cs-parser.jay"
  {
		Report.Error (650, GetLocation (yyVals[-2+yyTop]), "Syntax error, bad array declarator. To declare a managed array the rank specifier precedes the variable's identifier. " +
			"To declare a fixed size buffer field, use the fixed keyword before the field type");
	  }
  break;
case 161:
#line 1262 "cs-parser.jay"
  {
		if (RootContext.Documentation != null)
			Lexer.doc_state = XmlCommentState.NotAllowed;
	  }
  break;
case 162:
#line 1267 "cs-parser.jay"
  {
		Method method = (Method) yyVals[-2+yyTop];
		method.Block = (ToplevelBlock) yyVals[0+yyTop];
		current_container.AddMethod (method);
		
		if (current_container.Kind == MemberKind.Interface && method.Block != null) {
			Report.Error (531, method.Location, "`{0}': interface members cannot have a definition", method.GetSignatureForError ());
		}

		current_generic_method = null;
		current_local_parameters = null;

		if (RootContext.Documentation != null)
			Lexer.doc_state = XmlCommentState.Allowed;
	  }
  break;
case 163:
#line 1289 "cs-parser.jay"
  {
		valid_param_mod = ParameterModifierType.All;
	  }
  break;
case 164:
#line 1293 "cs-parser.jay"
  {
		lexer.ConstraintsParsing = true;
	  }
  break;
case 165:
#line 1297 "cs-parser.jay"
  {
		lexer.ConstraintsParsing = false;
		valid_param_mod = 0;
		MemberName name = (MemberName) yyVals[-6+yyTop];
		current_local_parameters = (ParametersCompiled) yyVals[-3+yyTop];
开发者ID:speier,项目名称:shake,代码行数:66,代码来源:cs-parser.cs

示例2: yyparse


//.........这里部分代码省略.........
  break;
case 153:
#line 1291 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
  {
		--lexer.parsing_block;
		yyVal = new ConstInitializer (current_field, (Expression) yyVals[-1+yyTop], GetLocation (yyVals[-3+yyTop]));
		lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop]));
	  }
  break;
case 154:
#line 1297 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
  {
		report.Error (443, lexer.Location, "Value or constant expected");
		yyVal = null;
	  }
  break;
case 157:
#line 1307 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
  {
		/* It has to be here for the parent to safely restore artificial block*/
	  	Error_SyntaxError (yyToken);
	  	yyVal = null;
	  }
  break;
case 158:
#line 1316 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
  {
		if (doc_support)
			Lexer.doc_state = XmlCommentState.NotAllowed;

		/* Add it early in the case of body being eof for full ast*/
		Method m = (Method) yyVals[0+yyTop];
		async_block = (m.ModFlags & Modifiers.ASYNC) != 0;
		current_container.AddMethod (m);
		
	  }
  break;
case 159:
#line 1327 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
  {
		Method method = (Method) yyVals[-2+yyTop];
		method.Block = (ToplevelBlock) yyVals[0+yyTop];
		async_block = false;
		
		if (method.Block == null) {
			method.ParameterInfo.CheckParameters (method);

			if ((method.ModFlags & Modifiers.ASYNC) != 0) {
				report.Error (1994, method.Location, "`{0}': The async modifier can only be used with methods that have a body",
					method.GetSignatureForError ());
			}
		} else {
			if (current_container.Kind == MemberKind.Interface) {
				report.Error (531, method.Location, "`{0}': interface members cannot have a definition",
					method.GetSignatureForError ());
			}
		}

		current_local_parameters = null;

		if (doc_support)
			Lexer.doc_state = XmlCommentState.Allowed;
	  }
  break;
case 160:
#line 1355 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
开发者ID:runefs,项目名称:Marvin,代码行数:67,代码来源:cs-parser.cs

示例3: case_920

void case_920()
#line 5989 "cs-parser.jay"
{ 
		current_container = new Class (current_namespace, current_class, new MemberName ("<InteractiveExpressionClass>"), Modifiers.PUBLIC, null);
		current_class = current_container;

		/* (ref object retval)*/
		Parameter [] mpar = new Parameter [1];
		mpar [0] = new Parameter (new TypeExpression (compiler.BuiltinTypes.Object, Location.Null), "$retval", Parameter.Modifier.REF, null, Location.Null);

		ParametersCompiled pars = new ParametersCompiled (mpar);
		var mods = Modifiers.PUBLIC | Modifiers.STATIC;
		if (settings.Unsafe)
			mods |= Modifiers.UNSAFE;

		current_local_parameters = pars;
		Method method = new Method (
			current_class,
			null, /* generic*/
			new TypeExpression (compiler.BuiltinTypes.Void, Location.Null),
			mods,
			new MemberName ("Host"),
			pars,
			null /* attributes */);
			
		current_container.AddMethod (method);			

		oob_stack.Push (method);
		++lexer.parsing_block;
		start_block (lexer.Location);
	  }
开发者ID:okrmartin,项目名称:monodevelop,代码行数:31,代码来源:cs-parser.cs

示例4: case_918

void case_918()
#line 5952 "C:\Projects\Junk\mono\mcs\class\Mono.CSharp\..\..\mcs\cs-parser.jay"
{ 
		current_container = new Class (current_namespace, current_class, new MemberName ("<InteractiveExpressionClass>"), Modifiers.PUBLIC, null);
		current_class = current_container;

		/* (ref object retval)*/
		Parameter [] mpar = new Parameter [1];
		mpar [0] = new Parameter (new TypeExpression (TypeManager.object_type, Location.Null), "$retval", Parameter.Modifier.REF, null, Location.Null);

		ParametersCompiled pars = new ParametersCompiled (mpar);
		var mods = Modifiers.PUBLIC | Modifiers.STATIC;
		if (settings.Unsafe)
			mods |= Modifiers.UNSAFE;

		current_local_parameters = pars;
		Method method = new Method (
			current_class,
			null, /* generic*/
			new TypeExpression (TypeManager.void_type, Location.Null),
			mods,
			new MemberName ("Host"),
			pars,
			null /* attributes */);
			
		current_container.AddMethod (method);			

		oob_stack.Push (method);
		++lexer.parsing_block;
		start_block (lexer.Location);
	  }
开发者ID:RainsSoft,项目名称:MonoCompilerAsAService,代码行数:31,代码来源:cs-parser.cs


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