コード例 #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);
        }
コード例 #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);
        }
コード例 #3
0
 public BoundMethodValue(HeronValue self, ExposedMethodValue method)
 {
     this.self = self;
     this.method = method;
 }
コード例 #4
0
 public BoundMethodValue(HeronValue self, ExposedMethodValue method)
 {
     this.self   = self;
     this.method = method;
 }