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

« back to all changes in this revision

Viewing changes to contrib/Mono.Cecil/Mono.Cecil/Mono.Cecil.Signatures/SignatureReader.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:
370
370
                        case ElementType.ByRef :
371
371
                                rt.TypedByRef = rt.Void = false;
372
372
                                rt.ByRef = true;
373
 
 
374
 
                                if (rt.CustomMods == null || rt.CustomMods.Length == 0)
375
 
                                        rt.CustomMods = ReadCustomMods (data, start, out start);
376
 
 
 
373
                                rt.CustomMods = CombineCustomMods(rt.CustomMods, ReadCustomMods (data, start, out start));
377
374
                                rt.Type = ReadType (data, start, out start);
378
375
                                break;
379
376
                        default :
381
378
                                rt.Type = ReadType (data, curs, out start);
382
379
                                break;
383
380
                        }
 
381
 
384
382
                        return rt;
385
383
                }
386
384
 
 
385
                static CustomMod [] CombineCustomMods (CustomMod [] original, CustomMod [] next)
 
386
                {
 
387
                        if (next == null || next.Length == 0)
 
388
                                return original;
 
389
 
 
390
                        CustomMod [] mods = new CustomMod [original.Length + next.Length];
 
391
                        Array.Copy (original, mods, original.Length);
 
392
                        Array.Copy (next, 0, mods, original.Length, next.Length);
 
393
                        return mods;
 
394
                }
 
395
 
387
396
                Param [] ReadParameters (int length, byte [] data, int pos, out int start)
388
397
                {
389
398
                        Param [] ret = new Param [length];
452
461
                        switch (element) {
453
462
                        case ElementType.ValueType :
454
463
                                VALUETYPE vt = new VALUETYPE ();
455
 
                                vt.Type = Utilities.GetMetadataToken(CodedIndex.TypeDefOrRef,
 
464
                                vt.Type = Utilities.GetMetadataToken (CodedIndex.TypeDefOrRef,
456
465
                                        (uint) Utilities.ReadCompressedInteger (data, start, out start));
457
466
                                return vt;
458
467
                        case ElementType.Class :
552
561
                        start = pos;
553
562
                        while (true) {
554
563
                                int buf = start;
 
564
                                if (buf >= data.Length - 1)
 
565
                                        break;
 
566
 
555
567
                                ElementType flag = (ElementType) Utilities.ReadCompressedInteger (data, start, out start);
556
568
                                start = buf;
557
569
                                if (!((flag == ElementType.CModOpt) || (flag == ElementType.CModReqD)))
601
613
                {
602
614
                        CustomAttrib ca = new CustomAttrib (ctor);
603
615
                        if (data.Length == 0) {
604
 
                                ca.FixedArgs = new CustomAttrib.FixedArg [0];
605
 
                                ca.NamedArgs = new CustomAttrib.NamedArg [0];
 
616
                                ca.FixedArgs = CustomAttrib.FixedArg.Empty;
 
617
                                ca.NamedArgs = CustomAttrib.NamedArg.Empty;
606
618
                                return ca;
607
619
                        }
608
620
 
612
624
                        if (ca.Prolog != CustomAttrib.StdProlog)
613
625
                                throw new MetadataFormatException ("Non standard prolog for custom attribute");
614
626
 
615
 
                        ca.FixedArgs = new CustomAttrib.FixedArg [ctor.Parameters.Count];
616
 
                        for (int i = 0; i < ca.FixedArgs.Length && read; i++)
617
 
                                ca.FixedArgs [i] = ReadFixedArg (data, br,
618
 
                                        ctor.Parameters [i].ParameterType, ref read, resolve);
 
627
                        if (ctor.HasParameters) {
 
628
                                ca.FixedArgs = new CustomAttrib.FixedArg [ctor.Parameters.Count];
 
629
                                for (int i = 0; i < ca.FixedArgs.Length && read; i++)
 
630
                                        ca.FixedArgs [i] = ReadFixedArg (data, br,
 
631
                                                ctor.Parameters [i].ParameterType, ref read, resolve);
 
632
                        } else {
 
633
                                ca.FixedArgs = CustomAttrib.FixedArg.Empty;
 
634
                        }
619
635
 
620
636
                        if (br.BaseStream.Position == br.BaseStream.Length)
621
637
                                read = false;
626
642
                        }
627
643
 
628
644
                        ca.NumNamed = br.ReadUInt16 ();
629
 
                        ca.NamedArgs = new CustomAttrib.NamedArg [ca.NumNamed];
630
 
                        for (int i = 0; i < ca.NumNamed && read; i++)
631
 
                                ca.NamedArgs [i] = ReadNamedArg (data, br, ref read, resolve);
 
645
                        if (ca.NumNamed > 0) {
 
646
                                ca.NamedArgs = new CustomAttrib.NamedArg [ca.NumNamed];
 
647
                                for (int i = 0; i < ca.NumNamed && read; i++)
 
648
                                        ca.NamedArgs [i] = ReadNamedArg (data, br, ref read, resolve);
 
649
                        } else {
 
650
                                ca.NamedArgs = CustomAttrib.NamedArg.Empty;
 
651
                        }
632
652
 
633
653
                        ca.Read = read;
634
654
                        return ca;
689
709
                        TypeReference decType = new TypeReference (name, ns, asm);
690
710
                        for (int i = 1; i < outers.Length; i++) {
691
711
                                TypeReference t = new TypeReference (outers [i], null, asm);
 
712
                                t.Module = m_reflectReader.Module;
692
713
                                t.DeclaringType = decType;
693
714
                                decType = t;
694
715
                        }
 
716
                        decType.Module = m_reflectReader.Module;
695
717
                        decType.IsValueType = true;
696
718
 
697
719
                        return decType;
845
867
 
846
868
                                AssemblyDefinition asm = AssemblyResolver.Resolve (
847
869
                                        ((AssemblyNameReference) enumType.Scope).FullName);
848
 
                                type = asm.MainModule.Types [enumType.FullName];
 
870
 
 
871
                                if (asm != null)
 
872
                                        type = asm.MainModule.Types [enumType.FullName];
849
873
                        }
850
874
 
851
875
                        if (type != null && type.IsEnum)