2 // Mono.ILASM.PeapiTypeRef
5 // Jackson Harper (Jackson@LatitudeGeo.com)
7 // (C) 2003 Jackson Harper, All rights reserved
12 using System.Collections;
14 namespace Mono.ILASM {
16 public class PeapiTypeRef {
18 private PEAPI.Type peapi_type;
19 private string full_name;
20 private bool is_pinned;
21 private bool is_array;
24 public PeapiTypeRef (PEAPI.Type peapi_type, string full_name)
26 this.peapi_type = peapi_type;
27 this.full_name = full_name;
33 public string FullName {
34 get { return full_name; }
37 public bool IsPinned {
38 get { return is_pinned; }
42 get { return is_array; }
46 get { return is_ref; }
49 public PEAPI.Type PeapiType {
50 get { return peapi_type; }
53 public void MakeArray ()
55 if (peapi_type is PEAPI.Class) {
56 PEAPI.Class klass = (PEAPI.Class) peapi_type;
57 peapi_type = klass.GetZeroBasedArray ();
59 peapi_type = new PEAPI.ZeroBasedArray (peapi_type);
65 public void MakeBoundArray (ArrayList bound_list)
67 int dimen = bound_list.Count;
68 int[] lower_array = new int[dimen];
69 int[] size_array = new int[dimen];
70 bool lower_set = false;
71 bool size_set = false;
72 bool prev_lower_set = true;
73 bool prev_size_set = true;
75 // TODO: There should probably be an error reported if
76 // something like [3...,3...5] is done
77 for (int i=0; i<dimen; i++) {
78 DictionaryEntry bound = (DictionaryEntry) bound_list[i];
80 if (bound.Key != null && prev_lower_set) {
81 lower_array[i] = (int) bound.Key;
84 prev_lower_set = false;
86 if (bound.Value != null && prev_size_set) {
87 size_array[i] = (int) bound.Value;
90 prev_size_set = false;
93 if (lower_set && size_set) {
94 peapi_type = new PEAPI.BoundArray (peapi_type,
95 (uint) dimen, lower_array, size_array);
96 } else if (size_set) {
97 peapi_type = new PEAPI.BoundArray (peapi_type,
98 (uint) dimen, size_array);
100 peapi_type = new PEAPI.BoundArray (peapi_type, (uint) dimen);
102 /// TODO: Proper full names
107 public void MakeManagedPointer ()
109 peapi_type = new PEAPI.ManagedPointer (peapi_type);
114 public void MakeUnmanagedPointer ()
116 peapi_type = new PEAPI.UnmanagedPointer (peapi_type);
120 public void MakeCustomModified (PEAPI.CustomModifier modifier)
122 peapi_type = new PEAPI.CustomModifiedType (peapi_type,
123 PEAPI.CustomModifier.modreq, (PEAPI.Class) peapi_type);
126 public void MakePinned ()
131 public void Resolve (CodeGen code_gen)