/** 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; }
/** 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; }
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; }
/** 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; }