Browse Source

Propagate the type map database to the various generation steps.

pull/1/head
triton 13 years ago
parent
commit
f1ac9d7bc8
  1. 9
      src/Generator/CodeGenerator.cs

9
src/Generator/CodeGenerator.cs

@ -1,6 +1,7 @@
using System.Reflection; using System.Reflection;
using Cxxi.Generators; using Cxxi.Generators;
using Cxxi.Passes; using Cxxi.Passes;
using Cxxi.Types;
using Mono.Options; using Mono.Options;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -13,6 +14,7 @@ namespace Cxxi
private readonly Options options; private readonly Options options;
private Library library; private Library library;
private readonly ILibrary transform; private readonly ILibrary transform;
public TypeDatabase typeDatabase;
public CodeGenerator(Options options, ILibrary transform) public CodeGenerator(Options options, ILibrary transform)
{ {
@ -62,6 +64,9 @@ namespace Cxxi
public void ProcessCode() public void ProcessCode()
{ {
typeDatabase = new TypeDatabase();
typeDatabase.SetupTypeMaps();
if (transform != null) if (transform != null)
transform.Preprocess(new LibraryHelpers(library)); transform.Preprocess(new LibraryHelpers(library));
@ -72,7 +77,7 @@ namespace Cxxi
if (transform != null) if (transform != null)
transform.SetupPasses(passes); transform.SetupPasses(passes);
var preprocess = new Preprocess(); var preprocess = new Preprocess(typeDatabase);
preprocess.ProcessLibrary(library); preprocess.ProcessLibrary(library);
var transformer = new Transform() { Options = options, Passes = passes }; var transformer = new Transform() { Options = options, Passes = passes };
@ -89,7 +94,7 @@ namespace Cxxi
Console.WriteLine("Generating wrapper code..."); Console.WriteLine("Generating wrapper code...");
var gen = new Generator(options, library, transform); var gen = new Generator(options, library, transform, typeDatabase);
gen.Generate(); gen.Generate();
} }
} }

Loading…
Cancel
Save