Exemplo n.º 1
0
        /// <summary>
        /// Constructs a new DottedIdentifier
        /// </summary>
        /// <param name="table">Identifier table that will store this identifier.</param>
        /// <param name="prefix">The prefix of the identifier</param>
        /// <param name="tail">The tail of the identifier</param>
        public DottedIdentifier(SymbolTable table, IEnumerable <string> prefix, DottedIdentifier tail)
        {
            Contract.RequiresNotNull(table);
            Contract.RequiresNotNull(prefix);

            // we'll need this argument in the future so prevent warnings until then.
            Analysis.IgnoreArgument(table);

            DottedIdentifier current = null;

            foreach (var s in prefix)
            {
                if (current == null)
                {
                    // head node
                    Head    = SymbolAtom.Create(table.StringTable, (StringSegment)s);
                    current = this;
                }
                else
                {
                    // extend the tail
                    current.m_tail = new DottedIdentifier(table, s);
                    current        = current.m_tail;
                }
            }

            Contract.AssertNotNull(current, "Must have at least one element in the prefix enumeration");
            current.m_tail = tail;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Constructs a new DottedIdentifier
        /// </summary>
        /// <param name="table">Identifier table that will store this identifier.</param>
        /// <param name="components">The components of the identifier</param>
        public DottedIdentifier(SymbolTable table, IEnumerable <SymbolAtom> components)
        {
            Contract.RequiresNotNull(table);
            Contract.RequiresNotNull(components);

            // we'll need this argument in the future so prevent warnings until then.
            Analysis.IgnoreArgument(table);

            DottedIdentifier current = null;

            foreach (var s in components)
            {
                if (current == null)
                {
                    // head node
                    Head    = s;
                    current = this;
                }
                else
                {
                    // extend the tail
                    current.m_tail = new DottedIdentifier(s);
                    current        = current.m_tail;
                }
            }

            Contract.AssertNotNull(current, "Must have at least one element in the components enumeration");
        }
        /// <summary>
        /// Constructs a new DottedIdentifier
        /// </summary>
        /// <param name="table">Identifier table that will store this identifier.</param>
        /// <param name="prefix">The prefix of the identifier</param>
        /// <param name="tail">The tail of the identifier</param>
        public DottedIdentifier(SymbolTable table, IEnumerable <SymbolAtom> prefix, DottedIdentifier tail)
        {
            Contract.Requires(table != null);
            Contract.Requires(prefix != null);

            // we'll need this argument in the future so prevent warnings until then.
            Analysis.IgnoreArgument(table);

            DottedIdentifier current = null;

            foreach (var s in prefix)
            {
                if (current == null)
                {
                    // head node
                    Head    = s;
                    current = this;
                }
                else
                {
                    // extend the tail
                    current.m_tail = new DottedIdentifier(s);
                    current        = current.m_tail;
                }
            }

            Contract.Assume(current != null, "Must have at least one element in the prefix enumeration");
            current.m_tail = tail;
        }
Exemplo n.º 4
0
        /// <summary>
        /// The tail of the dotted identifier.
        /// </summary>
        /// <remarks>
        /// This points to 'B.C' if the identifier is 'A.B.C'
        /// This points to null if the identifier is just 'C'
        /// </remarks>
        public DottedIdentifier GetTail(SymbolTable table)
        {
            Contract.RequiresNotNull(table);

            Analysis.IgnoreArgument(table);

            return(m_tail);
        }
        internal static DottedIdentifier Deserialize(BuildXLReader reader, SymbolTable table)
        {
            Contract.Requires(reader != null);
            Contract.Requires(table != null);
            Contract.Ensures(Contract.Result <DottedIdentifier>() != null);

            // we'll need this argument in the future so prevent warnings until then.
            Analysis.IgnoreArgument(table);

            DottedIdentifier current = null;
            DottedIdentifier head    = null;

            while (true)
            {
                var s = reader.ReadSymbolAtom();
                if (!s.IsValid)
                {
                    break;
                }

                if (current == null)
                {
                    // head node
                    head    = new DottedIdentifier(s);
                    current = head;
                }
                else
                {
                    // extend the tail...
                    current.m_tail = new DottedIdentifier(s);
                    current        = current.m_tail;
                }
            }

            Contract.Assume(head != null);
            return(head);
        }
Exemplo n.º 6
0
 private ModuleId(StringId value, string friendlyNameForDebugging = null)
 {
     Analysis.IgnoreArgument(friendlyNameForDebugging);
     Value = value;
 }