示例#1
0
  /** Get the PhasedUnits instance for this context. */
  public static PhasedUnits getPhasedUnitsInstance(final Context context) {
    PhasedUnits phasedUnits = context.get(phasedUnitsKey);
    if (phasedUnits == null) {
      com.redhat.ceylon.compiler.typechecker.context.Context ceylonContext =
          getCeylonContextInstance(context);
      phasedUnits =
          new PhasedUnits(
              ceylonContext,
              new ModuleManagerFactory() {
                @Override
                public ModuleManager createModuleManager(
                    com.redhat.ceylon.compiler.typechecker.context.Context ceylonContext) {
                  CompilerDelegate phasedUnitsManager = getCompilerDelegate(context);
                  return phasedUnitsManager.getModuleManager();
                }

                @Override
                public ModuleSourceMapper createModuleManagerUtil(
                    com.redhat.ceylon.compiler.typechecker.context.Context ceylonContext,
                    ModuleManager moduleManager) {
                  CompilerDelegate phasedUnitsManager = getCompilerDelegate(context);
                  return phasedUnitsManager.getModuleSourceMapper();
                }
              });
      context.put(phasedUnitsKey, phasedUnits);
    }
    return phasedUnits;
  }
示例#2
0
 /** Get the StatusPrinter instance for this context. */
 public static StatusPrinter getStatusPrinterInstance(Context context) {
   StatusPrinter statusPrinter = context.get(statusPrinterKey);
   if (statusPrinter == null) {
     statusPrinter = new StatusPrinter();
     context.put(statusPrinterKey, statusPrinter);
   }
   return statusPrinter;
 }
示例#3
0
 public static CompilerDelegate getCompilerDelegate(final Context context) {
   CompilerDelegate compilerDelegate = context.get(compilerDelegateKey);
   if (compilerDelegate == null) {
     compilerDelegate = new CeyloncCompilerDelegate(context);
     context.put(compilerDelegateKey, compilerDelegate);
   }
   return compilerDelegate;
 }
示例#4
0
 /** Get the Ceylon context instance for this context. */
 public static com.redhat.ceylon.compiler.typechecker.context.Context getCeylonContextInstance(
     Context context) {
   com.redhat.ceylon.compiler.typechecker.context.Context ceylonContext =
       context.get(ceylonContextKey);
   if (ceylonContext == null) {
     CeyloncFileManager fileManager = (CeyloncFileManager) context.get(JavaFileManager.class);
     VFS vfs = new VFS();
     ceylonContext =
         new com.redhat.ceylon.compiler.typechecker.context.Context(
             fileManager.getRepositoryManager(), vfs);
     context.put(ceylonContextKey, ceylonContext);
   }
   return ceylonContext;
 }
示例#5
0
 /** Get the JavaCompiler instance for this context. */
 public static JavaCompiler instance(Context context) {
   Options options = Options.instance(context);
   options.put("-Xprefer", "source");
   // make sure it's registered
   Log log = CeylonLog.instance(context);
   CeylonEnter.instance(context);
   CeylonClassWriter.instance(context);
   JavaCompiler instance = context.get(compilerKey);
   if (instance == null) instance = new LanguageCompiler(context);
   return instance;
 }