Ejemplo n.º 1
0
        internal static bool TryInvokeTernaryOperator(CodeContext context, object o, object arg1, object arg2, string name, out object value)
        {
            PerfTrack.NoteEvent(PerfTrack.Categories.Temporary, "TernaryOp " + CompilerHelpers.GetType(o).Name + " " + name);

            PythonTypeSlot pts;
            PythonType     pt = DynamicHelpers.GetPythonType(o);
            object         callable;

            if (pt.TryResolveMixedSlot(context, name, out pts) &&
                pts.TryGetValue(context, o, pt, out callable))
            {
                value = PythonCalls.Call(context, callable, arg1, arg2);
                return(true);
            }

            value = null;
            return(false);
        }