/// <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 ICSharpPropertyFeature;
                Debug.Assert(OriginalPrecursor != null);
            }
        }
Beispiel #2
0
        private string CSharpTextProperty(ICSharpUsingCollection usingCollection, ICSharpPropertyFeature feature)
        {
            string Result;

            string BaseTypeText;

            if (BaseType != null)
            {
                BaseTypeText = EffectiveBaseType.Type2CSharpString(usingCollection, CSharpTypeFormats.AsInterface, CSharpNamespaceFormats.OneWord);
            }
            else
            {
                BaseTypeText = $"I{CSharpNames.ToCSharpIdentifier(Delegated.Owner.ValidClassName)}";
            }

            Result = $"({BaseTypeText} agentBase) => {{ return agentBase.{CSharpNames.ToCSharpIdentifier(Delegated.Name)}; }}";

            return(Result);
        }
        /// <summary>
        /// Checks if a property should declare a side-by-side private field of the same type due to inherited ancestors.
        /// </summary>
        /// <param name="globalFeatureTable">The table of all known features.</param>
        public void CheckInheritSideBySideAttribute(IDictionary <ICompiledFeature, ICSharpFeature> globalFeatureTable)
        {
            if (HasSideBySideAttribute)
            {
                foreach (IPrecursorInstance Item in Instance.PrecursorList)
                {
                    ICompiledFeature PrecursorFeature = Item.Precursor.Feature;

                    Debug.Assert(globalFeatureTable.ContainsKey(PrecursorFeature));
                    ICSharpPropertyFeature PrecursorPropertyFeature = globalFeatureTable[PrecursorFeature] as ICSharpPropertyFeature;
                    Debug.Assert(PrecursorPropertyFeature != null);

                    if (IsOverride && PrecursorPropertyFeature.HasSideBySideAttribute)
                    {
                        Instance.SetInheritBySideAttribute(true);
                        break;
                    }
                }
            }
        }