void case_19() #line 491 "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"); } if (yyVals[-4+yyTop] != null) { report.Error (8085, GetLocation (yyVals[-4+yyTop]), "A `using static' directive cannot be used to declare an alias"); } var un = new UsingAliasNamespace (new SimpleMemberName (lt.Value, lt.Location), (ATypeNameExpression) yyVals[-1+yyTop], GetLocation (yyVals[-5+yyTop])); current_namespace.AddUsing (un); lbag.AddLocation (un, GetLocation (yyVals[-2+yyTop]), GetLocation (yyVals[0+yyTop])); }
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) { }