~ubuntu-branches/ubuntu/lucid/monodevelop/lucid

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Jo Shields
  • Date: 2010-02-02 11:39:59 UTC
  • mfrom: (1.2.6 upstream) (1.3.7 sid)
  • Revision ID: james.westby@ubuntu.com-20100202113959-s4exdz7er7igylz2
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:
306
306
                                TypeDefinition t = (TypeDefinition) m_typeDefStack [i];
307
307
                                tdRow.FieldList = m_fieldIndex;
308
308
                                tdRow.MethodList = m_methodIndex;
309
 
                                foreach (FieldDefinition field in t.Fields)
310
 
                                        VisitFieldDefinition (field);
311
 
                                foreach (MethodDefinition ctor in t.Constructors)
312
 
                                        VisitMethodDefinition (ctor);
313
 
                                foreach (MethodDefinition meth in t.Methods)
314
 
                                        VisitMethodDefinition (meth);
 
309
                                if (t.HasFields) {
 
310
                                        foreach (FieldDefinition field in t.Fields)
 
311
                                                VisitFieldDefinition (field);
 
312
                                }
 
313
                                if (t.HasConstructors) {
 
314
                                        foreach (MethodDefinition ctor in t.Constructors)
 
315
                                                VisitMethodDefinition (ctor);
 
316
                                }
 
317
                                if (t.HasMethods) {
 
318
                                        foreach (MethodDefinition meth in t.Methods)
 
319
                                                VisitMethodDefinition (meth);
 
320
                                }
315
321
 
316
322
                                if (t.HasLayoutInfo)
317
323
                                        WriteLayout (t);
318
324
                        }
319
325
 
320
326
                        foreach (FieldDefinition field in m_fieldStack) {
321
 
                                VisitCustomAttributeCollection (field.CustomAttributes);
 
327
                                if (field.HasCustomAttributes)
 
328
                                        VisitCustomAttributeCollection (field.CustomAttributes);
322
329
                                if (field.MarshalSpec != null)
323
330
                                        VisitMarshalSpec (field.MarshalSpec);
324
331
                        }
325
332
 
