Exemplo n.º 1
0
        /// <summary>
        /// Initializes the feature precursor hierarchy.
        /// </summary>
        /// <param name="context">The initialization context.</param>
        public override void InitHierarchy(ICSharpContext context)
        {
            if (Instance.OriginalPrecursor.IsAssigned)
            {
                IPrecursorInstance Item             = Instance.OriginalPrecursor.Item;
                ICompiledFeature   PrecursorFeature = Item.Precursor.Feature;

                OriginalPrecursor = context.GetFeature(PrecursorFeature) as ICSharpIndexerFeature;
                Debug.Assert(OriginalPrecursor != null);
            }
        }
Exemplo n.º 2
0
        private bool FindSourceItemPrecursor(IClassType instancingClassType, IFeatureInstance featureInstance, IPrecursorInstance precursorInstance, ref ITypeName indexTypeName, ref ICompiledType indexType)
        {
            bool IsConformantToEnumerable = false;

            if (precursorInstance.Ancestor.BaseClass.ClassGuid == LanguageClasses.OverLoopSource.Guid)
            {
                if (precursorInstance.Precursor.Feature is IPropertyFeature AsPropertyAncestor)
                {
                    if (AsPropertyAncestor.ValidFeatureName.Item.Name == "Item")
                    {
                        if (featureInstance.Feature is IPropertyFeature AsPropertyFeature)
                        {
                            Debug.Assert(indexTypeName == null);
                            Debug.Assert(indexType == null);

                            ITypeName     IndexResultTypeName = AsPropertyFeature.ResolvedEntityTypeName.Item;
                            ICompiledType IndexResultType     = AsPropertyFeature.ResolvedEntityType.Item;

                            IndexResultType.InstanciateType(instancingClassType, ref IndexResultTypeName, ref IndexResultType);

                            IsConformantToEnumerable = true;
                            indexTypeName            = IndexResultTypeName;
                            indexType = IndexResultType;
                        }
                    }
                }
            }

            return(IsConformantToEnumerable);
        }