Search in sources :

Example 1 with MemberOrTypeExpression

use of org.eclipse.ceylon.compiler.typechecker.tree.Tree.MemberOrTypeExpression in project ceylon by eclipse.

the class SelfReferenceVisitor method visit.

@Override
public void visit(Tree.AssignmentOp that) {
    super.visit(that);
    if (inBody()) {
        Tree.Term lt = that.getLeftTerm();
        Tree.Term rt = that.getRightTerm();
        if (lt instanceof Tree.MemberOrTypeExpression && rt instanceof Tree.This) {
            MemberOrTypeExpression mte = (Tree.MemberOrTypeExpression) lt;
            Declaration d = mte.getDeclaration();
            if (d instanceof FunctionOrValue) {
                FunctionOrValue fov = (FunctionOrValue) d;
                if (fov.isLate()) {
                    // NOTE: EARLY EXIT!!
                    return;
                }
            }
        }
        checkSelfReference(that, rt);
    }
}
Also used : MemberOrTypeExpression(org.eclipse.ceylon.compiler.typechecker.tree.Tree.MemberOrTypeExpression) CustomTree(org.eclipse.ceylon.compiler.typechecker.tree.CustomTree) Tree(org.eclipse.ceylon.compiler.typechecker.tree.Tree) MemberOrTypeExpression(org.eclipse.ceylon.compiler.typechecker.tree.Tree.MemberOrTypeExpression) TypedDeclaration(org.eclipse.ceylon.model.typechecker.model.TypedDeclaration) TypeDeclaration(org.eclipse.ceylon.model.typechecker.model.TypeDeclaration) Declaration(org.eclipse.ceylon.model.typechecker.model.Declaration) FunctionOrValue(org.eclipse.ceylon.model.typechecker.model.FunctionOrValue)

Example 2 with MemberOrTypeExpression

use of org.eclipse.ceylon.compiler.typechecker.tree.Tree.MemberOrTypeExpression in project ceylon by eclipse.

the class BoxingVisitor method visit.

@Override
public void visit(Expression that) {
    Stack<Boolean> npebs = setPEB();
    super.visit(that);
    resetPEB(npebs);
    Term term = that.getTerm();
    propagateFromTerm(that, term);
    // which will need to be marked boxed
    if (term instanceof MemberOrTypeExpression) {
        Tree.MemberOrTypeExpression expr = (Tree.MemberOrTypeExpression) term;
        if (expr.getDeclaration() instanceof Function) {
            that.setUnboxed(false);
        }
    }
}
Also used : Function(org.eclipse.ceylon.model.typechecker.model.Function) MemberOrTypeExpression(org.eclipse.ceylon.compiler.typechecker.tree.Tree.MemberOrTypeExpression) Tree(org.eclipse.ceylon.compiler.typechecker.tree.Tree) Term(org.eclipse.ceylon.compiler.typechecker.tree.Tree.Term) TreeUtil.unwrapExpressionUntilTerm(org.eclipse.ceylon.compiler.typechecker.tree.TreeUtil.unwrapExpressionUntilTerm) StaticMemberOrTypeExpression(org.eclipse.ceylon.compiler.typechecker.tree.Tree.StaticMemberOrTypeExpression) MemberOrTypeExpression(org.eclipse.ceylon.compiler.typechecker.tree.Tree.MemberOrTypeExpression)

Aggregations

Tree (org.eclipse.ceylon.compiler.typechecker.tree.Tree)2 MemberOrTypeExpression (org.eclipse.ceylon.compiler.typechecker.tree.Tree.MemberOrTypeExpression)2 CustomTree (org.eclipse.ceylon.compiler.typechecker.tree.CustomTree)1 StaticMemberOrTypeExpression (org.eclipse.ceylon.compiler.typechecker.tree.Tree.StaticMemberOrTypeExpression)1 Term (org.eclipse.ceylon.compiler.typechecker.tree.Tree.Term)1 TreeUtil.unwrapExpressionUntilTerm (org.eclipse.ceylon.compiler.typechecker.tree.TreeUtil.unwrapExpressionUntilTerm)1 Declaration (org.eclipse.ceylon.model.typechecker.model.Declaration)1 Function (org.eclipse.ceylon.model.typechecker.model.Function)1 FunctionOrValue (org.eclipse.ceylon.model.typechecker.model.FunctionOrValue)1 TypeDeclaration (org.eclipse.ceylon.model.typechecker.model.TypeDeclaration)1 TypedDeclaration (org.eclipse.ceylon.model.typechecker.model.TypedDeclaration)1