UpdateTypeEntity() public static method

public static UpdateTypeEntity ( TypeTracker existingTypeEntity, TypeTracker newType ) : TypeTracker
existingTypeEntity TypeTracker The merged list so far. Could be null
newType TypeTracker The new type(s) to add to the merged list
return TypeTracker
コード例 #1
0
            internal MemberTracker UpdateTypeEntity(TypeTracker existingTypeEntity, string normalizedTypeName)
            {
                Debug.Assert(normalizedTypeName.IndexOf('.') == -1); // This is the simple name, not the full name
                Debug.Assert(ReflectionUtils.GetNormalizedTypeName(normalizedTypeName) == normalizedTypeName);

                // Look for a non-generic type
                if (_simpleTypeNames.Contains(normalizedTypeName))
                {
                    Type newType = LoadType(_assembly, GetFullChildName(normalizedTypeName));
                    if (newType != null)
                    {
                        existingTypeEntity = TypeGroup.UpdateTypeEntity(existingTypeEntity, TypeTracker.GetTypeTracker(newType));
                    }
                }

                // Look for generic types
                if (_genericTypeNames.ContainsKey(normalizedTypeName))
                {
                    List <string> actualNames = _genericTypeNames[normalizedTypeName];
                    foreach (string actualName in actualNames)
                    {
                        Type newType = LoadType(_assembly, GetFullChildName(actualName));
                        if (newType != null)
                        {
                            existingTypeEntity = TypeGroup.UpdateTypeEntity(existingTypeEntity, TypeTracker.GetTypeTracker(newType));
                        }
                    }
                }

                return(existingTypeEntity);
            }
コード例 #2
0
        internal void AddTypeName(string typeName, Assembly assem)
        {
            // lock is held when this is called
            Assert.NotNull(typeName, assem);
            Debug.Assert(typeName.IndexOf(Type.Delimiter) == -1); // This is the simple name, not the full name

            if (!_typeNames.ContainsKey(assem))
            {
                _typeNames[assem] = new TypeNames(assem, _fullName);
            }
            _typeNames[assem].AddTypeName(typeName);

            string normalizedTypeName = ReflectionUtils.GetNormalizedTypeName(typeName);

            if (_dict.ContainsKey(normalizedTypeName))
            {
                // A similarly named type, namespace, or module already exists.
                Type newType = LoadType(assem, GetFullChildName(typeName));

                object      existingValue      = _dict[normalizedTypeName];
                TypeTracker existingTypeEntity = existingValue as TypeTracker;
                if (existingTypeEntity == null)
                {
                    // Replace the existing namespace or module with the new type
                    Debug.Assert(existingValue is NamespaceTracker);
                    _dict[normalizedTypeName] = MemberTracker.FromMemberInfo(newType);
                }
                else
                {
                    // Unify the new type with the existing type
                    _dict[normalizedTypeName] = TypeGroup.UpdateTypeEntity(existingTypeEntity, ReflectionCache.GetTypeTracker(newType));
                }
                return;
            }
        }
コード例 #3
0
        private void MakeTypeBody(GetMemberInfo getMemInfo, Type instanceType, MemberGroup members)
        {
            TypeTracker typeTracker = (TypeTracker)members[0];

            for (int i = 1; i < members.Count; i++)
            {
                typeTracker = TypeGroup.UpdateTypeEntity(typeTracker, (TypeTracker)members[i]);
            }

            getMemInfo.Body.FinishCondition(typeTracker.GetValue(getMemInfo.ResolutionFactory, this, instanceType));
        }
コード例 #4
0
        private void MakeTypeBody(Type type, MemberGroup members)
        {
            TypeTracker typeTracker = (TypeTracker)members[0];

            for (int i = 1; i < members.Count; i++)
            {
                typeTracker = TypeGroup.UpdateTypeEntity(typeTracker, (TypeTracker)members[i]);
            }

            AddToBody(Rule.MakeReturn(Binder, typeTracker.GetValue(Binder, type)));
        }