From dc998d391e8db2e3618734c7b3bd7dbc83d110ff Mon Sep 17 00:00:00 2001 From: Joao Matos Date: Tue, 14 Feb 2017 17:19:47 +0000 Subject: [PATCH] Minor code formatting changes. --- src/AST/Module.cs | 8 ++++---- src/Generator/Generators/CSharp/CSharpTypePrinter.cs | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/AST/Module.cs b/src/AST/Module.cs index cb04ba87..91dcaa1b 100644 --- a/src/AST/Module.cs +++ b/src/AST/Module.cs @@ -33,11 +33,11 @@ namespace CppSharp.AST if (string.IsNullOrEmpty(inlinesLibraryName)) { if (string.IsNullOrEmpty(OutputNamespace)) - { return string.Format("{0}-inlines", LibraryName); - } + return string.Format("{0}-inlines", OutputNamespace); } + return inlinesLibraryName; } set { inlinesLibraryName = value; } @@ -50,11 +50,11 @@ namespace CppSharp.AST if (string.IsNullOrEmpty(templatesLibraryName)) { if (string.IsNullOrEmpty(OutputNamespace)) - { return string.Format("{0}-templates", LibraryName); - } + return string.Format("{0}-templates", OutputNamespace); } + return templatesLibraryName; } set { templatesLibraryName = value; } diff --git a/src/Generator/Generators/CSharp/CSharpTypePrinter.cs b/src/Generator/Generators/CSharp/CSharpTypePrinter.cs index edb018e3..0ccaa3da 100644 --- a/src/Generator/Generators/CSharp/CSharpTypePrinter.cs +++ b/src/Generator/Generators/CSharp/CSharpTypePrinter.cs @@ -704,8 +704,10 @@ namespace CppSharp.Generators.CSharp names.Push(decl.Name); ctx = decl.Namespace; } + if (decl is Variable && !(decl.Namespace is Class)) names.Push(decl.TranslationUnit.FileNameWithoutExtension); + while (!(ctx is TranslationUnit)) { if (!string.IsNullOrWhiteSpace(ctx.Name)) @@ -713,6 +715,7 @@ namespace CppSharp.Generators.CSharp ctx = ctx.Namespace; } + if (!ctx.TranslationUnit.IsSystemHeader && ctx.TranslationUnit.IsValid && !string.IsNullOrWhiteSpace(ctx.TranslationUnit.Module.OutputNamespace)) names.Push(ctx.TranslationUnit.Module.OutputNamespace);