private static void InsertChildNoGrow(Symbol child)
        {
            switch (child.getKind())
            {
            case SYMKIND.SK_Scope:
            case SYMKIND.SK_LocalVariableSymbol:
                return;
            }

            RuntimeBinder.EnsureLockIsTaken();
            if (s_dictionary.TryGetValue(new Key(child.name, child.parent), out Symbol sym))
            {
                // Link onto the end of the symbol chain here.
                while (sym?.nextSameName != null)
                {
                    sym = sym.nextSameName;
                }

                Debug.Assert(sym != null && sym.nextSameName == null);
                sym.nextSameName = child;
            }
            else
            {
                s_dictionary.Add(new Key(child.name, child.parent), child);
            }
        }
Ejemplo n.º 2
0
        public static TypeArray Allocate(params CType[] types)
        {
            if (types?.Length > 0)
            {
                RuntimeBinder.EnsureLockIsTaken();
                TypeArrayKey key = new TypeArrayKey(types);
                if (!s_tableTypeArrays.TryGetValue(key, out TypeArray result))
                {
                    result = new TypeArray(types);
                    s_tableTypeArrays.Add(key, result);
                }

                return(result);
            }

            return(Empty);
        }
 public static Symbol LookupSym(Name name, ParentSymbol parent, symbmask_t kindmask)
 {
     RuntimeBinder.EnsureLockIsTaken();
     return(s_dictionary.TryGetValue(new Key(name, parent), out Symbol sym) ? FindCorrectKind(sym, kindmask) : null);
 }
 public static ParameterModifierType LookupParameterModifier(CType elementType, bool isOut)
 {
     RuntimeBinder.EnsureLockIsTaken();
     s_parameterModifierTable.TryGetValue(new KeyPair <CType, bool>(elementType, isOut), out ParameterModifierType result);
     return(result);
 }
 public static void InsertArray(CType elementType, int rankNum, ArrayType pArray)
 {
     RuntimeBinder.EnsureLockIsTaken();
     Debug.Assert(LookupArray(elementType, rankNum) == null);
     s_arrayTable.Add(new KeyPair <CType, int>(elementType, rankNum), pArray);
 }
 // rankNum is 0 for SZ arrays, equal to rank otherwise.
 public static ArrayType LookupArray(CType elementType, int rankNum)
 {
     RuntimeBinder.EnsureLockIsTaken();
     s_arrayTable.TryGetValue(new KeyPair <CType, int>(elementType, rankNum), out ArrayType result);
     return(result);
 }
 public static void InsertAggregate(AggregateSymbol aggregate, AggregateType outer, TypeArray args, AggregateType ats)
 {
     RuntimeBinder.EnsureLockIsTaken();
     Debug.Assert(LookupAggregate(aggregate, outer, args) == null);
     s_aggregateTable.Add(MakeKey(aggregate, MakeKey(outer, args)), ats);
 }
 public static AggregateType LookupAggregate(AggregateSymbol aggregate, AggregateType outer, TypeArray args)
 {
     RuntimeBinder.EnsureLockIsTaken();
     s_aggregateTable.TryGetValue(MakeKey(aggregate, MakeKey(outer, args)), out AggregateType result);
     return(result);
 }
 public static void InsertParameterModifier(CType elementType, bool isOut, ParameterModifierType parameterModifier)
 {
     RuntimeBinder.EnsureLockIsTaken();
     Debug.Assert(LookupParameterModifier(elementType, isOut) == null);
     s_parameterModifierTable.Add(new KeyPair <CType, bool>(elementType, isOut), parameterModifier);
 }