use of com.redhat.ceylon.model.loader.Timer in project ceylon-compiler by ceylon.
the class CeylonEnter method completeCeylonTrees.
public void completeCeylonTrees(List<JCCompilationUnit> trees) {
// run the type checker
timer.startTask("Ceylon type checking");
typeCheck();
// some debugging
// printModules();
timer.startTask("Ceylon code generation");
/*
* Here we convert the ceylon tree to its javac AST, after the typechecker has run
*/
Timer nested = timer.nestedTimer();
if (sp != null) {
sp.clearLine();
sp.log("Generating AST");
}
int i = 1;
int size = trees.size();
for (JCCompilationUnit tree : trees) {
if (tree instanceof CeylonCompilationUnit) {
CeylonCompilationUnit ceylonTree = (CeylonCompilationUnit) tree;
gen.setMap(ceylonTree.lineMap);
CeylonPhasedUnit phasedUnit = (CeylonPhasedUnit) ceylonTree.phasedUnit;
if (sp != null) {
sp.clearLine();
sp.log("Generating [" + (i++) + "/" + size + "] ");
sp.log(phasedUnit.getPathRelativeToSrcDir());
}
gen.setFileObject(phasedUnit.getFileObject());
nested.startTask("Ceylon code generation for " + phasedUnit.getUnitFile().getName());
TaskEvent event = new TaskEvent(TaskEvent.Kind.PARSE, tree);
if (taskListener != null) {
taskListener.started(event);
}
ceylonTree.defs = gen.transformAfterTypeChecking(ceylonTree.ceylonTree).toList();
if (taskListener != null) {
taskListener.finished(event);
}
nested.endTask();
if (isVerbose("ast")) {
log.errWriter.println("Model tree for " + tree.getSourceFile());
log.errWriter.println(ceylonTree.ceylonTree);
}
if (isVerbose("code")) {
log.errWriter.println("Java code generated for " + tree.getSourceFile());
log.errWriter.println(ceylonTree);
}
}
}
timer.startTask("Ceylon error generation");
printGeneratorErrors();
timer.endTask();
// write some stats
if (verbose)
modelLoader.printStats();
}
Aggregations