Browse Source

Merge pull request #466 from ddobrev/master

Removed some redundant code when writing qualified names
pull/467/head
João Matos 10 years ago
parent
commit
c98c1206e6
  1. 16
      src/Generator/Generators/CSharp/CSharpTextTemplate.cs

16
src/Generator/Generators/CSharp/CSharpTextTemplate.cs

@ -110,10 +110,9 @@ namespace CppSharp.Generators.CSharp @@ -110,10 +110,9 @@ namespace CppSharp.Generators.CSharp
// Takes a declaration (type, class etc.) that is referenced from a context, and the context.
// If the referenced name needs a qualification in the context, add it. Otherwise, return just the name.
public string QualifiedIdentifierIfNeeded(Declaration context, Declaration reference)
private static string QualifiedIdentifierIfNeeded(Declaration reference)
{
var refNames = new Stack<string>();
var ctxNames = new Stack<string>();
var refCtx = reference;
while (refCtx != null)
@ -123,19 +122,6 @@ namespace CppSharp.Generators.CSharp @@ -123,19 +122,6 @@ namespace CppSharp.Generators.CSharp
refCtx = refCtx.Namespace;
}
var ctxCtx = context;
while (ctxCtx != null)
{
if (!string.IsNullOrWhiteSpace(ctxCtx.Name))
ctxNames.Push(ctxCtx.Name);
ctxCtx = ctxCtx.Namespace;
}
if (context.GenerationKind == GenerationKind.Generate && Options.GenerateLibraryNamespace)
ctxNames.Push(Options.OutputNamespace);
if (reference.GenerationKind == GenerationKind.Generate && Options.GenerateLibraryNamespace)
refNames.Push(Options.OutputNamespace);
return string.Join(".", refNames);
}

Loading…
Cancel
Save