Пример #1
0
        /// <summary>
        /// Adds a destination to this service active destinations. Negative index to append
        /// </summary>
        public void RegisterDestination(Destination dest, int atIdx = -1)
        {
            if (dest == null)
            {
                return;
            }

            lock (m_Destinations)
            {
                if (m_Destinations.Count == 0 || atIdx < 0 || atIdx > m_Destinations.Count)
                {
                    m_Destinations.Add(dest);
                }
                else
                {
                    m_Destinations.Insert(atIdx, dest);
                }
                dest.__setLogSvc(this);
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CSharpAssignmentInstruction"/> class.
        /// </summary>
        /// <param name="context">The creation context.</param>
        /// <param name="parentFeature">The parent feature.</param>
        /// <param name="source">The Easly instruction from which the C# instruction is created.</param>
        protected CSharpAssignmentInstruction(ICSharpContext context, ICSharpFeature parentFeature, IAssignmentInstruction source)
            : base(context, parentFeature, source)
        {
            SourceExpression = CSharpExpression.Create(context, (IExpression)Source.Source);

            foreach (IQualifiedName Destination in source.DestinationList)
            {
                ICompiledFeature SourceFeature = source.FinalFeatureTable[Destination];

                ICSharpFeature FinalFeature;

                if (SourceFeature is IScopeAttributeFeature AsScopeAttributeFeature)
                {
                    FinalFeature = CSharpScopeAttributeFeature.Create(null, AsScopeAttributeFeature);
                }
                else
                {
                    FinalFeature = context.GetFeature(SourceFeature);
                }

                ICSharpQualifiedName NewDestination = CSharpQualifiedName.Create(context, Destination, FinalFeature, null, false);
                DestinationList.Add(NewDestination);
            }
        }
Пример #3
0
 public void AddDestination(Address destination)
 {
     DestinationList.Add(destination);
 }