Skip to content

Commit d773b4b

Browse files
committed
Added PrintModuleOutputNamespace option to CSharpTypePrinter.
1 parent 1eb3b77 commit d773b4b

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/Generator/Generators/CSharp/CSharpTypePrinter.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ public class CSharpTypePrinter : TypePrinter
2020
public DriverOptions Options => Context.Options;
2121
public TypeMapDatabase TypeMapDatabase => Context.TypeMaps;
2222

23+
public bool PrintModuleOutputNamespace = true;
24+
2325
public CSharpTypePrinter(BindingContext context)
2426
{
2527
Context = context;
@@ -646,10 +648,13 @@ string GetName(Declaration decl)
646648
ctx = ctx.Namespace;
647649
}
648650

649-
var unit = ctx.TranslationUnit;
650-
if (!unit.IsSystemHeader && unit.IsValid &&
651-
!string.IsNullOrWhiteSpace(unit.Module.OutputNamespace))
652-
names.Push(unit.Module.OutputNamespace);
651+
if (PrintModuleOutputNamespace)
652+
{
653+
var unit = ctx.TranslationUnit;
654+
if (!unit.IsSystemHeader && unit.IsValid &&
655+
!string.IsNullOrWhiteSpace(unit.Module.OutputNamespace))
656+
names.Push(unit.Module.OutputNamespace);
657+
}
653658

654659
return QualifiedType(string.Join(".", names));
655660
}

0 commit comments

Comments
 (0)