Ejemplo n.º 1
0
 static void AppendFields(StringBuilder sb, HeronType t)
 {
     sb.AppendLine("  fields");
     sb.AppendLine("  {");
     foreach (ExposedField f in t.GetExposedFields())
     {
         sb.AppendLine("    " + f.ToString() + ";");
     }
     sb.AppendLine("  }");
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Iterates over 'HeronVisible' labeled exposedFields and values
        /// of the target object and exposes them.
        /// </summary>
        private void StoreExposedFunctionsAndFields()
        {
            if (type == null)
            {
                return;
            }
            if (!typeof(HeronValue).IsAssignableFrom(type))
            {
                return;
            }

            foreach (MethodInfo mi in type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public))
            {
                object[] attrs = mi.GetCustomAttributes(typeof(HeronVisible), true);
                if (attrs.Length > 0)
                {
                    StoreExposedFunction(mi);
                }
            }

            foreach (FieldInfo fi in type.GetFields(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public))
            {
                object[] attrs = fi.GetCustomAttributes(typeof(HeronVisible), true);
                if (attrs.Length > 0)
                {
                    StoreExposedField(fi);
                }
            }

            // Add the exposed fields and methods from the base class
            if (baseType != null)
            {
                foreach (ExposedField xf in baseType.GetExposedFields())
                {
                    if (!exposedFields.ContainsKey(xf.name))
                    {
                        exposedFields.Add(xf.name, xf);
                    }
                }

                foreach (ExposedMethodValue xmv in baseType.GetExposedMethods())
                {
                    if (!exposedMethods.ContainsKey(xmv.Name))
                    {
                        exposedMethods.Add(xmv.Name, xmv);
                    }
                }
            }
        }
Ejemplo n.º 3
0
 static void AppendFields(StringBuilder sb, HeronType t)
 {
     sb.AppendLine("  fields");
     sb.AppendLine("  {");
     foreach (ExposedField f in t.GetExposedFields())
         sb.AppendLine("    " + f.ToString() + ";");             
     sb.AppendLine("  }");
 }