Beispiel #1
0
        /// <summary>
        /// Given a name returns the appropriate field (or method)
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public virtual HeronValue GetFieldOrMethod(string name)
        {
            HeronType          t = Type;
            ExposedMethodValue m = t.GetMethod(name);

            if (m != null)
            {
                return(m.CreateBoundMethod(this));
            }
            FieldDefn f = t.GetField(name);

            if (f != null)
            {
                return(f.GetValue(this));
            }
            return(null);
        }
Beispiel #2
0
        public override HeronValue GetFieldOrMethod(string name)
        {
            HeronValue v = type.GetField(name);

            if (v != null)
            {
                return(v);
            }

            ExposedMethodValue m = type.GetMethod(name);

            if (m != null)
            {
                return(m.CreateBoundMethod(null));
            }
            throw new Exception("The function '" + name + "' is not available on " + type.name);
        }