Search in sources :

Example 1 with InterfaceVisitor

use of com.redhat.ceylon.compiler.java.codegen.InterfaceVisitor in project ceylon-compiler by ceylon.

the class CeylonEnter method typeCheck.

private void typeCheck() {
    final java.util.List<PhasedUnit> listOfUnits = phasedUnits.getPhasedUnits();
    // Delegate to an external typechecker (e.g. the IDE build)
    compilerDelegate.typeCheck(listOfUnits);
    if (sp != null) {
        sp.clearLine();
        sp.log("Preparation phase");
    }
    int size = listOfUnits.size();
    int i = 1;
    // This phase is proper to the Java backend
    ForcedCaptureVisitor fcv = new ForcedCaptureVisitor();
    for (PhasedUnit pu : listOfUnits) {
        if (sp != null)
            progressPreparation(1, i++, size, pu);
        Unit unit = pu.getUnit();
        final CompilationUnit compilationUnit = pu.getCompilationUnit();
        compilationUnit.visit(fcv);
        for (Declaration d : unit.getDeclarations()) {
            if (d instanceof TypedDeclaration && !(d instanceof Setter) && // skip already captured members
            !d.isCaptured()) {
                compilationUnit.visit(new MethodOrValueReferenceVisitor((TypedDeclaration) d));
            }
        }
    }
    UnsupportedVisitor uv = new UnsupportedVisitor();
    JvmMissingNativeVisitor mnv = new JvmMissingNativeVisitor(modelLoader);
    BoxingDeclarationVisitor boxingDeclarationVisitor = new CompilerBoxingDeclarationVisitor(gen);
    BoxingVisitor boxingVisitor = new CompilerBoxingVisitor(gen);
    DeferredVisitor deferredVisitor = new DeferredVisitor();
    AnnotationModelVisitor amv = new AnnotationModelVisitor(gen);
    DefiniteAssignmentVisitor dav = new DefiniteAssignmentVisitor();
    TypeParameterCaptureVisitor tpCaptureVisitor = new TypeParameterCaptureVisitor();
    InterfaceVisitor localInterfaceVisitor = new InterfaceVisitor();
    // Extra phases for the compiler
    // boxing visitor depends on boxing decl
    i = 1;
    for (PhasedUnit pu : listOfUnits) {
        if (sp != null)
            progressPreparation(2, i++, size, pu);
        pu.getCompilationUnit().visit(uv);
    }
    i = 1;
    for (PhasedUnit pu : listOfUnits) {
        if (sp != null)
            progressPreparation(3, i++, size, pu);
        pu.getCompilationUnit().visit(boxingDeclarationVisitor);
    }
    i = 1;
    // the others can run at the same time
    for (PhasedUnit pu : listOfUnits) {
        if (sp != null)
            progressPreparation(4, i++, size, pu);
        CompilationUnit compilationUnit = pu.getCompilationUnit();
        compilationUnit.visit(mnv);
        compilationUnit.visit(boxingVisitor);
        compilationUnit.visit(deferredVisitor);
        compilationUnit.visit(amv);
        compilationUnit.visit(dav);
        compilationUnit.visit(tpCaptureVisitor);
        compilationUnit.visit(localInterfaceVisitor);
    }
    i = 1;
    for (PhasedUnit pu : listOfUnits) {
        if (sp != null)
            progressPreparation(5, i++, size, pu);
        CompilationUnit compilationUnit = pu.getCompilationUnit();
        compilationUnit.visit(new WarningSuppressionVisitor<Warning>(Warning.class, pu.getSuppressedWarnings()));
    }
    collectTreeErrors(true, true);
}
Also used : CeylonCompilationUnit(com.redhat.ceylon.compiler.java.codegen.CeylonCompilationUnit) CompilationUnit(com.redhat.ceylon.compiler.typechecker.tree.Tree.CompilationUnit) JCCompilationUnit(com.sun.tools.javac.tree.JCTree.JCCompilationUnit) TypedDeclaration(com.redhat.ceylon.model.typechecker.model.TypedDeclaration) TypeParameterCaptureVisitor(com.redhat.ceylon.compiler.java.codegen.TypeParameterCaptureVisitor) Warning(com.redhat.ceylon.compiler.typechecker.analyzer.Warning) UsageWarning(com.redhat.ceylon.compiler.typechecker.analyzer.UsageWarning) AnnotationModelVisitor(com.redhat.ceylon.compiler.java.codegen.AnnotationModelVisitor) UnsupportedVisitor(com.redhat.ceylon.compiler.java.codegen.UnsupportedVisitor) CompilerBoxingDeclarationVisitor(com.redhat.ceylon.compiler.java.codegen.CompilerBoxingDeclarationVisitor) CeylonCompilationUnit(com.redhat.ceylon.compiler.java.codegen.CeylonCompilationUnit) CompilationUnit(com.redhat.ceylon.compiler.typechecker.tree.Tree.CompilationUnit) Unit(com.redhat.ceylon.model.typechecker.model.Unit) JCCompilationUnit(com.sun.tools.javac.tree.JCTree.JCCompilationUnit) CeylonPhasedUnit(com.redhat.ceylon.compiler.java.tools.CeylonPhasedUnit) PhasedUnit(com.redhat.ceylon.compiler.typechecker.context.PhasedUnit) DefiniteAssignmentVisitor(com.redhat.ceylon.compiler.java.codegen.DefiniteAssignmentVisitor) InterfaceVisitor(com.redhat.ceylon.compiler.java.codegen.InterfaceVisitor) CeylonPhasedUnit(com.redhat.ceylon.compiler.java.tools.CeylonPhasedUnit) PhasedUnit(com.redhat.ceylon.compiler.typechecker.context.PhasedUnit) JvmMissingNativeVisitor(com.redhat.ceylon.compiler.java.codegen.JvmMissingNativeVisitor) DeferredVisitor(com.redhat.ceylon.compiler.java.codegen.DeferredVisitor) CompilerBoxingVisitor(com.redhat.ceylon.compiler.java.codegen.CompilerBoxingVisitor) Setter(com.redhat.ceylon.model.typechecker.model.Setter) CompilerBoxingVisitor(com.redhat.ceylon.compiler.java.codegen.CompilerBoxingVisitor) BoxingVisitor(com.redhat.ceylon.compiler.java.codegen.BoxingVisitor) TypedDeclaration(com.redhat.ceylon.model.typechecker.model.TypedDeclaration) Declaration(com.redhat.ceylon.model.typechecker.model.Declaration) BoxingDeclarationVisitor(com.redhat.ceylon.compiler.java.codegen.BoxingDeclarationVisitor) CompilerBoxingDeclarationVisitor(com.redhat.ceylon.compiler.java.codegen.CompilerBoxingDeclarationVisitor)

