Package org.openquark.cal.compiler

Examples of org.openquark.cal.compiler.CompilerMessageLogger


       
        SourceModel.ModuleDefn moduleDefn = SourceModel.ModuleDefn.make(moduleName, new SourceModel.Import[] { SourceModel.Import.make(CAL_Prelude.MODULE_NAME) }, null);
        ModuleSourceDefinition moduleSourceDefn = new SourceModelModuleSource(moduleDefn);

        try {
            CompilerMessageLogger logger = new MessageLogger();
            Severity severity = workspaceManager.makeModule(moduleSourceDefn, logger);
           
            assertTrue(severity.compareTo(Severity.ERROR) < 0);

            //todo-jowong these assertions should be true, but are currently false because
View Full Code Here


        ModuleSourceDefinition[] moduleSourceDefns = { moduleSourceDefn1, moduleSourceDefn2 };
       
        ModuleSourceDefinitionGroup mdg = new ModuleSourceDefinitionGroup(moduleSourceDefns);

        try {
            CompilerMessageLogger logger = new MessageLogger();
            Severity severity = workspaceManager.makeModules(moduleNames, mdg, logger);
           
            assertTrue(severity.compareTo(Severity.ERROR) < 0);

            //todo-jowong these assertions should be true, but are currently false because
View Full Code Here

       
        ModuleSourceDefinition[] moduleSourceDefns = { moduleSourceDefn1, moduleSourceDefn2 };
       
        ModuleSourceDefinitionGroup mdg = new ModuleSourceDefinitionGroup(moduleSourceDefns);

        CompilerMessageLogger logger = new MessageLogger();
        Severity severity = workspaceManager.makeModules(moduleNames, mdg, logger);
       
        assertTrue(severity.compareTo(Severity.ERROR) < 0);
       
        Status status = new Status("Removal of test modules");
View Full Code Here

       
        String expectedValue = "Thread " + threadID + " iteration " + iterID;

        try {
            String functionName = "tempFunc" + threadID + "_" + iterID;
            CompilerMessageLogger logger = new MessageLogger();
           
            EntryPoint entryPoint = workspaceManager.getCompiler().getEntryPoint(
                new AdjunctSource.FromSourceModel(
                    SourceModel.FunctionDefn.Algebraic.make(
                        functionName, Scope.PRIVATE, null,
View Full Code Here

    private static void help_compileEvalDependentTestFunctionForThread(WorkspaceManager workspaceManager, ModuleName targetModule, String definingExpr, Object expectedValue, int threadID, int iterID, int numEvalTries, List asserts) {
       
        try {
            String functionName = "tempFunc" + threadID + "_" + iterID;
           
            CompilerMessageLogger logger = new MessageLogger();
           
            EntryPoint entryPoint = workspaceManager.getCompiler().getEntryPoint(
                new AdjunctSource.FromSourceModel(
                    SourceModel.FunctionDefn.Algebraic.make(
                        functionName, Scope.PRIVATE, null,
View Full Code Here

        AdjunctSource source = new AdjunctSource.FromSourceModel(
                SourceModel.FunctionDefn.Algebraic.make(adjunctUnqualifiedName, Scope.PUBLIC, null, funcExpr));
       

        WorkspaceManager workspaceManager = leccCALServices.getWorkspaceManager();
        CompilerMessageLogger logger = new MessageLogger();
       
       
        // Compile the adjunct definition.       
        EntryPointSpec entryPointSpec = EntryPointSpec.make(qualifiedAdjunctName, new InputPolicy[0], OutputPolicy.DEFAULT_OUTPUT_POLICY);
        workspaceManager.getCompiler().getEntryPoint (source, entryPointSpec, adjunctModuleName,  logger);

        if (logger.getMaxSeverity().compareTo(CompilerMessage.Severity.ERROR) >= 0) {
            fail("Compilation failed: " + logger.getFirstError().getMessage());
        }
       

        // Get the classloader for module with the adjunct we compiled.
        LECCModule module = (LECCModule)workspaceManager.getModuleTypeInfo(adjunctModuleName).getModule();
View Full Code Here

     * @param functionName
     * @throws CALExecutorException
     */
    static void help_testWithFunction(WorkspaceManager workspaceManager, ModuleName moduleName, String functionName) throws CALExecutorException {

        CompilerMessageLogger logger = new MessageLogger();
        EntryPoint entryPoint = workspaceManager.getCompiler().getEntryPoint(
            EntryPointSpec.make(QualifiedName.make(moduleName, functionName)),
            moduleName,
            logger);
       
View Full Code Here

                }
            }
        });

       
        CompilerMessageLogger ml = new MessageLogger();
       
        // Init and compile the workspace.
        Status initStatus = new Status("Init status.");
        workspaceManager.initWorkspace(streamProvider, initStatus);
       
        if (initStatus.getSeverity() != Status.Severity.OK) {
            ml.logMessage(initStatus.asCompilerMessage());
        }
       
        long startCompile = System.currentTimeMillis();
       
        // If there are no errors go ahead and compile the workspace.
        if (ml.getMaxSeverity().compareTo(CompilerMessage.Severity.ERROR) < 0) {
            WorkspaceManager.CompilationOptions options = new WorkspaceManager.CompilationOptions();
            options.setForceCodeRegeneration(forceCodeRegen);
            workspaceManager.compile(ml, dirtyOnly, null, options);
        }
       
        long compileTime = System.currentTimeMillis() - startCompile;
       
        boolean compilationSucceeded;
        if (ml.getMaxSeverity().compareTo(CompilerMessage.Severity.ERROR) >= 0) {
            // Errors
            jfitLogger.severe("Compilation unsuccessful because of errors:");
            compilationSucceeded = false;
        } else {
            // Compilation successful
            jfitLogger.fine("Compilation successful");
            compilationSucceeded = true;
        }
       
        // Write out compiler messages
        java.util.List<CompilerMessage> errs = ml.getCompilerMessages();
        int errsSize = errs.size();
        for (int i = 0; i < errsSize; i++) {
            CompilerMessage err = errs.get(i);
            jfitLogger.info("  " + err.toString());
        }
View Full Code Here

                HashSet<EntryPointSpec> required = new HashSet<EntryPointSpec>();

                required.addAll(cache.keySet());
                required.addAll(entryPointSpecs);

                CompilerMessageLogger compilerLogger = new MessageLogger();
                      
                List<EntryPointSpec> requiredList = new ArrayList<EntryPointSpec>(required);
                //compile the entry points
                List<EntryPoint> entryPoints
                = programModelManager.getCompiler().getEntryPoints(requiredList, moduleName, compilerLogger);

                if (compilerLogger.getMaxSeverity().compareTo(CompilerMessage.Severity.ERROR) >= 0) {
                    StringBuffer sb = new StringBuffer();
                    sb.append("Failed to generate entry points for module '");
                    sb.append(moduleName);
                    sb.append(General.SYSTEM_EOL);
                    for(CompilerMessage msg : compilerLogger.getCompilerMessages()) {
                        sb.append(msg);
                        sb.append(General.SYSTEM_EOL);
                    }

                    //all of the cached entry points are invalid now.
View Full Code Here

     * @param typeChecker TypeChecker the type checker to use to generate the type
     * @return TypeExpr a new TypeExpr for the target sc.
     */
    protected static final TypeExpr getNewTargetTypeExpr(Target target, ModuleName moduleName, TypeChecker typeChecker) {
        AdjunctSource scDefinition = target.getTargetDef(null, typeChecker.getTypeCheckInfo(moduleName).getModuleTypeInfo());
        CompilerMessageLogger logger = new MessageLogger ();
        return typeChecker.checkFunction(scDefinition, moduleName, logger);
    }
View Full Code Here

TOP

Related Classes of org.openquark.cal.compiler.CompilerMessageLogger

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.