本文整理汇总了C#中Mono.CSharp.EventField类的典型用法代码示例。如果您正苦于以下问题:C# EventField类的具体用法?C# EventField怎么用?C# EventField使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EventField类属于Mono.CSharp命名空间,在下文中一共展示了EventField类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Visit
public override void Visit (EventField e)
{
EventDeclaration newEvent = new EventDeclaration ();
var location = LocationsBag.GetMemberLocation (e);
AddModifiers (newEvent, location);
if (location != null)
newEvent.AddChild (new CSharpTokenNode (Convert (location[0]), "event".Length), EventDeclaration.Roles.Keyword);
newEvent.AddChild ((INode)e.TypeName.Accept (this), AbstractNode.Roles.ReturnType);
newEvent.AddChild (new Identifier (e.MemberName.Name, Convert (e.MemberName.Location)), EventDeclaration.Roles.Identifier);
if (location != null)
newEvent.AddChild (new CSharpTokenNode (Convert (location[1]), ";".Length), EventDeclaration.Roles.Semicolon);
typeStack.Peek ().AddChild (newEvent, TypeDeclaration.Roles.Member);
}
示例2: Define
public override bool Define()
{
var mod_flags_src = ModFlags;
if (!base.Define ())
return false;
if (declarators != null) {
if ((mod_flags_src & Modifiers.DEFAULT_ACCESS_MODIFER) != 0)
mod_flags_src &= ~(Modifiers.AccessibilityMask | Modifiers.DEFAULT_ACCESS_MODIFER);
var t = new TypeExpression (MemberType, TypeExpression.Location);
foreach (var d in declarators) {
var ef = new EventField (Parent, t, mod_flags_src, new MemberName (d.Name.Value, d.Name.Location), OptAttributes);
if (d.Initializer != null)
ef.initializer = d.Initializer;
ef.Define ();
Parent.PartialContainer.Members.Add (ef);
}
}
if (!HasBackingField) {
SetIsUsed ();
return true;
}
if (Add.IsInterfaceImplementation)
SetIsUsed ();
backing_field = new Field (Parent,
new TypeExpression (MemberType, Location),
Modifiers.BACKING_FIELD | Modifiers.COMPILER_GENERATED | Modifiers.PRIVATE | (ModFlags & (Modifiers.STATIC | Modifiers.UNSAFE)),
MemberName, null);
Parent.PartialContainer.Members.Add (backing_field);
backing_field.Initializer = Initializer;
backing_field.ModFlags &= ~Modifiers.COMPILER_GENERATED;
// Call define because we passed fields definition
backing_field.Define ();
// Set backing field for event fields
spec.BackingField = backing_field.Spec;
return true;
}
示例3: EventFieldAccessor
protected EventFieldAccessor (EventField method, string prefix)
: base (method, prefix, null, method.Location)
{
}
示例4: AddDelegateMethod
public AddDelegateMethod (EventField method):
base (method, AddPrefix)
{
}
示例5: RemoveDelegateMethod
public RemoveDelegateMethod (EventField method):
base (method, RemovePrefix)
{
}
示例6: Visit
public override void Visit (EventField e)
{
var 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);
AddAttributes (evt, e.OptAttributes, e);
AddExplicitInterfaces (evt, e);
evt.DeclaringType = typeStack.Peek ();
typeStack.Peek ().Add (evt);
if (e.Declarators != null) {
foreach (var decl in e.Declarators) {
evt = new DomEvent ();
evt.Name = ConvertQuoted (decl.Name.Value);
evt.Location = Convert (decl.Name.Location);
evt.Modifiers = ConvertModifiers (e.ModFlags);
evt.ReturnType = ConvertReturnType (e.TypeName);
AddAttributes (evt, e.OptAttributes, e);
evt.DeclaringType = typeStack.Peek ();
typeStack.Peek ().Add (evt);
}
}
}
示例7: Visit
public override void Visit(EventField e)
{
var newEvent = new EventDeclaration();
AddAttributeSection(newEvent, e);
var location = LocationsBag.GetMemberLocation(e);
int l = 0;
AddModifiers(newEvent, location);
if (location != null && location.Count > 0)
newEvent.AddChild(new CSharpTokenNode(Convert(location [l++]), EventDeclaration.EventKeywordRole), EventDeclaration.EventKeywordRole);
newEvent.AddChild(ConvertToType(e.TypeExpression), Roles.Type);
var variable = new VariableInitializer();
variable.AddChild(Identifier.Create(e.MemberName.Name, Convert(e.MemberName.Location)), Roles.Identifier);
if (e.Initializer != null) {
if (location != null && location.Count > l)
variable.AddChild(new CSharpTokenNode(Convert(location [l++]), Roles.Assign), Roles.Assign);
variable.AddChild((Expression)e.Initializer.Accept(this), Roles.Expression);
}
newEvent.AddChild(variable, Roles.Variable);
if (e.Declarators != null) {
foreach (var decl in e.Declarators) {
var declLoc = LocationsBag.GetLocations(decl);
if (declLoc != null)
newEvent.AddChild(new CSharpTokenNode(Convert(declLoc [0]), Roles.Comma), Roles.Comma);
variable = new VariableInitializer();
variable.AddChild(Identifier.Create(decl.Name.Value, Convert(decl.Name.Location)), Roles.Identifier);
if (decl.Initializer != null) {
if (declLoc != null)
variable.AddChild(new CSharpTokenNode(Convert(declLoc [1]), Roles.Assign), Roles.Assign);
variable.AddChild((Expression)decl.Initializer.Accept(this), Roles.Expression);
}
newEvent.AddChild(variable, Roles.Variable);
}
}
if (location != null && location.Count > l)
newEvent.AddChild(new CSharpTokenNode(Convert(location [l++]), Roles.Semicolon), Roles.Semicolon);
typeStack.Peek().AddChild(newEvent, Roles.TypeMemberRole);
}
示例8: Visit
public override void Visit (EventField e)
{
EventDeclaration newEvent = new EventDeclaration ();
AddAttributeSection (newEvent, e);
var location = LocationsBag.GetMemberLocation (e);
AddModifiers (newEvent, location);
if (location != null)
newEvent.AddChild (new CSharpTokenNode (Convert (location[0]), "event".Length), EventDeclaration.Roles.Keyword);
newEvent.AddChild (ConvertToType (e.TypeName), AstNode.Roles.Type);
VariableInitializer variable = new VariableInitializer ();
variable.AddChild (Identifier.Create (e.MemberName.Name, Convert (e.MemberName.Location)), FieldDeclaration.Roles.Identifier);
if (e.Initializer != null) {
if (location != null)
variable.AddChild (new CSharpTokenNode (Convert (location[0]), 1), FieldDeclaration.Roles.Assign);
variable.AddChild ((Expression)e.Initializer.Accept (this), VariableInitializer.Roles.Expression);
}
newEvent.AddChild (variable, FieldDeclaration.Roles.Variable);
if (e.Declarators != null) {
foreach (var decl in e.Declarators) {
var declLoc = LocationsBag.GetLocations (decl);
if (declLoc != null)
newEvent.AddChild (new CSharpTokenNode (Convert (declLoc [0]), 1), FieldDeclaration.Roles.Comma);
variable = new VariableInitializer ();
variable.AddChild (Identifier.Create (decl.Name.Value, Convert (decl.Name.Location)), VariableInitializer.Roles.Identifier);
if (decl.Initializer != null) {
if (declLoc != null)
variable.AddChild (new CSharpTokenNode (Convert (declLoc [1]), 1), FieldDeclaration.Roles.Assign);
variable.AddChild ((Expression)decl.Initializer.Accept (this), VariableInitializer.Roles.Expression);
}
newEvent.AddChild (variable, FieldDeclaration.Roles.Variable);
}
}
if (location != null)
newEvent.AddChild (new CSharpTokenNode (Convert (location[1]), ";".Length), EventDeclaration.Roles.Semicolon);
typeStack.Peek ().AddChild (newEvent, TypeDeclaration.MemberRole);
}
示例9: Define
public override bool Define()
{
if (!base.Define ())
return false;
if (declarators != null) {
var t = new TypeExpression (MemberType, TypeExpression.Location);
int index = Parent.PartialContainer.Events.IndexOf (this);
foreach (var d in declarators) {
var ef = new EventField (Parent, t, ModFlags, new MemberName (d.Name.Value, d.Name.Location), OptAttributes);
if (d.Initializer != null)
ef.initializer = d.Initializer;
Parent.PartialContainer.Events.Insert (++index, ef);
}
}
if (!HasBackingField) {
SetIsUsed ();
return true;
}
if (Add.IsInterfaceImplementation)
SetIsUsed ();
backing_field = new Field (Parent,
new TypeExpression (MemberType, Location),
Modifiers.BACKING_FIELD | Modifiers.COMPILER_GENERATED | Modifiers.PRIVATE | (ModFlags & (Modifiers.STATIC | Modifiers.UNSAFE)),
MemberName, null);
Parent.PartialContainer.AddField (backing_field);
backing_field.Initializer = Initializer;
backing_field.ModFlags &= ~Modifiers.COMPILER_GENERATED;
// Call define because we passed fields definition
backing_field.Define ();
// Set backing field for event fields
spec.BackingField = backing_field.Spec;
return true;
}
示例10: Visit
public virtual void Visit (EventField e)
{
}
示例11: EventFieldAccessor
protected EventFieldAccessor(EventField method, string prefix)
: base(method, prefix)
{
}
示例12: Visit
public override void Visit (EventField 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);
AddAttributes (evt, e.OptAttributes);
AddExplicitInterfaces (evt, e);
evt.DeclaringType = typeStack.Peek ();
typeStack.Peek ().Add (evt);
}