Search in sources :

Example 76 with Declaration

use of org.eclipse.ceylon.model.typechecker.model.Declaration in project ceylon by eclipse.

the class Decl method isPrivateAccessRequiringCompanion.

public static boolean isPrivateAccessRequiringCompanion(Tree.StaticMemberOrTypeExpression qual) {
    if (qual instanceof Tree.QualifiedMemberOrTypeExpression) {
        Tree.Primary primary = ((Tree.QualifiedMemberOrTypeExpression) qual).getPrimary();
        Declaration decl = qual.getDeclaration();
        return decl.isMember() && !decl.isShared() && decl.getContainer() instanceof Interface && !Decl.hasScopeInType(decl.getContainer(), primary.getTypeModel());
    }
    return false;
}
Also used : Tree(org.eclipse.ceylon.compiler.typechecker.tree.Tree) TypedDeclaration(org.eclipse.ceylon.model.typechecker.model.TypedDeclaration) TypeDeclaration(org.eclipse.ceylon.model.typechecker.model.TypeDeclaration) Declaration(org.eclipse.ceylon.model.typechecker.model.Declaration) AttributeDeclaration(org.eclipse.ceylon.compiler.typechecker.tree.Tree.AttributeDeclaration) Interface(org.eclipse.ceylon.model.typechecker.model.Interface) ClassOrInterface(org.eclipse.ceylon.model.typechecker.model.ClassOrInterface) LazyInterface(org.eclipse.ceylon.model.loader.model.LazyInterface)

Example 77 with Declaration

use of org.eclipse.ceylon.model.typechecker.model.Declaration in project ceylon by eclipse.

the class DefiniteAssignmentVisitor method visit.

public void visit(Tree.SpecifierStatement stmt) {
    Tree.Term bme = stmt.getBaseMemberExpression();
    if (bme instanceof Tree.MemberOrTypeExpression) {
        Declaration decl = ((Tree.MemberOrTypeExpression) bme).getDeclaration();
        if (// non-variable and deferred
        tracked.containsKey(decl) && // specification is in a for/else
        forBlock != null && !forBlock.equals(tracked.get(decl))) {
            // not declared in *this* for/else
            if (elseBlock == null) {
                ((Value) decl).setSpecifiedInForElse(true);
            }
            ControlBlock assigningBlock = elseBlock != null ? elseBlock : forBlock;
            addSpecified(decl, assigningBlock);
        }
    }
    super.visit(stmt);
}
Also used : ControlBlock(org.eclipse.ceylon.model.typechecker.model.ControlBlock) Value(org.eclipse.ceylon.model.typechecker.model.Value) Tree(org.eclipse.ceylon.compiler.typechecker.tree.Tree) Declaration(org.eclipse.ceylon.model.typechecker.model.Declaration)

Example 78 with Declaration

use of org.eclipse.ceylon.model.typechecker.model.Declaration in project ceylon by eclipse.

the class SmallDeclarationVisitor method visit.

@Override
public void visit(Tree.SpecifierStatement that) {
    Declaration d = that.getDeclaration();
    if (d == null) {
        if (that.getBaseMemberExpression() instanceof Tree.MemberOrTypeExpression) {
            d = ((Tree.MemberOrTypeExpression) that.getBaseMemberExpression()).getDeclaration();
        }
    }
    // Declaration prevd = declaration;
    // declaration = d;
    smallDeclaration(d);
    super.visit(that);
// declaration = prevd;
}
Also used : Tree(org.eclipse.ceylon.compiler.typechecker.tree.Tree) Declaration(org.eclipse.ceylon.model.typechecker.model.Declaration)

Example 79 with Declaration

use of org.eclipse.ceylon.model.typechecker.model.Declaration in project ceylon by eclipse.

the class SmallVisitor method visit.

@Override
public void visit(Tree.WithinOp that) {
    Declaration preva = assigning;
    assigning = NON_SMALLABLE;
    super.visit(that);
    assigning = preva;
    if (that.getLowerBound().getSmall() && that.getUpperBound().getSmall() && that.getTerm().getSmall()) {
        markSmall(that);
    }
}
Also used : Declaration(org.eclipse.ceylon.model.typechecker.model.Declaration)

Example 80 with Declaration

use of org.eclipse.ceylon.model.typechecker.model.Declaration in project ceylon by eclipse.

the class SmallVisitor method visit.

@Override
public void visit(Tree.AnyMethod that) {
    Declaration preva = assigning;
    assigning = that.getDeclarationModel().getRefinedDeclaration();
    super.visit(that);
    assigning = preva;
}
Also used : Declaration(org.eclipse.ceylon.model.typechecker.model.Declaration)

Aggregations

Declaration (org.eclipse.ceylon.model.typechecker.model.Declaration)370 TypeDeclaration (org.eclipse.ceylon.model.typechecker.model.TypeDeclaration)309 TypedDeclaration (org.eclipse.ceylon.model.typechecker.model.TypedDeclaration)264 Tree (org.eclipse.ceylon.compiler.typechecker.tree.Tree)129 Type (org.eclipse.ceylon.model.typechecker.model.Type)100 Class (org.eclipse.ceylon.model.typechecker.model.Class)78 TypeParameter (org.eclipse.ceylon.model.typechecker.model.TypeParameter)74 Value (org.eclipse.ceylon.model.typechecker.model.Value)73 ClassOrInterface (org.eclipse.ceylon.model.typechecker.model.ClassOrInterface)72 Function (org.eclipse.ceylon.model.typechecker.model.Function)71 FunctionOrValue (org.eclipse.ceylon.model.typechecker.model.FunctionOrValue)71 AnalyzerUtil.getTypedDeclaration (org.eclipse.ceylon.compiler.typechecker.analyzer.AnalyzerUtil.getTypedDeclaration)63 ArrayList (java.util.ArrayList)61 AnalyzerUtil.getPackageTypeDeclaration (org.eclipse.ceylon.compiler.typechecker.analyzer.AnalyzerUtil.getPackageTypeDeclaration)60 AnalyzerUtil.getTypeDeclaration (org.eclipse.ceylon.compiler.typechecker.analyzer.AnalyzerUtil.getTypeDeclaration)60 ModelUtil.getNativeDeclaration (org.eclipse.ceylon.model.typechecker.model.ModelUtil.getNativeDeclaration)57 AnalyzerUtil.getPackageTypedDeclaration (org.eclipse.ceylon.compiler.typechecker.analyzer.AnalyzerUtil.getPackageTypedDeclaration)51 Scope (org.eclipse.ceylon.model.typechecker.model.Scope)50 Constructor (org.eclipse.ceylon.model.typechecker.model.Constructor)48 CustomTree (org.eclipse.ceylon.compiler.typechecker.tree.CustomTree)45