コード例 #1
0
ファイル: HeronVM.cs プロジェクト: catb0t/heron-language
        /// <summary>
        /// Convenience function for invoking a method on an object
        /// </summary>
        /// <param name="self"></param>
        /// <param name="s"></param>
        /// <param name="funcs"></param>
        /// <returns></returns>
        public HeronValue Invoke(HeronValue self, string s, HeronValue[] args)
        {
            HeronValue f = self.GetFieldOrMethod(s);
            HeronValue r = f.Apply(this, new HeronValue[] { });

            return(r);
        }
コード例 #2
0
        public override HeronValue Eval(VM vm)
        {
            HeronValue x = self.Eval(vm);

            if (x == null)
            {
                throw new Exception("Cannot select field '" + name + "' from a null object: " + self.ToString());
            }
            HeronValue r = x.GetFieldOrMethod(name);

            if (r == null)
            {
                throw new Exception("Could not resolve name " + name + " on expression '" + self.ToString() + "'");
            }
            return(r);
        }
コード例 #3
0
 public virtual HeronValue GetValue(HeronValue self)
 {
     return(self.GetFieldOrMethod(name));
 }