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 void AddType(Type type)
 {
     TypeSymbol symbol = new TypeSymbol(type);
     string name = symbol.Name;
     if (this.NestedSymbols == null)
     {
         this.NestedSymbols = new Dictionary<string, Symbol>();
     }
     Symbol symbol2 = null;
     if (this.NestedSymbols.TryGetValue(name, out symbol2))
     {
         OverloadedTypeSymbol symbol3 = symbol2 as OverloadedTypeSymbol;
         if (symbol3 == null)
         {
             TypeSymbol symbol4 = symbol2 as TypeSymbol;
             symbol3 = new OverloadedTypeSymbol(name, symbol, symbol4);
             this.NestedSymbols[name] = symbol3;
         }
         else
         {
             symbol3.AddLocalType(symbol);
         }
     }
     else
     {
         this.NestedSymbols.Add(name, symbol);
     }
 }
        internal void AddType(Type type)
        {
            TypeSymbol symbol = new TypeSymbol(type);
            string     name   = symbol.Name;

            if (this.NestedSymbols == null)
            {
                this.NestedSymbols = new Dictionary <string, Symbol>();
            }
            Symbol symbol2 = null;

            if (this.NestedSymbols.TryGetValue(name, out symbol2))
            {
                OverloadedTypeSymbol symbol3 = symbol2 as OverloadedTypeSymbol;
                if (symbol3 == null)
                {
                    TypeSymbol symbol4 = symbol2 as TypeSymbol;
                    symbol3 = new OverloadedTypeSymbol(name, symbol, symbol4);
                    this.NestedSymbols[name] = symbol3;
                }
                else
                {
                    symbol3.AddLocalType(symbol);
                }
            }
            else
            {
                this.NestedSymbols.Add(name, symbol);
            }
        }
Example #4
0
        internal void AddType(Type type)
        {
            TypeSymbol typeSym  = new TypeSymbol(type);
            string     typeName = typeSym.Name;

            if (NestedSymbols == null)
            {
                NestedSymbols = new Dictionary <string, Symbol>();
            }

            if (NestedSymbols.TryGetValue(typeName, out Symbol existingSymbol))
            {
                OverloadedTypeSymbol overloadSym = existingSymbol as OverloadedTypeSymbol;
                if (overloadSym == null)
                {
                    TypeSymbol typeSymbol = existingSymbol as TypeSymbol;
                    System.Diagnostics.Debug.Assert(typeSymbol != null);
                    overloadSym             = new OverloadedTypeSymbol(typeName, typeSym, typeSymbol);
                    NestedSymbols[typeName] = overloadSym;
                }
                else
                {
                    overloadSym.AddLocalType(typeSym);
                }
            }
            else
            {
                NestedSymbols.Add(typeName, typeSym);
            }
        }
        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 #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)
        {
            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 #8
0
        internal void AddType(Type type)
        {
            TypeSymbol typeSym = new TypeSymbol(type);
            string typeName = typeSym.Name;

            if (NestedSymbols == null)
                NestedSymbols = new Dictionary<string, Symbol>();

            Symbol existingSymbol = null;
            if (NestedSymbols.TryGetValue(typeName, out existingSymbol))
            {
                OverloadedTypeSymbol overloadSym = existingSymbol as OverloadedTypeSymbol;
                if (overloadSym == null)
                {
                    TypeSymbol typeSymbol = existingSymbol as TypeSymbol;
                    System.Diagnostics.Debug.Assert(typeSymbol != null);
                    overloadSym = new OverloadedTypeSymbol(typeName, typeSym, typeSymbol);
                    NestedSymbols[typeName] = overloadSym;
                }
                else
                {
                    overloadSym.AddLocalType(typeSym);
                }
            }
            else
            {
                NestedSymbols.Add(typeName, typeSym);
            }
        }