コード例 #1
0
 protected internal void SetExitTypeDescriptor(TypeDescriptor descriptor)
 {
     // If this property or field access would return a primitive - and yet
     // it is also marked null safe - then the exit type descriptor must be
     // promoted to the box type to allow a null value to be passed on
     if (_nullSafe && CodeFlow.IsValueType(descriptor))
     {
         _originalPrimitiveExitTypeDescriptor = descriptor;
         _exitTypeDescriptor = CodeFlow.ToBoxedDescriptor(descriptor);
     }
     else
     {
         _exitTypeDescriptor = descriptor;
     }
 }
コード例 #2
0
        private void UpdateExitTypeDescriptor(object result)
        {
            var executorToCheck = _cachedExecutor;

            if (executorToCheck != null && executorToCheck.Get() is ReflectiveMethodExecutor executor)
            {
                var method     = executor.Method;
                var descriptor = ComputeExitDescriptor(result, method.ReturnType);
                if (_nullSafe && CodeFlow.IsValueType(descriptor))
                {
                    _originalPrimitiveExitTypeDescriptor = descriptor;
                    _exitTypeDescriptor = CodeFlow.ToBoxedDescriptor(descriptor);
                }
                else
                {
                    _exitTypeDescriptor = descriptor;
                }
            }
        }
コード例 #3
0
        private void UpdateExitTypeDescriptor()
        {
            var executorToCheck = _cachedExecutor;

            if (executorToCheck != null && executorToCheck.Get() is ReflectiveMethodExecutor)
            {
                var method     = ((ReflectiveMethodExecutor)executorToCheck.Get()).Method;
                var descriptor = CodeFlow.ToDescriptor(method.ReturnType);
                if (_nullSafe && CodeFlow.IsPrimitive(descriptor))
                {
                    _originalPrimitiveExitTypeDescriptor = descriptor;
                    _exitTypeDescriptor = CodeFlow.ToBoxedDescriptor(descriptor);
                }
                else
                {
                    _exitTypeDescriptor = descriptor;
                }
            }
        }