Search in sources :

Example 1 with StatusPrinter

use of org.eclipse.ceylon.common.StatusPrinter in project ceylon by eclipse.

the class StatusPrinterTest method testLimit.

@Test
public void testLimit() {
    StatusPrinter p = new StatusPrinter();
    Assert.assertEquals("", p.limit("", 0));
    Assert.assertEquals("", p.limit("", 4));
    Assert.assertEquals("abs", p.limit("abs", 4));
    Assert.assertEquals("abs", p.limit("abs", 3));
    Assert.assertEquals("a…", p.limit("abs", 2));
    Assert.assertEquals("…", p.limit("abs", 1));
    Assert.assertEquals("", p.limit("abs", 0));
    Assert.assertEquals("abbs", p.limit("abbs", 4));
    Assert.assertEquals("a…s", p.limit("abbs", 3));
    Assert.assertEquals("a…", p.limit("abbs", 2));
    Assert.assertEquals("…", p.limit("abbs", 1));
    Assert.assertEquals("", p.limit("abbs", 0));
    Assert.assertEquals("ab…bs", p.limit("abccbs", 5));
}
Also used : StatusPrinter(org.eclipse.ceylon.common.StatusPrinter) Test(org.junit.Test)

Example 2 with StatusPrinter

use of org.eclipse.ceylon.common.StatusPrinter in project ceylon by eclipse.

the class StatusPrinterTest method testParts.

@Test
public void testParts() {
    StatusPrinter p = new StatusPrinter(20);
    Assert.assertEquals(5, p.remainingForPercentage(0.25));
    Assert.assertEquals("co…ar", p.part("com.bar", 5));
    Assert.assertEquals("             com.bar", p.partRight("com.bar"));
    Assert.assertEquals("                 c…r", p.partRight("com.bar", 3));
}
Also used : StatusPrinter(org.eclipse.ceylon.common.StatusPrinter) Test(org.junit.Test)

Example 3 with StatusPrinter

use of org.eclipse.ceylon.common.StatusPrinter in project ceylon by eclipse.

the class CeyloncCompilerDelegate method typeCheck.

@Override
public void typeCheck(java.util.List<PhasedUnit> listOfUnits) {
    StatusPrinter sp = getStatusPrinter();
    int size = listOfUnits.size();
    int i = 1;
    for (PhasedUnit pu : listOfUnits) {
        if (sp != null)
            progress(sp, 1, i++, size, pu);
        pu.validateTree();
        pu.scanDeclarations();
    }
    i = 1;
    for (PhasedUnit pu : listOfUnits) {
        if (sp != null)
            progress(sp, 2, i++, size, pu);
        pu.scanTypeDeclarations();
    }
    i = 1;
    for (PhasedUnit pu : listOfUnits) {
        if (sp != null)
            progress(sp, 3, i++, size, pu);
        pu.validateRefinement();
    }
    i = 1;
    for (PhasedUnit pu : listOfUnits) {
        if (sp != null)
            progress(sp, 4, i++, size, pu);
        pu.analyseTypes();
    }
    i = 1;
    for (PhasedUnit pu : listOfUnits) {
        if (sp != null)
            progress(sp, 5, i++, size, pu);
        pu.analyseFlow();
    }
    i = 1;
    for (PhasedUnit pu : listOfUnits) {
        if (sp != null)
            progress(sp, 6, i++, size, pu);
        pu.analyseUsage();
    }
    i = 1;
    UnknownTypeCollector utc = new UnknownTypeCollector();
    for (PhasedUnit pu : listOfUnits) {
        if (sp != null)
            progress(sp, 7, i++, size, pu);
        pu.getCompilationUnit().visit(utc);
    }
}
Also used : StatusPrinter(org.eclipse.ceylon.common.StatusPrinter) PhasedUnit(org.eclipse.ceylon.compiler.typechecker.context.PhasedUnit) UnknownTypeCollector(org.eclipse.ceylon.compiler.java.loader.UnknownTypeCollector)

Example 4 with StatusPrinter

use of org.eclipse.ceylon.common.StatusPrinter in project ceylon by eclipse.

the class LanguageCompiler method getStatusPrinterInstance.

/**
 * 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;
}
Also used : StatusPrinter(org.eclipse.ceylon.common.StatusPrinter)

Example 5 with StatusPrinter

use of org.eclipse.ceylon.common.StatusPrinter in project ceylon by eclipse.

the class CeyloncCompilerDelegate method resolveModuleDependencies.

@Override
public void resolveModuleDependencies(PhasedUnits phasedUnits) {
    final StatusPrinter sp = getStatusPrinter();
    org.eclipse.ceylon.compiler.typechecker.context.Context ceylonContext = LanguageCompiler.getCeylonContextInstance(context);
    final ModuleValidator validator = new ModuleValidator(ceylonContext, phasedUnits);
    if (sp != null) {
        validator.setListener(new StatusPrinterProgressListener(validator, sp));
        sp.clearLine();
        sp.log("Starting resolving");
    }
    validator.verifyModuleDependencyTree();
    if (sp != null) {
        sp.clearLine();
        sp.log("Done resolving");
    }
}
Also used : StatusPrinter(org.eclipse.ceylon.common.StatusPrinter) ModuleValidator(org.eclipse.ceylon.compiler.typechecker.analyzer.ModuleValidator)

Aggregations

StatusPrinter (org.eclipse.ceylon.common.StatusPrinter)5 Test (org.junit.Test)2 UnknownTypeCollector (org.eclipse.ceylon.compiler.java.loader.UnknownTypeCollector)1 ModuleValidator (org.eclipse.ceylon.compiler.typechecker.analyzer.ModuleValidator)1 PhasedUnit (org.eclipse.ceylon.compiler.typechecker.context.PhasedUnit)1