Search in sources :

Example 1 with EeVisitor

use of org.eclipse.ceylon.compiler.java.codegen.EeVisitor in project ceylon by eclipse.

the class CeylonEnter method typeCheck.

private void typeCheck() {
    final java.util.List<PhasedUnit> listOfUnits = phasedUnits.getPhasedUnits();
    Module jdk = modelLoader.getJDKBaseModule();
    Package javaLangPackage = jdk.getPackage("java.lang");
    for (PhasedUnit pu : listOfUnits) {
        pu.getUnit().setJavaLangPackage(javaLangPackage);
    }
    // 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));
            }
        }
    }
    EeVisitor eeVisitor = gen.getEeVisitor();
    UnsupportedVisitor uv = new UnsupportedVisitor(eeVisitor);
    JvmMissingNativeVisitor mnv = new JvmMissingNativeVisitor();
    BoxingDeclarationVisitor boxingDeclarationVisitor = new CompilerBoxingDeclarationVisitor(gen);
    BoxingVisitor boxingVisitor = new CompilerBoxingVisitor(gen);
    SmallDeclarationVisitor smallDeclarationVisitor = new SmallDeclarationVisitor();
    SmallVisitor smallVisitor = new SmallVisitor();
    DeferredVisitor deferredVisitor = new DeferredVisitor();
    AnnotationDeclarationVisitor adv = new AnnotationDeclarationVisitor(gen);
    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(eeVisitor);
        pu.getCompilationUnit().visit(uv);
        pu.getCompilationUnit().visit(adv);
    }
    i = 1;
    for (PhasedUnit pu : listOfUnits) {
        if (sp != null)
            progressPreparation(3, i++, size, pu);
        pu.getCompilationUnit().visit(boxingDeclarationVisitor);
        pu.getCompilationUnit().visit(smallDeclarationVisitor);
        pu.getCompilationUnit().visit(amv);
    }
    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(smallVisitor);
        compilationUnit.visit(deferredVisitor);
        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 : UsageWarning(org.eclipse.ceylon.compiler.typechecker.analyzer.UsageWarning) Warning(org.eclipse.ceylon.compiler.typechecker.analyzer.Warning) AnnotationModelVisitor(org.eclipse.ceylon.compiler.java.codegen.AnnotationModelVisitor) CompilerBoxingDeclarationVisitor(org.eclipse.ceylon.compiler.java.codegen.CompilerBoxingDeclarationVisitor) Unit(org.eclipse.ceylon.model.typechecker.model.Unit) CeylonCompilationUnit(org.eclipse.ceylon.compiler.java.codegen.CeylonCompilationUnit) CompilationUnit(org.eclipse.ceylon.compiler.typechecker.tree.Tree.CompilationUnit) PhasedUnit(org.eclipse.ceylon.compiler.typechecker.context.PhasedUnit) JCCompilationUnit(org.eclipse.ceylon.langtools.tools.javac.tree.JCTree.JCCompilationUnit) CeylonPhasedUnit(org.eclipse.ceylon.compiler.java.tools.CeylonPhasedUnit) DefiniteAssignmentVisitor(org.eclipse.ceylon.compiler.java.codegen.DefiniteAssignmentVisitor) PhasedUnit(org.eclipse.ceylon.compiler.typechecker.context.PhasedUnit) CeylonPhasedUnit(org.eclipse.ceylon.compiler.java.tools.CeylonPhasedUnit) SmallDeclarationVisitor(org.eclipse.ceylon.compiler.java.codegen.SmallDeclarationVisitor) AnnotationDeclarationVisitor(org.eclipse.ceylon.compiler.java.codegen.AnnotationDeclarationVisitor) Declaration(org.eclipse.ceylon.model.typechecker.model.Declaration) TypedDeclaration(org.eclipse.ceylon.model.typechecker.model.TypedDeclaration) EeVisitor(org.eclipse.ceylon.compiler.java.codegen.EeVisitor) CompilerBoxingDeclarationVisitor(org.eclipse.ceylon.compiler.java.codegen.CompilerBoxingDeclarationVisitor) BoxingDeclarationVisitor(org.eclipse.ceylon.compiler.java.codegen.BoxingDeclarationVisitor) CeylonCompilationUnit(org.eclipse.ceylon.compiler.java.codegen.CeylonCompilationUnit) CompilationUnit(org.eclipse.ceylon.compiler.typechecker.tree.Tree.CompilationUnit) JCCompilationUnit(org.eclipse.ceylon.langtools.tools.javac.tree.JCTree.JCCompilationUnit) TypedDeclaration(org.eclipse.ceylon.model.typechecker.model.TypedDeclaration) TypeParameterCaptureVisitor(org.eclipse.ceylon.compiler.java.codegen.TypeParameterCaptureVisitor) UnsupportedVisitor(org.eclipse.ceylon.compiler.java.codegen.UnsupportedVisitor) InterfaceVisitor(org.eclipse.ceylon.compiler.java.codegen.InterfaceVisitor) JvmMissingNativeVisitor(org.eclipse.ceylon.compiler.java.codegen.JvmMissingNativeVisitor) DeferredVisitor(org.eclipse.ceylon.compiler.java.codegen.DeferredVisitor) CompilerBoxingVisitor(org.eclipse.ceylon.compiler.java.codegen.CompilerBoxingVisitor) SmallVisitor(org.eclipse.ceylon.compiler.java.codegen.SmallVisitor) Setter(org.eclipse.ceylon.model.typechecker.model.Setter) CompilerBoxingVisitor(org.eclipse.ceylon.compiler.java.codegen.CompilerBoxingVisitor) BoxingVisitor(org.eclipse.ceylon.compiler.java.codegen.BoxingVisitor) Package(org.eclipse.ceylon.model.typechecker.model.Package) Module(org.eclipse.ceylon.model.typechecker.model.Module) LazyModule(org.eclipse.ceylon.model.loader.model.LazyModule)

