(DISTFILES): Comment out a few missing files.
[mono-project.git] / mcs / ilasm / codegen / EventDef.cs
blob619fa0eef67a1c34e225bf616902a7b19bc5dffb
1 //
2 // Mono.ILASM.EventDef
3 //
4 // Author(s):
5 // Jackson Harper (Jackson@LatitudeGeo.com)
6 //
7 // (C) 2003 Jackson Harper, All right reserved
8 //
11 using System;
12 using System.Collections;
14 namespace Mono.ILASM {
16 public class EventDef {
18 private FeatureAttr attr;
19 private string name;
20 private ITypeRef type;
21 private PEAPI.Event event_def;
22 private bool is_resolved;
24 private MethodRef addon;
25 private MethodRef fire;
26 private MethodRef other;
27 private MethodRef removeon;
29 public EventDef (FeatureAttr attr, ITypeRef type, string name)
31 this.attr = attr;
32 this.name = name;
33 this.type = type;
34 is_resolved = false;
37 public PEAPI.Event Resolve (CodeGen code_gen, PEAPI.ClassDef classdef)
39 if (is_resolved)
40 return event_def;
42 type.Resolve (code_gen);
43 event_def = classdef.AddEvent (name, type.PeapiType);
45 if ((attr & FeatureAttr.Rtspecialname) != 0)
46 event_def.SetRTSpecialName ();
48 if ((attr & FeatureAttr.Specialname) != 0)
49 event_def.SetSpecialName ();
51 is_resolved = true;
53 return event_def;
56 public void Define (CodeGen code_gen, PEAPI.ClassDef classdef)
58 if (!is_resolved)
59 Resolve (code_gen, classdef);
61 if (addon != null) {
62 addon.Resolve (code_gen);
63 event_def.AddAddon ((PEAPI.MethodDef) addon.PeapiMethod);
66 if (fire != null) {
67 fire.Resolve (code_gen);
68 event_def.AddFire ((PEAPI.MethodDef) fire.PeapiMethod);
71 if (other != null) {
72 other.Resolve (code_gen);
73 event_def.AddOther ((PEAPI.MethodDef) other.PeapiMethod);
76 if (removeon != null) {
77 removeon.Resolve (code_gen);
78 event_def.AddRemoveOn ((PEAPI.MethodDef) removeon.PeapiMethod);
82 public void AddAddon (MethodRef method_ref)
84 addon = method_ref;
87 public void AddFire (MethodRef method_ref)
89 fire = method_ref;
92 public void AddOther (MethodRef method_ref)
94 other = method_ref;
97 public void AddRemoveon (MethodRef method_ref)
99 removeon = method_ref;