logo

class

compiler::GenerateOutput

sys::Obj
  compiler::CompilerSupport
    compiler::CompilerStep
      compiler::GenerateOutput
  1  //
  2  // Copyright (c) 2006, Brian Frank and Andy Frank
  3  // Licensed under the Academic Free License version 3.0
  4  //
  5  // History:
  6  //   4 Nov 06  Brian Frank  Creation
  7  //
  8  
  9  **
 10  ** GenerateOutput creates the appropriate CompilerOutput instance
 11  ** for Compiler.output based on the configured CompilerInput.output.
 12  **
 13  class GenerateOutput : CompilerStep
 14  {
 15  
 16  //////////////////////////////////////////////////////////////////////////
 17  // Construction
 18  //////////////////////////////////////////////////////////////////////////
 19  
 20    **
 21    ** Constructor takes the associated Compiler
 22    **
 23    new make(Compiler compiler)
 24      : super(compiler)
 25    {
 26    }
 27  
 28  //////////////////////////////////////////////////////////////////////////
 29  // Methods
 30  //////////////////////////////////////////////////////////////////////////
 31  
 32    **
 33    ** Run the step
 34    **
 35    override Void run()
 36    {
 37      output := CompilerOutput.make
 38      output.mode = compiler.input.output
 39  
 40      switch (output.mode)
 41      {
 42        case CompilerOutputMode.transientPod:
 43          output.transientPod = LoadPod.make(compiler).load
 44  
 45        case CompilerOutputMode.podFile:
 46          output.podFile = WritePod.make(compiler).write
 47  
 48        default:
 49          throw err("Unknown output type: '$output.mode'", null)
 50      }
 51  
 52      compiler.output = output
 53    }
 54  
 55  }

More Info

Slots