(DISTFILES): Comment out a few missing files.
[mono-project.git] / mcs / ilasm / codegen / PropertyDef.cs
blobefe6b6839391e7e8b3990405581e372a6c9fed65
1 //
2 // Mono.ILASM.PropertyDef
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 PropertyDef {
18 private FeatureAttr attr;
19 private string name;
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)
32 this.attr = attr;
33 this.name = name;
34 this.type = type;
35 this.arg_list = arg_list;
36 is_resolved = false;
39 public PEAPI.Property Resolve (CodeGen code_gen, PEAPI.ClassDef classdef)
41 if (is_resolved)
42 return prop_def;
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 ();
61 is_resolved = true;
63 return prop_def;
66 public void Define (CodeGen code_gen, PEAPI.ClassDef classdef)
68 if (!is_resolved)
69 Resolve (code_gen, classdef);
71 if (_get != null) {
72 _get.Resolve (code_gen);
73 prop_def.AddGetter ((PEAPI.MethodDef) _get.PeapiMethod);
76 if (_set != null) {
77 _set.Resolve (code_gen);
78 prop_def.AddSetter ((PEAPI.MethodDef) _set.PeapiMethod);
81 if (other != null) {
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)
92 this._get = _get;
95 public void AddSet (MethodRef _set)
97 this._set = _set;
100 public void AddOther (MethodRef other)
102 this.other = other;
105 public void AddInitValue (PEAPI.Constant init_value)
107 this.init_value = init_value;