Aggregations

AnnotationModelVisitor (com.redhat.ceylon.compiler.java.codegen.AnnotationModelVisitor)1 BoxingDeclarationVisitor (com.redhat.ceylon.compiler.java.codegen.BoxingDeclarationVisitor)1 BoxingVisitor (com.redhat.ceylon.compiler.java.codegen.BoxingVisitor)1 CeylonCompilationUnit (com.redhat.ceylon.compiler.java.codegen.CeylonCompilationUnit)1 CompilerBoxingDeclarationVisitor (com.redhat.ceylon.compiler.java.codegen.CompilerBoxingDeclarationVisitor)1 CompilerBoxingVisitor (com.redhat.ceylon.compiler.java.codegen.CompilerBoxingVisitor)1 DeferredVisitor (com.redhat.ceylon.compiler.java.codegen.DeferredVisitor)1 DefiniteAssignmentVisitor (com.redhat.ceylon.compiler.java.codegen.DefiniteAssignmentVisitor)1 InterfaceVisitor (com.redhat.ceylon.compiler.java.codegen.InterfaceVisitor)1 JvmMissingNativeVisitor (com.redhat.ceylon.compiler.java.codegen.JvmMissingNativeVisitor)1 TypeParameterCaptureVisitor (com.redhat.ceylon.compiler.java.codegen.TypeParameterCaptureVisitor)1 UnsupportedVisitor (com.redhat.ceylon.compiler.java.codegen.UnsupportedVisitor)1 CeylonPhasedUnit (com.redhat.ceylon.compiler.java.tools.CeylonPhasedUnit)1 UsageWarning (com.redhat.ceylon.compiler.typechecker.analyzer.UsageWarning)1 Warning (com.redhat.ceylon.compiler.typechecker.analyzer.Warning)1 PhasedUnit (com.redhat.ceylon.compiler.typechecker.context.PhasedUnit)1 CompilationUnit (com.redhat.ceylon.compiler.typechecker.tree.Tree.CompilationUnit)1 Declaration (com.redhat.ceylon.model.typechecker.model.Declaration)1 Setter (com.redhat.ceylon.model.typechecker.model.Setter)1 TypedDeclaration (com.redhat.ceylon.model.typechecker.model.TypedDeclaration)1