public override HeronValue Eval(VM vm) { HeronValue[] argvals = args.Eval(vm); HeronValue f = funexpr.Eval(vm); return(f.Apply(vm, argvals)); }
/// <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); }
/// <summary> /// Evaluates the "Main()" function of a module instance /// </summary> /// <param name="m"></param> public void RunMain(ModuleInstance m) { HeronValue f = m.GetExportedFieldOrMethod("Main"); if (f == null) { throw new Exception("Could not find a 'Main' method to run"); } f.Apply(this, new HeronValue[] { }); }
/// <summary> /// Evaluates the "Meta()" function of a module instance. /// </summary> /// <param name="m"></param> public bool RunMeta(ModuleInstance m) { HeronValue f = m.GetFieldOrMethod("Meta"); if (f == null) { return(false); } f.Apply(this, new HeronValue[] { program }); return(true); }