~ubuntu-branches/ubuntu/wily/monodevelop/wily

« back to all changes in this revision

Viewing changes to contrib/Mono.Cecil/Mono.Cecil/Mono.Cecil/TypeDefinition.cs

  • Committer: Bazaar Package Importer
  • Author(s): Jo Shields
  • Date: 2010-02-02 11:39:59 UTC
  • mfrom: (10.2.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20100202113959-n3u848nfj35yyd03
Tags: 2.2.1+dfsg-1
* New upstream release
* debian/control:
  + Standards version 3.8.4 (no changes needed)
* debian/patches/remove_support_for_non_debian_functionality.patch,
  debian/patches/remove_support_for_soft_debugger.patch,
  debian/patches/remove_support_for_moonlight.patch,
  debian/rules:
  + Split patch into two pieces, to make it easier to enable either
    SDB or Moonlight support with a rebuild
* debian/monodevelop-moonlight.install,
  debian/monodevelop-debugger-sdb.install,
  debian/control:
  + Create packaging data for the Soft Debugger addin and Moonlight addin -
    and comment them out of debian/control as we can't provide them on
    Debian for now

Show diffs side-by-side

added added

removed removed

Lines of Context:
76
76
                        }
77
77
                }
78
78
 
 
79
                public bool HasInterfaces {
 
80
                        get { return (m_interfaces == null) ? false : (m_interfaces.Count > 0); }
 
81
                }
 
82
 
79
83
                public InterfaceCollection Interfaces {
80
84
                        get {
81
85
                                if (m_interfaces == null)
85
89
                        }
86
90
                }
87
91
 
 
92
                public bool HasNestedTypes {
 
93
                        get { return (m_nestedTypes == null) ? false : (m_nestedTypes.Count > 0); }
 
94
                }
 
95
 
88
96
                public NestedTypeCollection NestedTypes {
89
97
                        get {
90
98
                                if (m_nestedTypes == null)
94
102
                        }
95
103
                }
96
104
 
 
105
                public bool HasMethods {
 
106
                        get { return (m_methods == null) ? false : (m_methods.Count > 0); }
 
107
                }
 
108
 
97
109
                public MethodDefinitionCollection Methods {
98
110
                        get {
99
111
                                if (m_methods == null)
103
115
                        }
104
116
                }
105
117
 
 
118
                public bool HasConstructors {
 
119
                        get { return (m_ctors == null) ? false : (m_ctors.Count > 0); }
 
120
                }
 
121
 
106
122
                public ConstructorCollection Constructors {
107
123
                        get {
108
124
                                if (m_ctors == null)
112
128
                        }
113
129
                }
114
130
 
 
131
                public bool HasFields {
 
132
                        get { return (m_fields == null) ? false : (m_fields.Count > 0); }
 
133
                }
 
134
 
115
135
                public FieldDefinitionCollection Fields {
116
136
                        get {
117
137
                                if (m_fields == null)
121
141
                        }
122
142
                }
123
143
 
 
144
                public bool HasEvents {
 
145
                        get { return (m_events == null) ? false : (m_events.Count > 0); }
 
146
                }
 
147
 
124
148
                public EventDefinitionCollection Events {
125
149
                        get {
126
150
                                if (m_events == null)
130
154
                        }
131
155
                }
132
156
 
 
157
                public bool HasProperties {
 
158
                        get { return (m_properties == null) ? false : (m_properties.Count > 0); }
 
159
                }
 
160
 
133
161
                public PropertyDefinitionCollection Properties {
134
162
                        get {
135
163
                                if (m_properties == null)
139
167
                        }
140
168
                }
141
169
 
 
170
                public bool HasSecurityDeclarations {
 
171
                        get { return (m_secDecls == null) ? false : (m_secDecls.Count > 0); }
 
172
                }
 
173
 
