Exemplo n.º 1
0
        public override Expression.EvalResult Execute(MakeState s)
        {
            var f = include_file.Evaluate(s).strval;

            var saved_this = s.GetDefine("THIS");

            MakeState new_s = s.Clone();
            var       ret   = TymakeLib.ExecuteFile(f, new_s);

            s.SetDefine("THIS", saved_this, true);

            return(ret);
        }
Exemplo n.º 2
0
        public virtual Expression.EvalResult Run(MakeState s, List <Expression.EvalResult> passed_args)
        {
            MakeState new_s = s.Clone();

            new_s.PromoteLocalDefines();
            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;


                    var arg_types = new List <Expression.EvalResult.ResultType>();
                    foreach (var arg in fs.args)
                    {
                        arg_types.Add(arg.argtype);
                    }
                    var mangledname = FuncCall.Mangle(fs.name, arg_types);

                    /* var mangled_names = FuncCall.MangleAll(fs.name, arg_types, s);
                     *
                     * foreach(var mangledname in mangled_names) */
                    new_s.funcs[mangledname] = 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());
        }