Esempio n. 1
0
 public CsInterface(int nameOffset, CsBody body, CsMember[] members, CsType[] types, CsBases bases, string constraints, string gargs, CsAttribute[] attrs, MemberModifiers modifiers, string name, int offset, int length, int line)
     : base(nameOffset, body, bases, members, types, attrs, modifiers, constraints, gargs, name, offset, length, line)
 {
 }
Esempio n. 2
0
        protected CsType(int nameOffset, CsBody body, CsBases bases, CsMember[] members, CsType[] types, CsAttribute[] attrs, MemberModifiers modifiers, string constraints, string gargs, string name, int offset, int length, int line)
            : base(body, types, offset, length, line)
        {
            Contract.Requires(members != null, "members is null");
            Contract.Requires(types != null, "types is null");
            Contract.Requires(attrs != null, "attrs is null");
            Contract.Requires(!string.IsNullOrEmpty(name), "name is null or empty");
            Contract.Requires(bases != null, "bases is null");
            Contract.Requires(nameOffset > offset, "nameOffsetis too small");
            Contract.Requires(nameOffset < offset + length, "nameOffsetis too large");

            Attributes = attrs;
            Modifiers = modifiers;
            Name = name;
            NameOffset = nameOffset;
            Constraints = constraints;
            Bases = bases;

            if (gargs != null)
                GenericArguments = gargs.TrimAll();

            Events = (from m in members let e = m as CsEvent where e != null select e).ToArray();
            Fields = (from m in members let e = m as CsField where e != null select e).ToArray();
            Indexers = (from m in members let e = m as CsIndexer where e != null select e).ToArray();
            Methods = (from m in members let e = m as CsMethod where e != null select e).ToArray();
            Operators = (from m in members let e = m as CsOperator where e != null select e).ToArray();
            Properties = (from m in members let e = m as CsProperty where e != null select e).ToArray();
            Contract.Assert(members.Length == Events.Length + Fields.Length + Indexers.Length + Methods.Length + Operators.Length + Properties.Length, "bad members length");

            Members = members;

            var decs = new List<CsDeclaration>();
            decs.AddRange(Events);
            decs.AddRange(Fields);
            decs.AddRange(Indexers);
            decs.AddRange(Methods);
            decs.AddRange(Operators);
            decs.AddRange(Properties);
            SetDeclarations(decs);

            foreach (CsMember m in members)
                m.DeclaringType = this;
            foreach (CsType t in types)
                t.DeclaringType = this;
        }