Examples of PhasedUnit


Examples of com.redhat.ceylon.compiler.typechecker.context.PhasedUnit

                    }
                    getOutput(pu).addSource(getFullPath(pu));
                }
            } else if(!phasedUnits.isEmpty() && !srcFiles.isEmpty()){
                final List<PhasedUnit> units = tc.getPhasedUnits().getPhasedUnits();
                PhasedUnit lastUnit = units.get(0);
                for (File path : srcFiles) {
                    if (path.getPath().endsWith(ArtifactContext.JS)) {
                        //Just output the file
                        final JsOutput lastOut = getOutput(lastUnit);
                        try (BufferedReader reader = new BufferedReader(new FileReader(path))) {
View Full Code Here

Examples of com.redhat.ceylon.compiler.typechecker.context.PhasedUnit

     * Return the PhasedUnit for a given relative path.
     * The path is relative to the source directory
     * eg ceylon/language/Object.ceylon
     */
    public PhasedUnit getPhasedUnitFromRelativePath(String relativePath) {
        PhasedUnit phasedUnit = phasedUnits.getPhasedUnitFromRelativePath(relativePath);
        if (phasedUnit == null) {
            for (PhasedUnits units : phasedUnitsOfDependencies) {
                phasedUnit = units.getPhasedUnitFromRelativePath(relativePath);
                if (phasedUnit != null) {
                    return phasedUnit;
View Full Code Here

Examples of com.redhat.ceylon.compiler.typechecker.context.PhasedUnit

            return phasedUnit;
        }
    }

    public PhasedUnit getPhasedUnit(VirtualFile file) {
        PhasedUnit phasedUnit = phasedUnits.getPhasedUnit(file);
        if (phasedUnit == null) {
            for (PhasedUnits units : phasedUnitsOfDependencies) {
                phasedUnit = units.getPhasedUnit(file);
                if (phasedUnit != null) {
                    return phasedUnit;
View Full Code Here

Examples of com.redhat.ceylon.compiler.typechecker.context.PhasedUnit

        if (ignoreMissingThrows) {
            return;
        }
       
        final Scope scope = d.getScope();
        final PhasedUnit unit = getUnit(d);
        final Node node = getNode(d);
        if (scope == null || unit == null || unit.getUnit() == null || node == null || !(d instanceof MethodOrValue)) {
            return;
        }
       
        List<ProducedType> documentedExceptions = new ArrayList<ProducedType>();
        for (Annotation annotation : d.getAnnotations()) {
            if (annotation.getName().equals("throws")) {
                String exceptionName = annotation.getPositionalArguments().get(0);
                Declaration exceptionDecl = scope.getMemberOrParameter(unit.getUnit(), exceptionName, null, false);
                if (exceptionDecl instanceof TypeDeclaration) {
                    documentedExceptions.add(((TypeDeclaration) exceptionDecl).getType());
                }
            }
        }
       
        final List<ProducedType> thrownExceptions = new ArrayList<ProducedType>();
        node.visitChildren(new Visitor() {
            @Override
            public void visit(Tree.Throw that) {
                Expression expression = that.getExpression();
                if (expression != null) {
                    thrownExceptions.add(expression.getTypeModel());
                } else {
                    thrownExceptions.add(unit.getUnit().getExceptionDeclaration().getType());
                }
            }
            @Override
            public void visit(Tree.Declaration that) {
                // the end of searching
View Full Code Here

Examples of com.redhat.ceylon.compiler.typechecker.context.PhasedUnit

        return false;
    }

    private void writeConstantValue(Value v) throws IOException {
        Node node = tool.getNode(v);
        PhasedUnit pu = tool.getUnit(v);
        if (pu == null || !(node instanceof Tree.AttributeDeclaration)) {
            return;
        }
       
        Tree.AttributeDeclaration attribute = (Tree.AttributeDeclaration) node;
View Full Code Here

Examples of com.redhat.ceylon.compiler.typechecker.context.PhasedUnit

   
    private String getParameterDefaultValue(Parameter param) throws IOException {
        String defaultValue = null;
       
        if( param.isDefaulted() ) {
            PhasedUnit pu = tool.getParameterUnit(param);
            Node paramNode = tool.getParameterNode(param);
            if (pu != null && paramNode instanceof Tree.Parameter) {
                Tree.SpecifierOrInitializerExpression defArg = getDefaultArgument((Tree.Parameter) paramNode);
                if (defArg != null) {
                    defaultValue = getSourceCode(pu, defArg.getExpression());
View Full Code Here

Examples of com.redhat.ceylon.compiler.typechecker.context.PhasedUnit

    private void writeParameterAssertions(Declaration decl, Map<Tree.Assertion, List<Tree.Condition>> parameterAssertions) throws IOException {
        if (parameterAssertions == null || parameterAssertions.isEmpty()) {
            return;
        }
       
        PhasedUnit pu = tool.getUnit(decl);
       
        open("div class='assertions' title='Parameter assertions'");
        open("ul");

        for (Tree.Assertion assertion : parameterAssertions.keySet()) {
View Full Code Here

Examples of com.redhat.ceylon.compiler.typechecker.context.PhasedUnit

        if (((Functional) decl).getParameterLists().isEmpty()) {
            return parametersAssertions;
        }

        Node node = tool.getNode(decl);
        PhasedUnit pu = tool.getUnit(decl);
        if (node == null || pu == null) {
            return parametersAssertions;
        }

        Tree.Body body = null;
View Full Code Here

Examples of com.redhat.ceylon.compiler.typechecker.context.PhasedUnit

        PhasedUnits phasedUnits = LanguageCompiler.getPhasedUnitsInstance(context);
       
        // find out what was in that file
        Assert.assertEquals(2, phasedUnits.getPhasedUnits().size());
        PhasedUnit one = phasedUnits.getPhasedUnits().get(0);
        PhasedUnit two = phasedUnits.getPhasedUnits().get(1);
        PhasedUnit phasedUnit = one.getUnitFile().getName().endsWith("module.ceylon")
                ? two : one;
        final Map<String,Declaration> decls = new HashMap<String,Declaration>();
        for(Declaration decl : phasedUnit.getUnit().getDeclarations()){
            if(decl.isToplevel()){
                decls.put(getQualifiedPrefixedName(decl), decl);
            }
        }
View Full Code Here

Examples of com.redhat.ceylon.compiler.typechecker.context.PhasedUnit

           
            String source = readSource.toString();
            char[] chars = source.toCharArray();
            LineMap map = Position.makeLineMap(chars, chars.length, false);
           
            PhasedUnit phasedUnit = null;
           
            PhasedUnit externalPhasedUnit = compilerDelegate.getExternalSourcePhasedUnit(srcDir, file);
           
            String suppressWarnings = options.get(OptionName.CEYLONSUPPRESSWARNINGS);
            final EnumSet<Warning> suppressedWarnings;
            if (suppressWarnings != null) {
                if (suppressWarnings.trim().isEmpty()) {
                    suppressedWarnings = EnumSet.allOf(Warning.class);
                } else {
                    suppressedWarnings = EnumSet.noneOf(Warning.class);
                    for (String name : suppressWarnings.trim().split(" *, *")) {
                        suppressedWarnings.add(Warning.valueOf(name));
                    }
                }
            } else {
                suppressedWarnings = EnumSet.noneOf(Warning.class);
            }
           
            if (externalPhasedUnit != null) {
                phasedUnit = new CeylonPhasedUnit(externalPhasedUnit, filename, map);
                phasedUnit.setSuppressedWarnings(suppressedWarnings);
                phasedUnits.addPhasedUnit(externalPhasedUnit.getUnitFile(), phasedUnit);
                gen.setMap(map);
               
                String pkgName = phasedUnit.getPackage().getQualifiedNameString();
                if ("".equals(pkgName)) {
                    pkgName = null;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.