326
333
                        foreach (MethodDefinition meth in m_methodStack) {
327
 
                                VisitCustomAttributeCollection (meth.ReturnType.CustomAttributes);
328
 
                                foreach (ParameterDefinition param in meth.Parameters)
329
 
                                        VisitCustomAttributeCollection (param.CustomAttributes);
330
 
                                VisitGenericParameterCollection (meth.GenericParameters);
331
 
                                VisitOverrideCollection (meth.Overrides);
332
 
                                VisitCustomAttributeCollection (meth.CustomAttributes);
333
 
                                VisitSecurityDeclarationCollection (meth.SecurityDeclarations);
 
334
                                if (meth.ReturnType.HasCustomAttributes)
 
335
                                        VisitCustomAttributeCollection (meth.ReturnType.CustomAttributes);
 
336
                                if (meth.HasParameters) {
 
337
                                        foreach (ParameterDefinition param in meth.Parameters) {
 
338
                                                if (param.HasCustomAttributes)
 
339
                                                        VisitCustomAttributeCollection (param.CustomAttributes);
 
340
                                        }
 
341
                                }
 
342
                                if (meth.HasGenericParameters)
 
343
                                        VisitGenericParameterCollection (meth.GenericParameters);
 
344
                                if (meth.HasOverrides)
 
345
                                        VisitOverrideCollection (meth.Overrides);
 
346
                                if (meth.HasCustomAttributes)
 
347
                                        VisitCustomAttributeCollection (meth.CustomAttributes);
 
348
                                if (meth.HasSecurityDeclarations)
 
349
                                        VisitSecurityDeclarationCollection (meth.SecurityDeclarations);
334
350
                                if (meth.PInvokeInfo != null) {
335
351
                                        meth.Attributes |= MethodAttributes.PInvokeImpl;
336
352
                                        VisitPInvokeInfo (meth.PInvokeInfo);
682
698
                        } else
683
699
                                et = GetCorrespondingType (type.FullName);
684
700
 
685
 
                        if (et == ElementType.Object || et == ElementType.Type)
 
701
                        if (et == ElementType.Object || et == ElementType.Type || et == ElementType.String)
686
702
                                et = hc.Constant == null ?
687
703
                                        ElementType.Class :
688
704
                                        GetCorrespondingType (hc.Constant.GetType ().FullName);
814
830
                                gpTable.Rows.Add (gpRow);
815
831
                                gp.MetadataToken = new MetadataToken (TokenType.GenericParam, (uint) gpTable.Rows.Count);
816
832
 
817
 
                                VisitCustomAttributeCollection (gp.CustomAttributes);
 
833
                                if (gp.HasCustomAttributes)
 
834
                                        VisitCustomAttributeCollection (gp.CustomAttributes);
818
835
 
819
 
                                if (gp.Constraints.Count == 0)
 
836
                                if (!gp.HasConstraints)
820
837
                                        continue;
821
838
 
822
839
                                GenericParamConstraintTable gpcTable = m_tableWriter.GetGenericParamConstraintTable ();
836
853
 
837
854
                public override void TerminateModuleDefinition (ModuleDefinition module)
838
855
                {
839
 
                        VisitCustomAttributeCollection (module.Assembly.CustomAttributes);
840
 
                        VisitSecurityDeclarationCollection (module.Assembly.SecurityDeclarations);
841
 
                        VisitCustomAttributeCollection (module.CustomAttributes);
 
856
                        if (module.Assembly.HasCustomAttributes)
 
857
                                VisitCustomAttributeCollection (module.Assembly.CustomAttributes);
 
858
                        if (module.Assembly.HasSecurityDeclarations)
 
859
                                VisitSecurityDeclarationCollection (module.Assembly.SecurityDeclarations);
 
860
                        if (module.HasCustomAttributes)
 
861
                                VisitCustomAttributeCollection (module.CustomAttributes);
842
862
 
843
863
                        CompleteGenericTables ();
844
864
                        SortTables ();
1488
1508
                                m_symbolWriter = SymbolStoreHelper.GetWriter (module, m_asmOutput);
1489
1509
 
1490
1510
                        foreach (TypeDefinition type in module.Types) {
1491
 
                                foreach (MethodDefinition method in type.Methods)
1492
 
                                        WriteSymbols (method);
1493
 
                                foreach (MethodDefinition ctor in type.Constructors)
1494
 
                                        WriteSymbols (ctor);
 
1511
                                if (type.HasMethods) {
 
1512
                                        foreach (MethodDefinition method in type.Methods)
 
1513
                                                WriteSymbols (method);
 
1514
                                }
 
1515
                                if (type.HasConstructors) {
 
1516
                                        foreach (MethodDefinition ctor in type.Constructors)
 
1517
                                                WriteSymbols (ctor);
 
1518
                                }
1495
1519
                        }
1496
1520
 
1497
1521
                        m_symbolWriter.Dispose ();
1502
1526
                        if (!meth.HasBody)
1503
1527
                                return;
1504
1528
 
1505
 
                        m_symbolWriter.Write (meth.Body, GetVariablesSig (meth));
1506
 
                }
1507
 
 
1508
 
                byte [][] GetVariablesSig (MethodDefinition meth)
1509
 
                {
1510
 
                        VariableDefinitionCollection variables = meth.Body.Variables;
1511
 
                        byte [][] signatures = new byte [variables.Count][];
1512
 
                        for (int i = 0; i < variables.Count; i++) {
1513
 
                                signatures [i] = GetVariableSig (variables [i]);
1514
 
                        }
1515
 
                        return signatures;
1516
 
                }
1517
 
 
1518
 
                byte [] GetVariableSig (VariableDefinition var)
1519
 
                {
1520
 
                        return m_sigWriter.CompressLocalVar (m_codeWriter.GetLocalVariableSig (var));
 
1529
                        m_symbolWriter.Write (meth.Body);
1521
1530
                }
1522
1531
        }
1523
1532
}