Esempio n. 1
0
        public static RCException Overload(RCClosure closure, string op, object right)
        {
            string message = string.Format(MONADIC_OVERLOAD_FORMAT,
                                           op,
                                           RCValue.TypeNameForType(right.GetType()));

            return(new RCException(closure, RCErrors.Type, message));
        }
Esempio n. 2
0
        public void Operators(RCRunner runner, RCClosure closure, RCBlock right)
        {
            RCCube result = new RCCube("S");

            result.ReserveColumn("module");
            result.ReserveColumn("name");
            result.ReserveColumn("method");
            result.ReserveColumn("left");
            result.ReserveColumn("right");
            foreach (KeyValuePair <RCActivator.OverloadKey,
                                   RCActivator.OverloadValue> kv in Activator._dispatch)
            {
                RCSymbolScalar sym;
                if (kv.Key.Left == null)
                {
                    sym = RCSymbolScalar.From("operator",
                                              kv.Value.Module.Name,
                                              kv.Key.Name,
                                              RCValue.TypeNameForType(kv.Key.Right));
                }
                else
                {
                    sym = RCSymbolScalar.From("operator",
                                              kv.Value.Module.Name,
                                              kv.Key.Name,
                                              RCValue.TypeNameForType(kv.Key.Left),
                                              RCValue.TypeNameForType(kv.Key.Right));
                }
                result.WriteCell("name", sym, kv.Key.Name);
                result.WriteCell("module", sym, kv.Value.Module.Name);
                result.WriteCell("method", sym, kv.Value.Implementation.Name);
                if (kv.Key.Left != null)
                {
                    result.WriteCell("left", sym, RCValue.TypeNameForType(kv.Key.Left));
                }
                result.WriteCell("right", sym, RCValue.TypeNameForType(kv.Key.Right));
                result.Axis.Write(sym);
            }
            runner.Yield(closure, result);
        }