本文整理汇总了C#中Mono.CSharp.TypeContainer.AddIndexer方法的典型用法代码示例。如果您正苦于以下问题:C# TypeContainer.AddIndexer方法的具体用法?C# TypeContainer.AddIndexer怎么用?C# TypeContainer.AddIndexer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.CSharp.TypeContainer
的用法示例。
在下文中一共展示了TypeContainer.AddIndexer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: yyparse
//.........这里部分代码省略.........
has_get = has_set = false;
parsing_indexer = false;
}
break;
case 313:
#line 2430 "cs-parser.jay"
{
Accessors accessors = (Accessors) yyVals[-2+yyTop];
Accessor get_block = accessors != null ? accessors.get_or_add : null;
Accessor set_block = accessors != null ? accessors.set_or_remove : null;
bool order = accessors != null ? accessors.declared_in_reverse : false;
Indexer indexer = new Indexer (current_class, (FullNamedExpression) yyVals[-10+yyTop],
(MemberName)yyVals[-9+yyTop], (Modifiers) yyVals[-11+yyTop], (ParametersCompiled) yyVals[-6+yyTop], (Attributes) yyVals[-12+yyTop],
get_block, set_block, order);
if (yyVals[-10+yyTop] == TypeManager.system_void_expr)
Report.Error (620, GetLocation (yyVals[-10+yyTop]), "`{0}': indexer return type cannot be `void'", indexer.GetSignatureForError ());
if (accessors == null)
Report.Error (548, indexer.Location, "`{0}': property or indexer must have at least one accessor", indexer.GetSignatureForError ());
if (current_container.Kind == MemberKind.Interface) {
if (indexer.Get.Block != null)
Report.Error (531, indexer.Location, "`{0}.get': interface members cannot have a definition", indexer.GetSignatureForError ());
if (indexer.Set.Block != null)
Report.Error (531, indexer.Location, "`{0}.set': interface members cannot have a definition", indexer.GetSignatureForError ());
}
if (RootContext.Documentation != null)
indexer.DocComment = ConsumeStoredComment ();
current_container.AddIndexer (indexer);
current_local_parameters = null;
implicit_value_parameter_type = null;
indexer_parameters = null;
}
break;
case 314:
#line 2469 "cs-parser.jay"
{
if (RootContext.Documentation != null)
enumTypeComment = Lexer.consume_doc_comment ();
}
break;
case 315:
#line 2475 "cs-parser.jay"
{
MemberName name = (MemberName) yyVals[-4+yyTop];
if (name.IsGeneric) {
Report.Error (1675, name.Location, "Enums cannot have type parameters");
}
name = MakeName (name);
Enum e = new Enum (current_namespace, current_class, (TypeExpr) yyVals[-3+yyTop], (Modifiers) yyVals[-6+yyTop],
name, (Attributes) yyVals[-7+yyTop]);
if (RootContext.Documentation != null)
e.DocComment = enumTypeComment;
EnumMember em = null;
foreach (VariableDeclaration ev in (IList<VariableDeclaration>) yyVals[-1+yyTop]) {
em = new EnumMember (