/// <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); }
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); }
public virtual HeronValue GetValue(HeronValue self) { return(self.GetFieldOrMethod(name)); }