public override object Call(Class last_class, object self, Frame caller, Proc block, object src, Array args) { string file = "eval"; int line = 1; object scope = null; object vfile = null; object vline = null; if (args.Count > 0) { scope = args[0]; if (args.Count > 1) { vfile = args[1]; file = ((String)vfile).value; if (args.Count > 2) { vline = args[2]; line = (int)vline; } } } if (scope == null) scope = new Binding(caller, self); if (!(scope is IContext)) throw new TypeError(string.Format(CultureInfo.InvariantCulture, "wrong argument type {0} (expected Proc/Binding)", scope.GetType())).raise(caller); return Eval.eval(self, (String)src, (IContext)scope, file, line, caller); }
internal static object specific_eval(Class last_class, object self, Class ruby_class, Frame caller, Proc block, Array args) //author: Brian, status: partial { if (block != null) { ArgList argList = new ArgList(); argList.AddArray(args, caller); return block.yield_under(caller, argList, ruby_class, self); } else { string file = "eval"; int line = 1; object scope = null; object vfile = null; object vline = null; String src = null; if (args.Count > 0) { src = (String)(args[0]); if (args.Count > 1) { vfile = args[1]; file = ((String)vfile).value; if (args.Count > 2) { vline = args[2]; line = (int)vline; } } } scope = new Binding(caller, self); if (!(scope is IContext)) throw new TypeError(string.Format(CultureInfo.InvariantCulture, "wrong argument type {0} (expected Proc/Binding)", scope.GetType())).raise(caller); object ret = Eval.eval_under(ruby_class, self, (String)src, (IContext)scope, file, line, caller); return ret; } }
public override object Call0(Class last_class, object recv, Frame caller, Proc block) { Binding binding = new Binding(caller, recv); return binding; }