Beispiel #1
0
        public void AddUsing(UsingAliasNamespace un)
        {
            if (DeclarationFound)
            {
                Compiler.Report.Error(1529, un.Location, "A using clause must precede all other namespace elements except extern alias declarations");
            }

            AddAlias(un);
        }
Beispiel #2
0
        void AddAlias(UsingAliasNamespace un)
        {
            if (clauses == null)
            {
                clauses = new List <UsingNamespace> ();
            }
            else
            {
                foreach (var entry in clauses)
                {
                    var a = entry as UsingAliasNamespace;
                    if (a != null && a.Alias.Value == un.Alias.Value)
                    {
                        Compiler.Report.SymbolRelatedToPreviousError(a.Location, "");
                        Compiler.Report.Error(1537, un.Location,
                                              "The using alias `{0}' appeared previously in this namespace", un.Alias.Value);
                    }
                }
            }

            clauses.Add(un);

            resolved = false;
        }
Beispiel #3
0
			public override void Visit(UsingAliasNamespace uan)
			{
				var ud = new UsingAliasDeclaration();
				var loc = LocationsBag.GetLocations(uan);
				
				ud.AddChild(new CSharpTokenNode(Convert(uan.Location), UsingAliasDeclaration.UsingKeywordRole), UsingAliasDeclaration.UsingKeywordRole);
				ud.AddChild(Identifier.Create(uan.Alias.Value, Convert(uan.Alias.Location)), UsingAliasDeclaration.AliasRole);
				if (loc != null)
					ud.AddChild(new CSharpTokenNode(Convert(loc [0]), Roles.Assign), Roles.Assign);
				if (uan.NamespaceExpression != null)
					ud.AddChild(ConvertToType(uan.NamespaceExpression), UsingAliasDeclaration.ImportRole);
				if (loc != null && loc.Count > 1)
					ud.AddChild(new CSharpTokenNode(Convert(loc [1]), Roles.Semicolon), Roles.Semicolon);
				AddToNamespace(ud);
			}
        public void AddUsing(UsingAliasNamespace un)
        {
            if (DeclarationFound){
                Compiler.Report.Error (1529, un.Location, "A using clause must precede all other namespace elements except extern alias declarations");
            }

            AddAlias (un);
        }
        void AddAlias(UsingAliasNamespace un)
        {
            if (clauses == null) {
                clauses = new List<UsingClause> ();
            } else {
                foreach (var entry in clauses) {
                    var a = entry as UsingAliasNamespace;
                    if (a != null && a.Alias.Value == un.Alias.Value) {
                        Compiler.Report.SymbolRelatedToPreviousError (a.Location, "");
                        Compiler.Report.Error (1537, un.Location,
                            "The using alias `{0}' appeared previously in this namespace", un.Alias.Value);
                    }
                }
            }

            clauses.Add (un);
        }
 public virtual void Visit(UsingAliasNamespace uan)
 {
 }
Beispiel #7
0
void case_19()
#line 476 "cs-parser.jay"
{
		var lt = (LocatedToken) yyVals[-3+yyTop];
		if (lang_version != LanguageVersion.ISO_1 && lt.Value == "global") {
			report.Warning (440, 2, lt.Location,
			 "An alias named `global' will not be used when resolving `global::'. The global namespace will be used instead");
		}

		var un = new UsingAliasNamespace (new SimpleMemberName (lt.Value, lt.Location), (ATypeNameExpression) yyVals[-1+yyTop], GetLocation (yyVals[-4+yyTop]));
		current_namespace.AddUsing (un);
		lbag.AddLocation (un, GetLocation (yyVals[-2+yyTop]), GetLocation (yyVals[0+yyTop]));
	  }
Beispiel #8
0
		public virtual void Visit (UsingAliasNamespace uan)
		{
		}
Beispiel #9
0
		void AddAlias (UsingAliasNamespace un)
		{
			if (clauses == null) {
				clauses = new List<UsingNamespace> ();
			} else {
				foreach (var entry in clauses) {
					var a = entry as UsingAliasNamespace;
					if (a != null && a.Alias.Equals (un.Alias)) {
						Compiler.Report.SymbolRelatedToPreviousError (a.Location, "");
						Compiler.Report.Error (1537, un.Location,
							"The using alias `{0}' appeared previously in this namespace", un.Alias.GetSignatureForError ());
					}
				}
			}

			clauses.Add (un);

			resolved = false;
		}