142
174
                public SecurityDeclarationCollection SecurityDeclarations {
143
175
                        get {
144
176
                                if (m_secDecls == null)
414
446
 
415
447
                public override bool IsValueType {
416
448
                        get {
417
 
                                return m_baseType != null && (
418
 
                                        this.IsEnum || (m_baseType.FullName == Constants.ValueType && this.FullName != Constants.Enum));
 
449
                                return m_baseType != null && ((m_baseType.FullName == Constants.Enum) ||
 
450
                                        (m_baseType.FullName == Constants.ValueType && this.FullName != Constants.Enum));
419
451
                        }
420
452
                }
421
453
 
 
454
                public new TypeDefinition DeclaringType {
 
455
                        get { return (TypeDefinition) base.DeclaringType; }
 
456
                        set { base.DeclaringType = value; }
 
457
                }
 
458
 
422
459
                internal TypeDefinition (string name, string ns, TypeAttributes attrs) :
423
460
                        base (name, ns)
424
461
                {
433
470
                        this.BaseType = baseType;
434
471
                }
435
472
 
 
473
                public override TypeDefinition Resolve ()
 
474
                {
 
475
                        return this;
 
476
                }
 
477
 
436
478
                public TypeDefinition Clone ()
437
479
                {
438
480
                        return Clone (this, new ImportContext (NullReferenceImporter.Instance, this));
459
501
                                nt.PackingSize = type.PackingSize;
460
502
                        }
461
503
 
462
 
                        foreach (FieldDefinition field in type.Fields)
463
 
                                nt.Fields.Add (FieldDefinition.Clone (field, context));
464
 
                        foreach (MethodDefinition ctor in type.Constructors)
465
 
                                nt.Constructors.Add (MethodDefinition.Clone (ctor, context));
466
 
                        foreach (MethodDefinition meth in type.Methods)
467
 
                                nt.Methods.Add (MethodDefinition.Clone (meth, context));
468
 
                        foreach (EventDefinition evt in type.Events)
469
 
                                nt.Events.Add (EventDefinition.Clone (evt, context));
470
 
                        foreach (PropertyDefinition prop in type.Properties)
471
 
                                nt.Properties.Add (PropertyDefinition.Clone (prop, context));
472
 
                        foreach (TypeReference intf in type.Interfaces)
473
 
                                nt.Interfaces.Add (context.Import (intf));
474
 
                        foreach (TypeDefinition nested in type.NestedTypes)
475
 
                                nt.NestedTypes.Add (Clone (nested, context));
476
 
                        foreach (CustomAttribute ca in type.CustomAttributes)
477
 
                                nt.CustomAttributes.Add (CustomAttribute.Clone (ca, context));
478
 
                        foreach (SecurityDeclaration dec in type.SecurityDeclarations)
479
 
                                nt.SecurityDeclarations.Add (SecurityDeclaration.Clone (dec));
 
504
                        if (type.HasFields) {
 
505
                                foreach (FieldDefinition field in type.Fields)
 
506
                                        nt.Fields.Add (FieldDefinition.Clone (field, context));
 
507
                        }
 
508
                        if (type.HasConstructors) {
 
509
                                foreach (MethodDefinition ctor in type.Constructors)
 
510
                                        nt.Constructors.Add (MethodDefinition.Clone (ctor, context));
 
511
                        }
 
512
                        if (type.HasMethods) {
 
513
                                foreach (MethodDefinition meth in type.Methods)
 
514
                                        nt.Methods.Add (MethodDefinition.Clone (meth, context));
 
515
                        }
 
516
                        if (type.HasEvents) {
 
517
                                foreach (EventDefinition evt in type.Events)
 
518
                                        nt.Events.Add (EventDefinition.Clone (evt, context));
 
519
                        }
 
520
                        if (type.HasProperties) {
 
521
                                foreach (PropertyDefinition prop in type.Properties)
 
522
                                        nt.Properties.Add (PropertyDefinition.Clone (prop, context));
 
523
                        }
 
524
                        if (type.HasInterfaces) {
 
525
                                foreach (TypeReference intf in type.Interfaces)
 
526
                                        nt.Interfaces.Add (context.Import (intf));
 
527
                        }
 
528
                        if (type.HasNestedTypes) {
 
529
                                foreach (TypeDefinition nested in type.NestedTypes)
 
530
                                        nt.NestedTypes.Add (Clone (nested, context));
 
531
                        }
 
532
                        if (type.HasCustomAttributes) {
 
533
                                foreach (CustomAttribute ca in type.CustomAttributes)
 
534
                                        nt.CustomAttributes.Add (CustomAttribute.Clone (ca, context));
 
535
                        }
 
536
                        if (type.HasSecurityDeclarations) {
 
537
                                foreach (SecurityDeclaration dec in type.SecurityDeclarations)
 
538
                                        nt.SecurityDeclarations.Add (SecurityDeclaration.Clone (dec));
 
539
                        }
480
540
 
481
541
                        context.GenericContext.Type = contextType;
482
542