Facets manages facet meta-data as a string:Obj map.
Esempio n. 1
0
File: Slot.cs Progetto: xored/f4
 //////////////////////////////////////////////////////////////////////////
 // Constructor
 //////////////////////////////////////////////////////////////////////////
 public Slot(Type parent, string name, int flags, Facets facets, int lineNum)
 {
     this.m_parent  = parent;
       this.m_name    = name;
       this.m_qname   = parent == null ? name : parent.qname() + "." + name;
       this.m_flags   = flags;
       this.m_facets  = facets;
       this.m_lineNum = lineNum;
 }
Esempio n. 2
0
        /// <summary>
        /// Constructor used by GenericType and we are given the generic
        /// method that is being parameterized.
        /// </summary>
        public Method(Type parent, string name, int flags, Facets facets, int lineNum, Type returns, Type inheritedReturns, List pars, Method generic)
            : base(parent, name, flags, facets, lineNum)
        {
            List fparams = pars.ro();
              if ((flags & (FConst.Static|FConst.Ctor)) == 0)
              {
            object[] temp = new object[pars.sz()+1];
            temp[0] = new Param("this", parent, 0);
            pars.copyInto(temp, 1, pars.sz());
            fparams = new List(Sys.ParamType, temp);
              }

              this.m_func = new MethodFunc(this, returns, fparams);
              this.m_params = pars;
              this.m_inheritedReturns = inheritedReturns;
              this.m_mask = (generic != null) ? 0 : toMask(parent, returns, pars);
              this.m_generic = generic;
        }
Esempio n. 3
0
File: Field.cs Progetto: nomit007/f4
 //////////////////////////////////////////////////////////////////////////
 // C# Constructors
 //////////////////////////////////////////////////////////////////////////
 public Field(Type parent, string name, int flags, Facets facets, int lineNum, Type type)
     : base(parent, name, flags, facets, lineNum)
 {
     this.m_type = type;
 }
Esempio n. 4
0
 // parameterized type constructor
 public ClassType(Pod pod, string name, int flags, Facets facets)
 {
     this.m_pod      = pod;
       this.m_name     = name;
       this.m_qname    = pod.m_name + "::" + name;
       this.m_nullable = new NullableType(this);
       this.m_flags    = flags;
       this.m_facets   = facets;
 }
Esempio n. 5
0
        private void doReflect()
        {
            // if the ftype is non-null, that means it was passed in non-hollow
              // ftype (in-memory compile), otherwise we need to read it from the pod
              if (m_ftype.m_hollow)
              {
            try
            {
              m_ftype.read();
            }
            catch (IOException e)
            {
              Err.dumpStack(e);
              throw IOErr.make("Cannot read " + m_qname + " from pod", e).val;
            }
              }

              // these are working accumulators used to build the
              // data structures of my defined and inherited slots
              List slots  = new List(Sys.SlotType, 64);
              Hashtable nameToSlot  = new Hashtable();   // String -> Slot
              Hashtable nameToIndex = new Hashtable();   // String -> Long

              // merge in base class and mixin classes
              for (int i=0; i<m_mixins.sz(); i++) merge((Type)m_mixins.get(i), slots, nameToSlot, nameToIndex);
              merge(m_base, slots, nameToSlot, nameToIndex);

              // merge in all my slots
              FPod fpod   = this.m_pod.fpod;
              FType ftype = this.m_ftype;
              for (int i=0; i<ftype.m_fields.Length; i++)
              {
            Field f = map(fpod, ftype.m_fields[i]);
            merge(f, slots, nameToSlot, nameToIndex);
              }
              for (int i=0; i<ftype.m_methods.Length; i++)
              {
            Method m = map(fpod, ftype.m_methods[i]);
            merge(m, slots, nameToSlot, nameToIndex);
              }

              // break out into fields and methods
              List fields  = new List(Sys.FieldType,  slots.sz());
              List methods = new List(Sys.MethodType, slots.sz());
              for (int i=0; i<slots.sz(); i++)
              {
            Slot slot = (Slot)slots.get(i);
            if (slot is Field)
              fields.add(slot);
            else
              methods.add(slot);
              }
              this.m_slots       = slots.trim();
              this.m_fields      = fields.trim();
              this.m_methods     = methods.trim();
              this.m_slotsByName = nameToSlot;
              this.m_facets      = Facets.mapFacets(m_pod, ftype.m_attrs.m_facets);

              // facets
              this.m_lineNum    = m_ftype.m_attrs.m_lineNum;
              this.m_sourceFile = m_ftype.m_attrs.m_sourceFile;
        }
