Пример #1
0
        public override HeronValue Eval(VM vm)
        {
            HeronValue[] argvals = args.Eval(vm);
            HeronValue   f       = funexpr.Eval(vm);

            return(f.Apply(vm, argvals));
        }
Пример #2
0
        /// <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);
        }
Пример #3
0
        /// <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[] { });
        }
Пример #4
0
        /// <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);
        }