Aggregations

AnnotationDeclarationVisitor (org.eclipse.ceylon.compiler.java.codegen.AnnotationDeclarationVisitor)1 AnnotationModelVisitor (org.eclipse.ceylon.compiler.java.codegen.AnnotationModelVisitor)1 BoxingDeclarationVisitor (org.eclipse.ceylon.compiler.java.codegen.BoxingDeclarationVisitor)1 BoxingVisitor (org.eclipse.ceylon.compiler.java.codegen.BoxingVisitor)1 CeylonCompilationUnit (org.eclipse.ceylon.compiler.java.codegen.CeylonCompilationUnit)1 CompilerBoxingDeclarationVisitor (org.eclipse.ceylon.compiler.java.codegen.CompilerBoxingDeclarationVisitor)1 CompilerBoxingVisitor (org.eclipse.ceylon.compiler.java.codegen.CompilerBoxingVisitor)1 DeferredVisitor (org.eclipse.ceylon.compiler.java.codegen.DeferredVisitor)1 DefiniteAssignmentVisitor (org.eclipse.ceylon.compiler.java.codegen.DefiniteAssignmentVisitor)1 EeVisitor (org.eclipse.ceylon.compiler.java.codegen.EeVisitor)1 InterfaceVisitor (org.eclipse.ceylon.compiler.java.codegen.InterfaceVisitor)1 JvmMissingNativeVisitor (org.eclipse.ceylon.compiler.java.codegen.JvmMissingNativeVisitor)1 SmallDeclarationVisitor (org.eclipse.ceylon.compiler.java.codegen.SmallDeclarationVisitor)1 SmallVisitor (org.eclipse.ceylon.compiler.java.codegen.SmallVisitor)1 TypeParameterCaptureVisitor (org.eclipse.ceylon.compiler.java.codegen.TypeParameterCaptureVisitor)1 UnsupportedVisitor (org.eclipse.ceylon.compiler.java.codegen.UnsupportedVisitor)1 CeylonPhasedUnit (org.eclipse.ceylon.compiler.java.tools.CeylonPhasedUnit)1 UsageWarning (org.eclipse.ceylon.compiler.typechecker.analyzer.UsageWarning)1 Warning (org.eclipse.ceylon.compiler.typechecker.analyzer.Warning)1 PhasedUnit (org.eclipse.ceylon.compiler.typechecker.context.PhasedUnit)1