Browse Source

Revert "Extract current module as read-only property to CodeGenerator.Module."

This reverts commit d340de3afa.
pull/761/head
Joao Matos 9 years ago
parent
commit
40bfd65135
  1. 15
      src/Generator/Generators/CSharp/CSharpSources.cs
  2. 3
      src/Generator/Generators/CodeGenerator.cs

15
src/Generator/Generators/CSharp/CSharpSources.cs

@ -149,14 +149,17 @@ namespace CppSharp.Generators.CSharp @@ -149,14 +149,17 @@ namespace CppSharp.Generators.CSharp
{
GenerateFilePreamble();
var module = TranslationUnits.Count == 0 ?
Context.Options.SystemModule : TranslationUnit.Module;
PushBlock(CSharpBlockKind.Usings);
WriteLine("using System;");
WriteLine("using System.Runtime.InteropServices;");
WriteLine("using System.Security;");
var internalsVisibleTo = from m in Options.Modules
where m.Dependencies.Contains(Module)
select m.LibraryName;
var internalsVisibleTo = (from m in Options.Modules
where m.Dependencies.Contains(module)
select m.LibraryName).ToList();
if (internalsVisibleTo.Any())
WriteLine("using System.Runtime.CompilerServices;");
@ -170,17 +173,17 @@ namespace CppSharp.Generators.CSharp @@ -170,17 +173,17 @@ namespace CppSharp.Generators.CSharp
if (internalsVisibleTo.Any())
NewLine();
if (!string.IsNullOrEmpty(Module.OutputNamespace))
if (!string.IsNullOrEmpty(module.OutputNamespace))
{
PushBlock(CSharpBlockKind.Namespace);
WriteLine("namespace {0}", Module.OutputNamespace);
WriteLine("namespace {0}", module.OutputNamespace);
WriteStartBraceIndent();
}
foreach (var unit in TranslationUnits)
unit.Visit(this);
if (!string.IsNullOrEmpty(Module.OutputNamespace))
if (!string.IsNullOrEmpty(module.OutputNamespace))
{
WriteCloseBraceIndent();
PopBlock(NewLineKind.BeforeNextBlock);

3
src/Generator/Generators/CodeGenerator.cs

@ -14,9 +14,6 @@ namespace CppSharp.Generators @@ -14,9 +14,6 @@ namespace CppSharp.Generators
public TranslationUnit TranslationUnit => TranslationUnits[0];
public Module Module => TranslationUnits.Count == 0 ?
Context.Options.SystemModule : TranslationUnit.Module;
public abstract string FileExtension { get; }
protected CodeGenerator(BindingContext context, TranslationUnit unit)

Loading…
Cancel
Save