예제 #1
0
 internal void visibility_helper(Frame caller, Access access, ArgList args)//author: Brian, status: done
 {
     secure_visibility(caller);
     if (args.Length == 0)
     {
         //scope_vmode = access;
         if (caller != null)
             caller.scope_vmode = access;
     }
     else
         set_method_visibility(caller, access, args.ToArray());
 }
예제 #2
0
        public override object Calln(Class last_class, object recv, Frame caller, ArgList args)
        {
            IO.NEXT_ARGF_FORWARD(caller);
            Array ary = new Array();

            String line;
            while ((line = IO.argf_getline(args.ToArray(), caller)) != null)
                //rb_ary_push.singleton.Call1(last_class, ary, caller, null, line);
                ary.Add(line);

            return ary;
        }
예제 #3
0
        public override object Calln(Class last_class, object recv, Frame caller, ArgList args)
        {
            object[] out_args;

            if (args.block != null)
            {
                out_args = new object[args.Length + 1];
                for (int i = 0; i < args.Length; i++)
                    out_args[i] = args[i];

                out_args[args.Length] = args.block;
            }
            else
            {
                out_args = args.ToArray();
            }

            MatchResult[] conversions;
            ParameterInfo[] parameters;
            MethodBase method = MatchArguments(out_args, out conversions, out parameters);

            if (method != null)
            {
                ConvertArguments(out_args, conversions, parameters);

                try
                {
                    if (!method.IsConstructor)
                        return method.Invoke(recv, out_args);
                    else
                        return ((ConstructorInfo)method).Invoke(out_args);
                }
                catch (System.Reflection.TargetInvocationException e)
                {
                    throw e.InnerException;
                }
            }
            else
            {
                throw new Exception(
                    string.Format("couldn't match arguments to ({0}:{1})",
                    this.methods[0].DeclaringType.FullName,
                    this.methods[0].Name)).raise(caller);
            }
        }
예제 #4
0
        public override object Calln(Class last_class, object recv, Frame caller, ArgList args)
        {
            if (!IO.next_argv(caller)) return null;

            String line;
            if (IO.current_file != null)
                line = (String)Eval.CallPrivate(IO.current_file, caller, "gets", null, args.ToArray());
            else
                line = IO.argf_getline(args.ToArray(), caller);
            Eval.rb_lastline_set(caller, line);
            return line;
        }