Пример #1
0
        public string GetReturnDocumentation(IPythonType self = null)
        {
            if (self != null)
            {
                var returnType = GetSpecificReturnType(self as IPythonClassType, null);
                if (!returnType.IsUnknown())
                {
                    return(returnType.GetPythonType().Name);
                }
            }

            // Use annotation value if it is there
            if (_fromAnnotation && !StaticReturnValue.IsUnknown())
            {
                return(StaticReturnValue.GetPythonType().Name);
            }

            return(_returnDocumentation);
        }
Пример #2
0
        internal void AddReturnValue(IMember value)
        {
            if (value.IsUnknown())
            {
                return; // Don't add useless values.
            }
            if (StaticReturnValue.IsUnknown())
            {
                SetReturnValue(value, false);
                return;
            }
            // If return value is set from annotation, it should not be changing.
            var currentType = StaticReturnValue.GetPythonType();
            var valueType   = value.GetPythonType();

            if (!_fromAnnotation && !currentType.Equals(valueType))
            {
                var type = PythonUnionType.Combine(currentType, valueType);
                // Track instance vs type info.
                StaticReturnValue = value is IPythonInstance ? new PythonInstance(type) : (IMember)type;
            }
        }