//
        // Extracts the using alises and using clauses into a couple of
        // arrays that might already have the same information;  Used by the
        // C# Eval mode.
        //
        public void Extract(List <NamespaceUsingAlias> out_using_aliases, List <NamespaceUsing> out_using_clauses)
        {
            if (using_aliases != null)
            {
                foreach (NamespaceUsingAlias uae in using_aliases)
                {
                    bool replaced = false;

                    for (int i = 0; i < out_using_aliases.Count; i++)
                    {
                        NamespaceUsingAlias out_uea = (NamespaceUsingAlias)out_using_aliases [i];

                        if (out_uea.Alias == uae.Alias)
                        {
                            out_using_aliases [i] = uae;
                            replaced = true;
                            break;
                        }
                    }
                    if (!replaced)
                    {
                        out_using_aliases.Add(uae);
                    }
                }
            }

            if (using_clauses != null)
            {
                foreach (NamespaceUsing ue in using_clauses)
                {
                    bool found = false;

                    foreach (NamespaceUsing out_ue in out_using_clauses)
                    {
                        if (out_ue.Name == ue.Name)
                        {
                            found = true;
                            break;
                        }
                    }
                    if (!found)
                    {
                        out_using_clauses.Add(ue);
                    }
                }
            }
        }
        void AddUsingAlias(NamespaceUsingAlias uae)
        {
            if (using_aliases == null)
            {
                using_aliases = new List <NamespaceUsingAlias> ();
            }
            else
            {
                foreach (NamespaceUsingAlias entry in using_aliases)
                {
                    if (uae.Alias == entry.Alias)
                    {
                        Compiler.Report.SymbolRelatedToPreviousError(uae.Location, uae.Alias);
                        Compiler.Report.Error(1537, entry.Location, "The using alias `{0}' appeared previously in this namespace",
                                              entry.Alias);
                        return;
                    }
                }
            }

            using_aliases.Add(uae);
        }
Exemple #3
0
		void AddUsingAlias (NamespaceUsingAlias uae)
		{
			if (using_aliases == null) {
				using_aliases = new List<NamespaceUsingAlias> ();
			} else {
				foreach (NamespaceUsingAlias entry in using_aliases) {
					if (uae.Alias == entry.Alias) {
						Compiler.Report.SymbolRelatedToPreviousError (uae.Location, uae.Alias);
						Compiler.Report.Error (1537, entry.Location, "The using alias `{0}' appeared previously in this namespace",
							entry.Alias);
						return;
					}
				}
			}

			using_aliases.Add (uae);
		}