2 // Mono.ILASM.PropertyDef
5 // Jackson Harper (Jackson@LatitudeGeo.com)
7 // (C) 2003 Jackson Harper, All right reserved
12 using System
.Collections
;
14 namespace Mono
.ILASM
{
16 public class PropertyDef
{
18 private FeatureAttr attr
;
20 private ITypeRef type
;
21 private ArrayList arg_list
;
22 private PEAPI
.Property prop_def
;
23 private bool is_resolved
;
25 private MethodRef _get
;
26 private MethodRef _set
;
27 private MethodRef other
;
28 private PEAPI
.Constant init_value
;
30 public PropertyDef (FeatureAttr attr
, ITypeRef type
, string name
, ArrayList arg_list
)
35 this.arg_list
= arg_list
;
39 public PEAPI
.Property
Resolve (CodeGen code_gen
, PEAPI
.ClassDef classdef
)
44 PEAPI
.Type
[] type_list
= new PEAPI
.Type
[arg_list
.Count
];
46 for (int i
=0; i
<type_list
.Length
; i
++) {
47 ITypeRef arg_type
= (ITypeRef
) arg_list
[i
];
48 arg_type
.Resolve (code_gen
);
49 type_list
[i
] = arg_type
.PeapiType
;
52 type
.Resolve (code_gen
);
53 prop_def
= classdef
.AddProperty (name
, type
.PeapiType
, type_list
);
55 if ((attr
& FeatureAttr
.Rtspecialname
) != 0)
56 prop_def
.SetRTSpecialName ();
58 if ((attr
& FeatureAttr
.Specialname
) != 0)
59 prop_def
.SetSpecialName ();
66 public void Define (CodeGen code_gen
, PEAPI
.ClassDef classdef
)
69 Resolve (code_gen
, classdef
);
72 _get
.Resolve (code_gen
);
73 prop_def
.AddGetter ((PEAPI
.MethodDef
) _get
.PeapiMethod
);
77 _set
.Resolve (code_gen
);
78 prop_def
.AddSetter ((PEAPI
.MethodDef
) _set
.PeapiMethod
);
82 other
.Resolve (code_gen
);
83 prop_def
.AddOther ((PEAPI
.MethodDef
) other
.PeapiMethod
);
86 if (init_value
!= null)
87 prop_def
.AddInitValue (init_value
);
90 public void AddGet (MethodRef _get
)
95 public void AddSet (MethodRef _set
)
100 public void AddOther (MethodRef other
)
105 public void AddInitValue (PEAPI
.Constant init_value
)
107 this.init_value
= init_value
;