Ejemplo n.º 1
0
        public OptimizingCallDelegate/*!*/ AddWarning(OptimizingCallDelegate/*!*/ result) {
            if(_conditionDelegate != null) {
                return delegate(object[] callArgs, out bool shouldOptimize) { 
                    if (_conditionDelegate()) {
                        PythonOps.Warn((CodeContext)callArgs[0], _type, _message, ArrayUtils.EmptyObjects);
                    }
                    return result(callArgs, out shouldOptimize);
                };
            }

            return delegate(object[] callArgs, out bool shouldOptimize) { 
                PythonOps.Warn((CodeContext)callArgs[0], _type, _message, ArrayUtils.EmptyObjects);
                return result(callArgs, out shouldOptimize);
            };
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Wraps a call to a MethodInfo with profiling capture for that MethodInfo
        /// </summary>
        internal OptimizingCallDelegate AddProfiling(OptimizingCallDelegate /*!*/ callDelgate, MethodBase /*!*/ method)
        {
            if ((method is DynamicMethod) || IgnoreMethod(method))
            {
                return(callDelgate);
            }

            int profileIndex = GetProfilerIndex(method);

            return(delegate(object[] callArgs, out bool shouldOptimize) {
                long callStart = StartCall(profileIndex);
                try {
                    return callDelgate(callArgs, out shouldOptimize);
                } finally {
                    FinishCall(profileIndex, callStart);
                }
            });
        }
Ejemplo n.º 3
0
        public OptimizingCallDelegate /*!*/ AddWarning(OptimizingCallDelegate /*!*/ result)
        {
            if (_conditionDelegate != null)
            {
                return(delegate(object[] callArgs, out bool shouldOptimize) {
                    if (_conditionDelegate())
                    {
                        PythonOps.Warn((CodeContext)callArgs[0], _type, _message, ArrayUtils.EmptyObjects);
                    }
                    return result(callArgs, out shouldOptimize);
                });
            }

            return(delegate(object[] callArgs, out bool shouldOptimize) {
                PythonOps.Warn((CodeContext)callArgs[0], _type, _message, ArrayUtils.EmptyObjects);
                return result(callArgs, out shouldOptimize);
            });
        }