コード例 #1
0
 public ManagedHost()
 {
     Main = this;
     PushScope(new CodeScope("MainScope"));
     SystemScope = Scopes.ToArray()[0];
     RegisterOSFuncs();
     //RegGlobalFuncs();
 }
コード例 #2
0
 public static void PushScope(CodeScope scope)
 {
     if (Main.Scopes.Count != 0)
     {
         scope.OutterScope = Main.Scopes.Peek();
     }
     else
     {
         scope.OutterScope = null;
     }
     Main.Scopes.Push(scope);
 }
コード例 #3
0
        public dynamic ExecuteMethod(StructModule cls, string func, dynamic[] pars)
        {
            foreach (var f in cls.Methods)
            {
                if (f.FuncName == func)
                {
                    if (pars != null)
                    {
                        if (f.Pars.Pars.Count != pars.Length)
                        {
                            continue;
                        }
                    }
                    else
                    {
                        if (f.Pars != null)
                        {
                            if (f.Pars.Pars.Count != 0)
                            {
                                continue;
                            }
                        }
                    }
                    int ii = 0;
                    var ns = new CodeScope("func_pars");

                    if (pars != null)
                    {
                        foreach (var p in pars)
                        {
                            var rp = f.Pars.Pars[ii];

                            ns.RegisterVar(rp);
                            rp.Value = p;
                            ii++;
                        }
                    }
                    PushScope(SystemScope);
                    PushScope(cls.InstanceScope);
                    PushScope(ns);
                    return(f.Code.Exec());

                    PopScope();
                    PopScope();
                    PopScope();
                    return(null);
                }
            }
            return(null);
        }
コード例 #4
0
 public void Combine(CodeScope scope)
 {
     foreach (var locv in scope.LocalVars)
     {
     }
 }