Esempio n. 1
0
        /// <summary>
        /// Get type of two
        /// </summary>
        /// <param name="second">Second type which compares</param>
        /// <returns>Main type</returns>
        private JType GetEitherType(JType second)
        {
            var sub = Either(this, second);

            if (Type == JTypeEnum.Array)
            {
                if (second.IsNull)
                {
                    return(this);
                }

                if (IsNull)
                {
                    return(second);
                }

                var locale = SubType.GetEitherType(second.SubType).GetEitherType(CreateNull());

                if (locale != SubType)
                {
                    return new JType {
                               Type = JTypeEnum.Array, SubType = locale
                    }
                }
                ;
            }
            if (Type == sub.Type)
            {
                return(this);
            }

            return(sub.GetEitherType(CreateNull()));
        }