Example #1
0
 public override void Eval(Executor exec)
 {
     CatList fs = exec.TypedPop<CatList>();
     Object o = exec.Peek();
     for (int i = 0; i < fs.Count / 2; ++i)
     {
         Type t = fs[i * 2 + 1] as Type;
         Function f = fs[i * 2] as Function;
         if (t.IsInstanceOfType(o))
         {
             f.Eval(exec);
             return;
         }
     }
     throw new Exception("could not dispatch function");
 }
Example #2
0
 public override void Eval(Executor exec)
 {
     // TODO: fix this some day
     Object o = exec.Peek();
     if (o is CatList)
     {
         // HACK: this is not the correct type! 
         exec.Push(typeof(CatList));
     }
     else if (o is Function)
     {
         // HACK: this is not the correct type! 
         exec.Push((o as Function).GetFxnType());
     }
     else 
     {
         // HACK: this is not the correct type! 
         exec.Push(o.GetType());
     }
 }
Example #3
0
 public override void Eval(Executor exec)
 {
     Object self = exec.Peek();
     List<string> list = new List<string>();
     FieldInfo[] fis = self.GetType().GetFields();
     foreach (FieldInfo fi in fis)
         list.Add(fi.Name);
     string[] a = list.ToArray();
     exec.Push(new CatList(a));
 }