/// <summary>
        /// Parse the specified name into a child <see cref="NamespaceRef"/> or <see cref="TypeRef"/> on the current namespace,
        /// or a <see cref="Dot"/> expression that evaluates to one.
        /// </summary>
        public virtual Expression ParseName(string name)
        {
            string      prefix = RemovePrefix(ref name);
            SymbolicRef symbolicRef;
            object      obj;

            lock (this)
                obj = _children.Find(prefix);
            if (obj != null)
            {
                if (obj is Namespace)
                {
                    symbolicRef = new NamespaceRef((Namespace)obj);
                }
                else if (obj is ITypeDecl)
                {
                    symbolicRef = new TypeRef((ITypeDecl)obj);
                }
                else //if (obj is Type)
                {
                    symbolicRef = new TypeRef((Type)obj);
                }
            }
            else
            {
                symbolicRef = new UnresolvedRef(prefix);
            }
            return(string.IsNullOrEmpty(name) ? symbolicRef : ParseName(symbolicRef, name));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Remove all items from the referenced <see cref="Namespace"/>.
        /// </summary>
        public void RemoveAll()
        {
            NamespaceRef namespaceRef = Namespace;

            if (namespaceRef != null)
            {
                namespaceRef.RemoveAll();
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Remove a <see cref="Type"/> from the referenced <see cref="Namespace"/>.
        /// </summary>
        public void Remove(Type type)
        {
            NamespaceRef namespaceRef = Namespace;

            if (namespaceRef != null)
            {
                namespaceRef.Remove(type);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Remove a child <see cref="Namespace"/> from the referenced <see cref="Namespace"/>.
        /// </summary>
        public void Remove(Namespace @namespace)
        {
            NamespaceRef namespaceRef = Namespace;

            if (namespaceRef != null)
            {
                namespaceRef.Remove(@namespace);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Add a <see cref="Type"/> to the referenced <see cref="Namespace"/>.
        /// </summary>
        public void Add(Type type)
        {
            NamespaceRef namespaceRef = Namespace;

            if (namespaceRef != null)
            {
                namespaceRef.Add(type);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Add a child <see cref="Namespace"/> to the referenced <see cref="Namespace"/>.
        /// </summary>
        public void Add(Namespace @namespace)
        {
            NamespaceRef namespaceRef = Namespace;

            if (namespaceRef != null)
            {
                namespaceRef.Add(@namespace);
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Parse the specified name into a child <see cref="NamespaceRef"/> or <see cref="TypeRef"/> on the referenced namespace,
        /// or a <see cref="Dot"/> expression that evaluates to one.
        /// </summary>
        public Expression ParseName(string name)
        {
            NamespaceRef namespaceRef = Namespace;

            return(namespaceRef != null ? namespaceRef.ParseName(name) : null);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Find or create a child <see cref="Namespace"/>, including any missing parent namespaces.
        /// </summary>
        public Namespace FindOrCreateChildNamespace(string namespaceName)
        {
            NamespaceRef namespaceRef = Namespace;

            return(namespaceRef != null ? namespaceRef.FindOrCreateChildNamespace(namespaceName) : null);
        }
        /// <summary>
        /// Determine if the current reference refers to the same code object as the specified reference.
        /// </summary>
        public override bool IsSameRef(SymbolicRef symbolicRef)
        {
            NamespaceRef namespaceRef = (symbolicRef is AliasRef ? ((AliasRef)symbolicRef).Namespace : symbolicRef as NamespaceRef);

            return(namespaceRef != null && Reference == namespaceRef.Reference);
        }