本文整理汇总了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];
示例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"
示例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);
}
示例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);
}