internal DynamicReferenceInstance(IReferenceInstance refInstance) : base((IValueSymbol)refInstance)
        {
            this.normalizedDict = new Dictionary <string, ISymbol>(StringComparer.OrdinalIgnoreCase);
            IReferenceType  dataType = (IReferenceType)refInstance.DataType;
            IResolvableType type2    = (IResolvableType)dataType;

            this.resolvedReferenceType = (type2 == null) ? dataType : type2.ResolveType(DataTypeResolveStrategy.AliasReference);
            if (this.resolvedReferenceType.Category == DataTypeCategory.Struct)
            {
                ReadOnlySymbolCollection subSymbols = ((IReferenceInstanceAccess)refInstance).SubSymbols;
                this.normalizedDict = DynamicStructInstance.createMemberDictionary(false, subSymbols);
            }
        }
Beispiel #2
0
        internal static Dictionary <string, ISymbol> createMemberDictionary(bool allowIGIOAccess, ReadOnlySymbolCollection memberInstances)
        {
            Dictionary <string, ISymbol> dictionary = new Dictionary <string, ISymbol>(StringComparer.OrdinalIgnoreCase);
            List <string> list = new List <string>();

            if (allowIGIOAccess)
            {
                list.Add("IndexGroup");
                list.Add("IndexOffset");
            }
            list.Add(DynamicPointerValue.s_pointerDeref);
            foreach (DynamicSymbol symbol in memberInstances)
            {
                string normalizedName = symbol.NormalizedName;
                if (Enumerable.Contains <string>(list, normalizedName, StringComparer.OrdinalIgnoreCase))
                {
                    normalizedName = normalizedName.Insert(0, "_");
                }
                dictionary.Add(normalizedName, symbol);
            }
            return(dictionary);
        }