Permalink
Browse files

Ignored inlined name-spaces in the C# gen only.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
  • Loading branch information...
ddobrev committed Aug 20, 2017
1 parent 38f8207 commit f33b162f6fdd1d814cfa62a94d3d46b78065ff7d
@@ -144,7 +144,8 @@ public static IEnumerable<Declaration> GatherNamespaces(DeclarationContext @name
var currentNamespace = @namespace;
while (currentNamespace != null)
{
var isInlineNamespace = currentNamespace is Namespace && ((Namespace)currentNamespace).IsInline;
var isInlineNamespace = currentNamespace is Namespace &&
((Namespace) currentNamespace).IsInline;
if (!isInlineNamespace)
namespaces.Push(currentNamespace);
currentNamespace = currentNamespace.Namespace;
@@ -185,8 +185,8 @@ public void GenerateDeclContext(DeclarationContext decl)
public void GenerateNamespace(Namespace @namespace)
{
var isTopLevel = @namespace is TranslationUnit;
var generateNamespace = !@namespace.IsInline && (!isTopLevel ||
!string.IsNullOrEmpty(@namespace.TranslationUnit.Module.OutputNamespace));
var generateNamespace = !isTopLevel ||
!string.IsNullOrEmpty(@namespace.TranslationUnit.Module.OutputNamespace);
if (generateNamespace)
{
@@ -54,10 +54,9 @@ public string QualifiedIdentifier(Declaration decl)
if (!string.IsNullOrEmpty(TranslationUnit.Module.OutputNamespace))
{
if (string.IsNullOrEmpty(decl.QualifiedName))
return string.Format("{0}", decl.TranslationUnit.Module.OutputNamespace);
return $"{decl.TranslationUnit.Module.OutputNamespace}";
return string.Format("{0}::{1}",
decl.TranslationUnit.Module.OutputNamespace, decl.QualifiedName);
return $"{decl.TranslationUnit.Module.OutputNamespace}::{decl.QualifiedName}";
}
return decl.QualifiedName;
@@ -71,6 +71,8 @@ public void TestUncompilableCode()
{
}
CSharp.CSharp.FunctionInsideInlineNamespace();
#pragma warning restore 0168
#pragma warning restore 0219
}
@@ -1381,3 +1381,7 @@ int funcWithTypedefedFuncPtrAsParam(typedefedFuncPtr* func)
Bar b;
return func(a, b);
}
void InlineNamespace::FunctionInsideInlineNamespace()
{
}
@@ -1224,3 +1224,9 @@ void useStdStringJustAsParameter(std::string s);
typedef int (typedefedFuncPtr)(Foo* a, Bar b);
int DLL_API funcWithTypedefedFuncPtrAsParam(typedefedFuncPtr* func);
inline namespace InlineNamespace
{
DLL_API void FunctionInsideInlineNamespace();
}
@@ -807,10 +807,4 @@ public void TestRefToPrimitiveInSetter()
Assert.That(testProperties.RefToPrimitiveInSetter, Is.EqualTo(value));
}
}
[Test]
public void TestInlineNamespaces()
{
Common.FunctionInsideInlineNamespace();
}
}

0 comments on commit f33b162

Please sign in to comment.