本文整理汇总了C#中Mono.CSharp.TypeContainer.AddField方法的典型用法代码示例。如果您正苦于以下问题:C# TypeContainer.AddField方法的具体用法?C# TypeContainer.AddField怎么用?C# TypeContainer.AddField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.CSharp.TypeContainer
的用法示例。
在下文中一共展示了TypeContainer.AddField方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: yyparse
//.........这里部分代码省略.........
case 131:
#line 1053 "cs-parser.jay"
{
--lexer.parsing_block;
yyVal = new VariableDeclaration ((Tokenizer.LocatedToken) yyVals[-3+yyTop], (Expression) yyVals[0+yyTop]);
}
break;
case 132:
#line 1058 "cs-parser.jay"
{
/* A const field requires a value to be provided*/
Report.Error (145, GetLocation (yyVals[0+yyTop]), "A const field requires a value to be provided");
yyVal = null;
}
break;
case 135:
#line 1076 "cs-parser.jay"
{
FullNamedExpression type = (FullNamedExpression) yyVals[-2+yyTop];
if (type == TypeManager.system_void_expr)
Report.Error (670, GetLocation (yyVals[-2+yyTop]), "Fields cannot have void type");
var mod = (Modifiers) yyVals[-3+yyTop];
foreach (VariableMemberDeclaration var in (List<object>) yyVals[-1+yyTop]){
Field field = new Field (current_class, type, mod, var.MemberName, (Attributes) yyVals[-4+yyTop]);
field.Initializer = var.GetInitializer (type);
if (RootContext.Documentation != null) {
field.DocComment = Lexer.consume_doc_comment ();
Lexer.doc_state = XmlCommentState.Allowed;
}
current_container.AddField (field);
yyVal = field; /* FIXME: might be better if it points to the top item*/
}
}
break;
case 136:
#line 1102 "cs-parser.jay"
{
FullNamedExpression type = (FullNamedExpression) yyVals[-2+yyTop];
var mod = (Modifiers) yyVals[-4+yyTop];
foreach (VariableDeclaration var in (List<VariableDeclaration>) yyVals[-1+yyTop]) {
FixedField field = new FixedField (current_class, type, mod, var.identifier,
var.GetInitializer (type), (Attributes) yyVals[-5+yyTop], var.Location);
if (RootContext.Version < LanguageVersion.ISO_2)
Report.FeatureIsNotAvailable (GetLocation (yyVals[-3+yyTop]), "fixed size buffers");
if (RootContext.Documentation != null) {
field.DocComment = Lexer.consume_doc_comment ();
Lexer.doc_state = XmlCommentState.Allowed;
}
current_container.AddField (field);
yyVal = field; /* FIXME: might be better if it points to the top item*/
}
}
break;
case 137:
#line 1127 "cs-parser.jay"
{
Report.Error (1641, GetLocation (yyVals[-1+yyTop]), "A fixed size buffer field must have the array size specifier after the field name");
}
示例2: yyparse
//.........这里部分代码省略.........
if (doc_support) {
current_field.DocComment = Lexer.consume_doc_comment ();
Lexer.doc_state = XmlCommentState.Allowed;
}
current_field.Initializer = (ConstInitializer) yyVals[-2+yyTop];
lbag.AddMember (current_field, mod_locations, GetLocation (yyVals[-6+yyTop]), GetLocation (yyVals[0+yyTop]));
current_field = null;
}
break;
case 117:
#line 1003 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
yyVal = yyVals[0+yyTop];
}
break;
case 118:
#line 1007 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
yyVal = new SimpleName("dynamic",new Location(0,0));
}
break;
case 119:
#line 1013 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
lexer.parsing_generic_declaration = false;
var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop];
FullNamedExpression type = yyVals[0+yyTop] as FullNamedExpression;
if(type == null){
report.Error (10008, GetLocation (yyVals[0+yyTop]), "Could not resolve type expression");
}
current_field = new RoleField (current_class, type, Modifiers.PRIVATE | Modifiers.ROLE, new MemberName (lt.Value, lt.Location),null);
current_container.AddField (current_field);
yyVal = current_field;
if (doc_support) {
current_field.DocComment = Lexer.consume_doc_comment ();
Lexer.doc_state = XmlCommentState.Allowed;
}
lbag.AddMember (current_field, mod_locations, GetLocation (yyVals[-1+yyTop]));
yyVal = current_field;
current_role = current_field;
current_field = null;
}
break;
case 120:
#line 1039 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
current_role = null;
}
break;
case 121:
#line 1045 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{ yyVal = null; }
break;
case 122:
#line 1047 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
TypeParameter tparam = null;
var simple = current_role.TypeExpression as SimpleName;
if((simple != null && simple.Name != "dynamic") || (simple.Type != null && simple.Type.BuiltinType != BuiltinTypeSpec.Type.Dynamic)){
if(current_class.IsGeneric){
for(int i = 0; tparam == null && i<current_class.TypeParameters.Length;i++){
if(simple.Name == current_class.TypeParameters[i].Name){