Example #1
0
        public virtual Expression.EvalResult Run(MakeState s, List <Expression.EvalResult> passed_args)
        {
            MakeState new_s = s.Clone();

            new_s.ClearLocalDefines();

            for (int i = 0; i < args.Count; i++)
            {
                if (args[i].argtype == Expression.EvalResult.ResultType.Function)
                {
                    FunctionStatement fs = new FunctionStatement();
                    var ofs = passed_args[i].funcval;
                    fs.name = args[i].name;
                    fs.args = ofs.args;
                    fs.code = ofs.code;

                    new_s.funcs[fs.Mangle()] = fs;
                }
                else
                {
                    new_s.SetLocalDefine(args[i].name, passed_args[i]);
                }
            }

            code.Execute(new_s);
            if (new_s.returns != null)
            {
                return(new_s.returns);
            }

            return(new Expression.EvalResult());
        }
Example #2
0
        public override Expression.EvalResult Execute(MakeState s)
        {
            var f = include_file.Evaluate(s).strval;

            MakeState new_s = s.Clone();

            return(Program.ExecuteFile(f, new_s));
        }