Package com.redhat.ceylon.compiler.typechecker.io

Examples of com.redhat.ceylon.compiler.typechecker.io.ClosableVirtualFile


            ModuleHelper.buildErrorOnMissingArtifact(artifactContext, module, moduleImport, dependencyTree, exceptionOnGetArtifact, this);
        }
        else {
           
            PhasedUnits modulePhasedUnits = createPhasedUnits();
            ClosableVirtualFile virtualArtifact= null;
            try {
                virtualArtifact = context.getVfs().getFromZipFile(sourceArtifact.artifact());
                modulePhasedUnits.parseUnit(virtualArtifact);
                //populate module.getDependencies()
                modulePhasedUnits.visitModules();
                addToPhasedUnitsOfDependencies(modulePhasedUnits, phasedUnitsOfDependencies, module);
            } catch (Exception e) {
                StringBuilder error = new StringBuilder("unable to read source artifact for ");
                error.append(artifactContext.toString());
                error.append( "\ndue to connection error: ").append(e.getMessage());
                attachErrorToDependencyDeclaration(moduleImport, dependencyTree, error.toString());
            } finally {
                if (virtualArtifact != null) {
                    virtualArtifact.close();
                }
            }
        }
    }
View Full Code Here


                .addSrcDirectory( new File("test/moduledep2") )
                .addSrcDirectory( new File("test/moduletest") )
                .getTypeChecker();
        typeChecker.process();

        ClosableVirtualFile latestZippedLanguageSourceFile = MainHelper.getLatestZippedLanguageSourceFile();
        typeChecker = new TypeCheckerBuilder()
                .verbose(false)
                .addSrcDirectory( latestZippedLanguageSourceFile )
                .getTypeChecker();
        typeChecker.process();
        latestZippedLanguageSourceFile.close();
        System.out.println("Tests took " + ( (System.nanoTime()-start) / 1000000 ) + " ms");
    }
View Full Code Here

    /**
     * Files that are not under a proper module structure are
     * placed under a <nomodule> module.
     */
    public static void main(String[] args) throws Exception {
        ClosableVirtualFile latestZippedLanguageSourceFile = MainHelper.getLatestZippedLanguageSourceFile();
        new TypeCheckerBuilder()
                .verbose(false)
                .addSrcDirectory(latestZippedLanguageSourceFile)
                .getTypeChecker()
                .process();
        latestZippedLanguageSourceFile.close();
    }
View Full Code Here

    public void compareNativeRuntimeWithJavaRuntime() {
        // parse the ceylon sources from the language module and
        // build a map of all the native declarations
        final Map<String, Declaration> nativeFromSource = new HashMap<String, Declaration>();
       
        ClosableVirtualFile latestZippedLanguageSourceFile = getLatestZippedLanguageSourceFile();
        try {
            TypeCheckerBuilder typeCheckerBuilder = new TypeCheckerBuilder()
                    .verbose(false)
                    .addSrcDirectory(latestZippedLanguageSourceFile);
            TypeChecker typeChecker = typeCheckerBuilder.getTypeChecker();
            typeChecker.process();
            for (PhasedUnit pu : typeChecker.getPhasedUnits().getPhasedUnits()) {
                for (Declaration d : pu.getDeclarations()) {
                    if (d.isNative() && d.isToplevel()) {
                        String qualifiedNameString = d.getQualifiedNameString();
                        String key = d.getDeclarationKind()+":"+qualifiedNameString;
                        Declaration prev = nativeFromSource.put(key, d);
                        if (prev != null) {
                            Assert.fail("Two declarations with the same key " + key + ": " + d + " and: " + prev);
                        }
                    }
                }
            }
        } finally {
            latestZippedLanguageSourceFile.close();
        }
        System.out.println(nativeFromSource);
       
        // now compile something (it doesn't matter what, we just need
        // to get our hands on from-binary models for the language module)
View Full Code Here

TOP

Related Classes of com.redhat.ceylon.compiler.typechecker.io.ClosableVirtualFile

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.