Package com.redhat.ceylon.compiler.typechecker.model

Examples of com.redhat.ceylon.compiler.typechecker.model.Value


            else {
                that.addError("declaration is not a value, and may not be annotated late");
            }
        }
        if (model instanceof Value) {
            Value value = (Value) model;
            if (value.isVariable() && value.isTransient()) {
                that.addError("getter may not be annotated variable: '" + model.getName() + "'");
            }
        }
        if (hasAnnotation(al, "deprecated", unit)) {
            model.setDeprecated(true);
View Full Code Here


   
    @Override
    public void visit(Tree.AttributeDeclaration that) {
        super.visit(that);
        Tree.SpecifierOrInitializerExpression sie = that.getSpecifierOrInitializerExpression();
        Value dec = that.getDeclarationModel();
        if (dec!=null && dec.isParameter() &&
                dec.getInitializerParameter().isHidden()) {
            Parameter param = dec.getInitializerParameter();
            if (that.getType() instanceof Tree.SequencedType) {
                param.setSequenced(true);
                param.setAtLeastOne(((Tree.SequencedType)that.getType()).getAtLeastOne());
            }
            if (sie!=null) {
                sie.addError("value is an initializer parameter and may not have an initial value: '" +
                        dec.getName() + "'");
            }
        }
    }
View Full Code Here

    }
   
    @Override
    public void visit(Tree.AttributeGetterDefinition that) {
        super.visit(that);
        Value dec = that.getDeclarationModel();
        if (dec!=null && dec.isParameter() &&
                dec.getInitializerParameter().isHidden()) {
            that.getBlock().addError("value is an initializer parameter and may not have a body: '" +
                    dec.getName() + "'");
        }
    }
View Full Code Here

        }
    }

    public boolean isLegalParameter(Declaration a) {
        if (a instanceof Value) {
            Value v = (Value) a;
            return !v.isTransient() &&
                    (v.getTypeDeclaration()==null ||
                    !v.getTypeDeclaration().isAnonymous());
        }
        else if (a instanceof Method) {
            return true;
        }
        else {
View Full Code Here

            if (d.isDefault()) {
                modifiers.append("default ");
            }
        }
        if (Decl.isValue(d)) {
            Value v = (Value) d;
            if (v.isVariable()) {
                modifiers.append("variable ");
            }
        } else if (d instanceof Class) {
            Class c = (Class) d;
            if (c.isAbstract()) {
View Full Code Here

        close("tr");
    }
   
    private boolean isConstantValue(Declaration d) {
        if(Decl.isValue(d)) {
            Value value = (Value) d;
            if( value.isShared() && !value.isVariable() ) {
                Unit unit = value.getUnit();
                TypeDeclaration type = value.getTypeDeclaration();
               
                if (type == unit.getSequentialDeclaration()) {
                    ProducedType elementType = unit.getIteratedType(value.getType());
                    type = elementType.getDeclaration();
                }

                if (unit.getStringDeclaration().equals(type)
                        || unit.getIntegerDeclaration().equals(type)
View Full Code Here

                Method equalsMethod = (Method) javaType.getDirectMember("equals", null, false);
                Assert.assertNotNull(equalsMethod);
                Assert.assertTrue(equalsMethod.isActual());
                Assert.assertTrue(equalsMethod.getRefinedDeclaration() != equalsMethod);

                Value hashAttribute = (Value) javaType.getDirectMember("hash", null, false);
                Assert.assertNotNull(hashAttribute);
                Assert.assertTrue(hashAttribute.isActual());
                Assert.assertTrue(hashAttribute.getRefinedDeclaration() != hashAttribute);

                Value stringAttribute = (Value) javaType.getDirectMember("string", null, false);
                Assert.assertNotNull(stringAttribute);
                Assert.assertTrue(stringAttribute.isActual());
                Assert.assertTrue(stringAttribute.getRefinedDeclaration() != stringAttribute);

                Method cloneMethod = (Method) javaType.getDirectMember("clone", null, false);
                Assert.assertNotNull(cloneMethod);
                Assert.assertFalse(cloneMethod.isActual());
                Assert.assertTrue(cloneMethod.getRefinedDeclaration() == cloneMethod);
View Full Code Here

               
                Parameter javaParameter = javaMethod.getParameterLists().get(0).getParameters().get(0);
                Assert.assertNotNull(javaParameter);
                Assert.assertEquals(javaParameter.toString(), 1, numDeprecated(javaParameter.getModel()));
               
                Value javaField = (Value) javaDep.getDirectMember("s", null, false);
                Assert.assertNotNull(javaField);
                Assert.assertEquals(javaField.toString(), 1, numDeprecated(javaField));
               
                // Check there is only 1 model Annotation, when annotation with ceylon's deprecated...
                javaMethod = (Method) javaDep.getDirectMember("ceylonDeprecation", null, false);
                Assert.assertNotNull(javaMethod);
                Assert.assertEquals(javaMethod.toString(), 1, numDeprecated(javaMethod));
View Full Code Here

                    exists.getVariable());
        }
       
        @Override
        public JCExpression makeResultExpr() {
            Value decl = this.cond.getVariable().getDeclarationModel();
            ProducedType exprType = this.specifierExpr.getTypeModel();
            if (isOptional(exprType)) {
                exprType = typeFact().getDefiniteType(exprType);
            }
            return expressionGen().applyErasureAndBoxing(testVar.makeIdent(),
                    exprType, willEraseToObject(decl.getType()), true,
                    CodegenUtil.getBoxingStrategy(decl),
                    decl.getType(), 0);
        }
View Full Code Here

            return makeNull();
        }
       
        @Override
        public JCExpression makeResultExpr() {
            Value decl = this.cond.getVariable().getDeclarationModel();
            return expressionGen().applyErasureAndBoxing(testVar.makeIdent(),
                    typeFact().getDefiniteType(this.specifierExpr.getTypeModel()), false, true,
                    BoxingStrategy.BOXED,
                    decl.getType(),
                    ExpressionTransformer.EXPR_DOWN_CAST);
        }
View Full Code Here

TOP

Related Classes of com.redhat.ceylon.compiler.typechecker.model.Value

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.