Esempio n. 6
0
 public static Facets empty()
 {
     Facets e = m_empty;
       if (e != null) return e;
       return m_empty = new Facets(new Hashtable());
 }
Esempio n. 7
0
        //////////////////////////////////////////////////////////////////////////
        // C# Constructors
        //////////////////////////////////////////////////////////////////////////

        public Field(Type parent, string name, int flags, Facets facets, int lineNum, Type type)
            : base(parent, name, flags, facets, lineNum)
        {
            this.m_type = type;
        }
Esempio n. 8
0
        //////////////////////////////////////////////////////////////////////////
        // C# Constructor
        //////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Constructor used by Type.reflect.
        /// </summary>
        public Method(Type parent, string name, int flags, Facets facets, int lineNum, Type returns, Type inheritedReturns, List pars)
            : this(parent, name, flags, facets, lineNum, returns, inheritedReturns, pars, null)
        {
        }
Esempio n. 9
0
        private void doReflect()
        {
            // if the ftype is non-null, that means it was passed in non-hollow
            // ftype (in-memory compile), otherwise we need to read it from the pod
            if (m_ftype.m_hollow)
            {
                try
                {
                    m_ftype.read();
                }
                catch (IOException e)
                {
                    Err.dumpStack(e);
                    throw IOErr.make("Cannot read " + m_qname + " from pod", e).val;
                }
            }

            // these are working accumulators used to build the
            // data structures of my defined and inherited slots
            List      slots       = new List(Sys.SlotType, 64);
            Hashtable nameToSlot  = new Hashtable(); // String -> Slot
            Hashtable nameToIndex = new Hashtable(); // String -> Long

            // merge in base class and mixin classes
            for (int i = 0; i < m_mixins.sz(); i++)
            {
                merge((Type)m_mixins.get(i), slots, nameToSlot, nameToIndex);
            }
            merge(m_base, slots, nameToSlot, nameToIndex);

            // merge in all my slots
            FPod  fpod  = this.m_pod.fpod;
            FType ftype = this.m_ftype;

            for (int i = 0; i < ftype.m_fields.Length; i++)
            {
                Field f = map(fpod, ftype.m_fields[i]);
                merge(f, slots, nameToSlot, nameToIndex);
            }
            for (int i = 0; i < ftype.m_methods.Length; i++)
            {
                Method m = map(fpod, ftype.m_methods[i]);
                merge(m, slots, nameToSlot, nameToIndex);
            }

            // break out into fields and methods
            List fields  = new List(Sys.FieldType, slots.sz());
            List methods = new List(Sys.MethodType, slots.sz());

            for (int i = 0; i < slots.sz(); i++)
            {
                Slot slot = (Slot)slots.get(i);
                if (slot is Field)
                {
                    fields.add(slot);
                }
                else
                {
                    methods.add(slot);
                }
            }
            this.m_slots       = slots.trim();
            this.m_fields      = fields.trim();
            this.m_methods     = methods.trim();
            this.m_slotsByName = nameToSlot;
            this.m_facets      = Facets.mapFacets(m_pod, ftype.m_attrs.m_facets);

            // facets
            this.m_lineNum    = m_ftype.m_attrs.m_lineNum;
            this.m_sourceFile = m_ftype.m_attrs.m_sourceFile;
        }
Esempio n. 10
0
 //////////////////////////////////////////////////////////////////////////
 // C# Constructor
 //////////////////////////////////////////////////////////////////////////
 /// <summary>
 /// Constructor used by Type.reflect.
 /// </summary>
 public Method(Type parent, string name, int flags, Facets facets, int lineNum, Type returns, Type inheritedReturns, List pars)
     : this(parent, name, flags, facets, lineNum, returns, inheritedReturns, pars, null)
 {
 }