本文整理汇总了C#中Mono.CSharp.EventProperty类的典型用法代码示例。如果您正苦于以下问题:C# EventProperty类的具体用法?C# EventProperty怎么用?C# EventProperty使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EventProperty类属于Mono.CSharp命名空间,在下文中一共展示了EventProperty类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoveDelegateMethod
public RemoveDelegateMethod (EventProperty method, Attributes attrs, Location loc)
: base (method, RemovePrefix, attrs, loc)
{
}
示例2: Visit
public override void Visit (EventProperty ep)
{
EventDeclaration newEvent = new EventDeclaration ();
var location = LocationsBag.GetMemberLocation (ep);
AddModifiers (newEvent, location);
if (location != null)
newEvent.AddChild (new CSharpTokenNode (Convert (location[0]), "event".Length), EventDeclaration.Roles.Keyword);
newEvent.AddChild ((INode)ep.TypeName.Accept (this), EventDeclaration.Roles.ReturnType);
newEvent.AddChild (new Identifier (ep.MemberName.Name, Convert (ep.MemberName.Location)), EventDeclaration.Roles.Identifier);
if (location != null)
newEvent.AddChild (new CSharpTokenNode (Convert (location[1]), 1), EventDeclaration.Roles.LBrace);
if (ep.Add != null) {
MonoDevelop.CSharp.Dom.Accessor addAccessor = new MonoDevelop.CSharp.Dom.Accessor ();
var addLocation = LocationsBag.GetMemberLocation (ep.Add);
AddModifiers (addAccessor, addLocation);
addAccessor.AddChild (new CSharpTokenNode (Convert (ep.Add.Location), "add".Length), EventDeclaration.Roles.Keyword);
if (ep.Add.Block != null)
addAccessor.AddChild ((INode)ep.Add.Block.Accept (this), EventDeclaration.Roles.Body);
newEvent.AddChild (addAccessor, EventDeclaration.EventAddRole);
}
if (ep.Remove != null) {
MonoDevelop.CSharp.Dom.Accessor removeAccessor = new MonoDevelop.CSharp.Dom.Accessor ();
var removeLocation = LocationsBag.GetMemberLocation (ep.Remove);
AddModifiers (removeAccessor, removeLocation);
removeAccessor.AddChild (new CSharpTokenNode (Convert (ep.Remove.Location), "remove".Length), EventDeclaration.Roles.Keyword);
if (ep.Remove.Block != null)
removeAccessor.AddChild ((INode)ep.Remove.Block.Accept (this), EventDeclaration.Roles.Body);
newEvent.AddChild (removeAccessor, EventDeclaration.EventRemoveRole);
}
if (location != null)
newEvent.AddChild (new CSharpTokenNode (Convert (location[2]), 1), EventDeclaration.Roles.RBrace);
typeStack.Peek ().AddChild (newEvent, TypeDeclaration.Roles.Member);
}
示例3: Visit
public override void Visit(EventProperty ep)
{
var newEvent = new CustomEventDeclaration();
AddAttributeSection(newEvent, ep);
var location = LocationsBag.GetMemberLocation(ep);
AddModifiers(newEvent, location);
if (location != null && location.Count > 0)
newEvent.AddChild(new CSharpTokenNode(Convert(location [0]), CustomEventDeclaration.EventKeywordRole), CustomEventDeclaration.EventKeywordRole);
newEvent.AddChild(ConvertToType(ep.TypeExpression), Roles.Type);
AddExplicitInterface(newEvent, ep.MemberName);
newEvent.AddChild(Identifier.Create(ep.MemberName.Name, Convert(ep.Location)), Roles.Identifier);
if (location != null && location.Count >= 2)
newEvent.AddChild(new CSharpTokenNode(Convert(location [1]), Roles.LBrace), Roles.LBrace);
if (ep.Add != null) {
var addAccessor = new Accessor();
AddAttributeSection(addAccessor, ep.Add);
var addLocation = LocationsBag.GetMemberLocation(ep.Add);
AddModifiers(addAccessor, addLocation);
addAccessor.AddChild(new CSharpTokenNode(Convert(ep.Add.Location), CustomEventDeclaration.AddKeywordRole), CustomEventDeclaration.AddKeywordRole);
if (ep.Add.Block != null)
addAccessor.AddChild((BlockStatement)ep.Add.Block.Accept(this), Roles.Body);
newEvent.AddChild(addAccessor, CustomEventDeclaration.AddAccessorRole);
}
if (ep.Remove != null) {
var removeAccessor = new Accessor();
AddAttributeSection(removeAccessor, ep.Remove);
var removeLocation = LocationsBag.GetMemberLocation(ep.Remove);
AddModifiers(removeAccessor, removeLocation);
removeAccessor.AddChild(new CSharpTokenNode(Convert(ep.Remove.Location), CustomEventDeclaration.RemoveKeywordRole), CustomEventDeclaration.RemoveKeywordRole);
if (ep.Remove.Block != null)
removeAccessor.AddChild((BlockStatement)ep.Remove.Block.Accept(this), Roles.Body);
newEvent.AddChild(removeAccessor, CustomEventDeclaration.RemoveAccessorRole);
}
if (location != null && location.Count >= 3) {
newEvent.AddChild(new CSharpTokenNode(Convert(location [2]), Roles.RBrace), Roles.RBrace);
} else {
// parser error, set end node to max value.
newEvent.AddChild(new ErrorNode(), Roles.Error);
}
typeStack.Peek().AddChild(newEvent, Roles.TypeMemberRole);
}
示例4: AEventPropertyAccessor
protected AEventPropertyAccessor (EventProperty method, string prefix, Attributes attrs, Location loc)
: base (method, prefix, attrs, loc)
{
}
示例5: Visit
public override void Visit (EventProperty ep)
{
CustomEventDeclaration newEvent = new CustomEventDeclaration ();
AddAttributeSection (newEvent, ep);
var location = LocationsBag.GetMemberLocation (ep);
AddModifiers (newEvent, location);
if (location != null)
newEvent.AddChild (new CSharpTokenNode (Convert (location[0]), "event".Length), CustomEventDeclaration.Roles.Keyword);
newEvent.AddChild (ConvertToType (ep.TypeName), CustomEventDeclaration.Roles.Type);
if (ep.MemberName.Left != null) {
newEvent.AddChild (ConvertToType (ep.MemberName.Left), CustomEventDeclaration.PrivateImplementationTypeRole);
var privateImplTypeLoc = LocationsBag.GetLocations (ep.MemberName.Left);
if (privateImplTypeLoc != null)
newEvent.AddChild (new CSharpTokenNode (Convert (privateImplTypeLoc[0]), 1), MethodDeclaration.Roles.Dot);
}
newEvent.AddChild (Identifier.Create (ep.MemberName.Name, Convert (ep.Location)), CustomEventDeclaration.Roles.Identifier);
if (location != null && location.Count >= 2)
newEvent.AddChild (new CSharpTokenNode (Convert (location[1]), 1), CustomEventDeclaration.Roles.LBrace);
if (ep.Add != null) {
Accessor addAccessor = new Accessor ();
AddAttributeSection (addAccessor, ep.Add);
var addLocation = LocationsBag.GetMemberLocation (ep.Add);
AddModifiers (addAccessor, addLocation);
addAccessor.AddChild (new CSharpTokenNode (Convert (ep.Add.Location), "add".Length), CustomEventDeclaration.Roles.Keyword);
if (ep.Add.Block != null)
addAccessor.AddChild ((BlockStatement)ep.Add.Block.Accept (this), CustomEventDeclaration.Roles.Body);
newEvent.AddChild (addAccessor, CustomEventDeclaration.AddAccessorRole);
}
if (ep.Remove != null) {
Accessor removeAccessor = new Accessor ();
AddAttributeSection (removeAccessor, ep.Remove);
var removeLocation = LocationsBag.GetMemberLocation (ep.Remove);
AddModifiers (removeAccessor, removeLocation);
removeAccessor.AddChild (new CSharpTokenNode (Convert (ep.Remove.Location), "remove".Length), CustomEventDeclaration.Roles.Keyword);
if (ep.Remove.Block != null)
removeAccessor.AddChild ((BlockStatement)ep.Remove.Block.Accept (this), CustomEventDeclaration.Roles.Body);
newEvent.AddChild (removeAccessor, CustomEventDeclaration.RemoveAccessorRole);
}
if (location != null && location.Count >= 3) {
newEvent.AddChild (new CSharpTokenNode (Convert (location[2]), 1), CustomEventDeclaration.Roles.RBrace);
} else {
// parser error, set end node to max value.
newEvent.AddChild (new ErrorNode (), AstNode.Roles.Error);
}
typeStack.Peek ().AddChild (newEvent, TypeDeclaration.MemberRole);
}
示例6: Visit
public override void Visit (EventProperty e)
{
DomEvent evt = new DomEvent ();
evt.Name = ConvertQuoted (e.MemberName.Name);
evt.Documentation = RetrieveDocumentation (e.Location.Row);
evt.Location = Convert (e.MemberName.Location);
evt.Modifiers = ConvertModifiers (e.ModFlags);
evt.ReturnType = ConvertReturnType (e.TypeName);
var location = LocationsBag.GetMemberLocation (e);
if (location != null)
evt.BodyRegion = ConvertRegion (location[1], location[location.Count - 1]);
AddAttributes (evt, e.OptAttributes, e);
AddExplicitInterfaces (evt, e);
evt.DeclaringType = typeStack.Peek ();
typeStack.Peek ().Add (evt);
}
示例7: Visit
public virtual void Visit (EventProperty ep)
{
}
示例8: Visit
public override void Visit (EventProperty e)
{
DomEvent evt = new DomEvent ();
evt.Name = e.MemberName.Name;
evt.Documentation = RetrieveDocumentation (e.Location.Row);
evt.Location = Convert (e.MemberName.Location);
evt.Modifiers = ConvertModifiers (e.ModFlags);
evt.ReturnType = ConvertReturnType (e.TypeName);
var location = LocationsBag.GetMemberLocation (e);
if (location != null)
evt.BodyRegion = ConvertRegion (location[0], location[1]);
// if (e.Add != null) {
// property.GetterModifier = ConvertModifiers (p.Get.ModFlags);
// if (p.Get.Block != null)
// property.GetRegion = ConvertRegion (p.Get.Location, p.Get.Block.EndLocation);
// }
//
// if (e.Remove != null) {
// property.GetterModifier = ConvertModifiers (p.Get.ModFlags);
// if (p.Get.Block != null)
// property.GetRegion = ConvertRegion (p.Get.Location, p.Get.Block.EndLocation);
// }
AddAttributes (evt, e.OptAttributes);
AddExplicitInterfaces (evt, e);
evt.DeclaringType = typeStack.Peek ();
typeStack.Peek ().Add (evt);
}
示例9: yyparse
//.........这里部分代码省略.........
current_local_parameters = new ParametersCompiled (compiler,
new Parameter (implicit_value_parameter_type, "value",
Parameter.Modifier.NONE, null, GetLocation (yyVals[-3+yyTop])));
lexer.EventParsing = true;
}
break;
case 293:
#line 2286 "cs-parser.jay"
{
lexer.EventParsing = false;
}
break;
case 294:
#line 2290 "cs-parser.jay"
{
MemberName name = (MemberName) yyVals[-5+yyTop];
if (current_container.Kind == MemberKind.Interface) {
Report.Error (69, GetLocation (yyVals[-7+yyTop]), "Event in interface cannot have add or remove accessors");
yyVals[-2+yyTop] = new Accessors (null, null);
} else if (yyVals[-2+yyTop] == null) {
Report.Error (65, GetLocation (yyVals[-7+yyTop]), "`{0}.{1}': event property must have both add and remove accessors",
current_container.GetSignatureForError (), name.GetSignatureForError ());
yyVals[-2+yyTop] = new Accessors (null, null);
}
Accessors accessors = (Accessors) yyVals[-2+yyTop];
if (accessors.get_or_add == null || accessors.set_or_remove == null)
/* CS0073 is already reported, so no CS0065 here.*/
yyVal = null;
else {
Event e = new EventProperty (
current_class, (FullNamedExpression) yyVals[-6+yyTop], (Modifiers) yyVals[-8+yyTop], name,
(Attributes) yyVals[-9+yyTop], accessors.get_or_add, accessors.set_or_remove);
if (RootContext.Documentation != null) {
e.DocComment = Lexer.consume_doc_comment ();
Lexer.doc_state = XmlCommentState.Allowed;
}
current_container.AddEvent (e);
implicit_value_parameter_type = null;
}
current_local_parameters = null;
}
break;
case 295:
#line 2322 "cs-parser.jay"
{
MemberName mn = (MemberName) yyVals[-1+yyTop];
if (mn.Left != null)
Report.Error (71, mn.Location, "An explicit interface implementation of an event must use property syntax");
if (RootContext.Documentation != null)
Lexer.doc_state = XmlCommentState.Allowed;
Error_SyntaxError (yyToken);
yyVal = null;
}
break;
case 296:
#line 2337 "cs-parser.jay"
{
yyVal = new Accessors ((Accessor) yyVals[-1+yyTop], (Accessor) yyVals[0+yyTop]);
}
示例10: Visit
public override void Visit (EventProperty ep)
{
CustomEventDeclaration newEvent = new CustomEventDeclaration ();
var location = LocationsBag.GetMemberLocation (ep);
AddModifiers (newEvent, location);
if (location != null)
newEvent.AddChild (new CSharpTokenNode (Convert (location[0]), "event".Length), CustomEventDeclaration.Roles.Keyword);
newEvent.AddChild (ConvertToType (ep.TypeName), CustomEventDeclaration.Roles.Type);
newEvent.AddChild (new Identifier (ep.MemberName.Name, Convert (ep.MemberName.Location)), CustomEventDeclaration.Roles.Identifier);
if (location != null && location.Count >= 2)
newEvent.AddChild (new CSharpTokenNode (Convert (location[1]), 1), CustomEventDeclaration.Roles.LBrace);
if (ep.Add != null) {
Accessor addAccessor = new Accessor ();
var addLocation = LocationsBag.GetMemberLocation (ep.Add);
AddModifiers (addAccessor, addLocation);
addAccessor.AddChild (new CSharpTokenNode (Convert (ep.Add.Location), "add".Length), CustomEventDeclaration.Roles.Keyword);
if (ep.Add.Block != null)
addAccessor.AddChild ((BlockStatement)ep.Add.Block.Accept (this), CustomEventDeclaration.Roles.Body);
newEvent.AddChild (addAccessor, CustomEventDeclaration.AddAccessorRole);
}
if (ep.Remove != null) {
Accessor removeAccessor = new Accessor ();
var removeLocation = LocationsBag.GetMemberLocation (ep.Remove);
AddModifiers (removeAccessor, removeLocation);
removeAccessor.AddChild (new CSharpTokenNode (Convert (ep.Remove.Location), "remove".Length), CustomEventDeclaration.Roles.Keyword);
if (ep.Remove.Block != null)
removeAccessor.AddChild ((BlockStatement)ep.Remove.Block.Accept (this), CustomEventDeclaration.Roles.Body);
newEvent.AddChild (removeAccessor, CustomEventDeclaration.RemoveAccessorRole);
}
if (location != null && location.Count >= 3)
newEvent.AddChild (new CSharpTokenNode (Convert (location[2]), 1), CustomEventDeclaration.Roles.RBrace);
typeStack.Peek ().AddChild (newEvent, TypeDeclaration.MemberRole);
}
示例11: RemoveDelegateMethod
public RemoveDelegateMethod(EventProperty method, Accessor accessor)
: base(method, accessor, RemovePrefix)
{
}
示例12: AEventPropertyAccessor
protected AEventPropertyAccessor(EventProperty method, Accessor accessor, string prefix)
: base(method, accessor, prefix)
{
}
示例13: AddDelegateMethod
public AddDelegateMethod(EventProperty method, Accessor accessor)
: base(method, accessor, AddPrefix)
{
}