Example #1
0
        internal override OverloadedTypeSymbol OverloadType(TypeSymbolBase newTypeSymBase)
        {
            List <TypeSymbol>    typeSymbols = new List <TypeSymbol>();
            TypeSymbol           item        = null;
            OverloadedTypeSymbol symbol2     = newTypeSymBase as OverloadedTypeSymbol;

            if (symbol2 != null)
            {
                typeSymbols.AddRange(symbol2.TypeSymbols);
            }
            else
            {
                item = newTypeSymBase as TypeSymbol;
                if (item != null)
                {
                    typeSymbols.Add(item);
                }
            }
            foreach (TypeSymbol symbol3 in this.TypeSymbols)
            {
                foreach (TypeSymbol symbol4 in typeSymbols)
                {
                    if (!symbol4.CanOverload(symbol3))
                    {
                        return(null);
                    }
                }
                typeSymbols.Add(symbol3);
            }
            return(new OverloadedTypeSymbol(this.name, typeSymbols));
        }
 internal override OverloadedTypeSymbol OverloadType(TypeSymbolBase newTypeSymBase)
 {
     List<TypeSymbol> typeSymbols = new List<TypeSymbol>();
     TypeSymbol item = null;
     OverloadedTypeSymbol symbol2 = newTypeSymBase as OverloadedTypeSymbol;
     if (symbol2 != null)
     {
         typeSymbols.AddRange(symbol2.TypeSymbols);
     }
     else
     {
         item = newTypeSymBase as TypeSymbol;
         if (item != null)
         {
             typeSymbols.Add(item);
         }
     }
     foreach (TypeSymbol symbol3 in this.TypeSymbols)
     {
         foreach (TypeSymbol symbol4 in typeSymbols)
         {
             if (!symbol4.CanOverload(symbol3))
             {
                 return null;
             }
         }
         typeSymbols.Add(symbol3);
     }
     return new OverloadedTypeSymbol(this.name, typeSymbols);
 }
 internal override OverloadedTypeSymbol OverloadType(TypeSymbolBase newTypeSymBase)
 {
     OverloadedTypeSymbol symbol = newTypeSymBase as OverloadedTypeSymbol;
     if (symbol != null)
     {
         return symbol.OverloadType(this);
     }
     TypeSymbol typeSym = newTypeSymBase as TypeSymbol;
     if ((typeSym != null) && this.CanOverload(typeSym))
     {
         return new OverloadedTypeSymbol(this.name, this, typeSym);
     }
     return null;
 }
        internal override OverloadedTypeSymbol OverloadType(TypeSymbolBase newTypeSymBase)
        {
            OverloadedTypeSymbol symbol = newTypeSymBase as OverloadedTypeSymbol;

            if (symbol != null)
            {
                return(symbol.OverloadType(this));
            }
            TypeSymbol typeSym = newTypeSymBase as TypeSymbol;

            if ((typeSym != null) && this.CanOverload(typeSym))
            {
                return(new OverloadedTypeSymbol(this.name, this, typeSym));
            }
            return(null);
        }
Example #5
0
        internal override OverloadedTypeSymbol OverloadType(TypeSymbolBase newTypeSymBase)
        {
            if (newTypeSymBase is OverloadedTypeSymbol newTypeOverload)
            {
                // We've encountered an overloaded type symbol over a previous simple
                // type symbol.
                return(newTypeOverload.OverloadType(this));
            }
            else
            {
                // We've encountered two simple types... just create an overload for them if
                // possible.
                if (newTypeSymBase is TypeSymbol newTypeSym && this.CanOverload(newTypeSym))
                {
                    return(new OverloadedTypeSymbol(name, this, newTypeSym));
                }
            }

            return(null);
        }
Example #6
0
        internal override OverloadedTypeSymbol OverloadType(TypeSymbolBase newTypeSymBase)
        {
            List <TypeSymbol> newOverloads = new List <TypeSymbol>();
            TypeSymbol        typeSym      = null;

            OverloadedTypeSymbol newTypeOverload = newTypeSymBase as OverloadedTypeSymbol;

            if (newTypeOverload != null)
            {
                newOverloads.AddRange(newTypeOverload.TypeSymbols);
            }
            else
            {
                // We've encountered a simple type... just create an overload for them if
                // possible.
                typeSym = newTypeSymBase as TypeSymbol;
                if (typeSym != null)
                {
                    newOverloads.Add(typeSym);
                }
            }

            // If every item in this overloaded type symbol is overloadable with the new one,
            // add to the new list all our items.
            foreach (TypeSymbol thisTypeSym in this.TypeSymbols)
            {
                foreach (TypeSymbol newTypeSym in newOverloads)
                {
                    if (!newTypeSym.CanOverload(thisTypeSym))
                    {
                        return(null); // Can't overload
                    }
                }

                newOverloads.Add(thisTypeSym);
            }

            return(new OverloadedTypeSymbol(name, newOverloads));
        }
Example #7
0
        internal override OverloadedTypeSymbol OverloadType(TypeSymbolBase newTypeSymBase)
        {
            List<TypeSymbol> newOverloads = new List<TypeSymbol>();
            TypeSymbol typeSym = null;

            OverloadedTypeSymbol newTypeOverload = newTypeSymBase as OverloadedTypeSymbol;
            if (newTypeOverload != null)
            {
                newOverloads.AddRange(newTypeOverload.TypeSymbols);
            }
            else
            {
                // We've encountered a simple type... just create an overload for them if
                // possible.
                typeSym = newTypeSymBase as TypeSymbol;
                if (typeSym != null)
                    newOverloads.Add(typeSym);
            }

            // If every item in this overloaded type symbol is overloadable with the new one,
            // add to the new list all our items.
            foreach (TypeSymbol thisTypeSym in this.TypeSymbols)
            {
                foreach (TypeSymbol newTypeSym in newOverloads)
                {
                    if (!newTypeSym.CanOverload(thisTypeSym))
                        return null; // Can't overload
                }

                newOverloads.Add(thisTypeSym);
            }

            return new OverloadedTypeSymbol(name, newOverloads);
        }
Example #8
0
        internal override OverloadedTypeSymbol OverloadType(TypeSymbolBase newTypeSymBase)
        {
            OverloadedTypeSymbol newTypeOverload = newTypeSymBase as OverloadedTypeSymbol;
            if (newTypeOverload != null)
            {
                // We've encountered an overloaded type symbol over a previous simple
                // type symbol.
                return newTypeOverload.OverloadType(this);
            }
            else
            {
                // We've encountered two simple types... just create an overload for them if
                // possible.
                TypeSymbol newTypeSym = newTypeSymBase as TypeSymbol;
                if (newTypeSym != null && this.CanOverload(newTypeSym))
                    return new OverloadedTypeSymbol(name, this, newTypeSym);
            }

            return null;
        }
Example #9
0
 internal abstract OverloadedTypeSymbol OverloadType(TypeSymbolBase typeSymBase);
Example #10
0
 internal abstract OverloadedTypeSymbol OverloadType(TypeSymbolBase typeSymBase);