Search in sources :

Example 1 with StaticMemberOrTypeExpression

use of com.redhat.ceylon.compiler.typechecker.tree.Tree.StaticMemberOrTypeExpression in project ceylon-compiler by ceylon.

the class BoxingVisitor method visit.

@Override
public void visit(InvocationExpression that) {
    super.visit(that);
    if (isIndirectInvocation(that) && !Decl.isJavaStaticOrInterfacePrimary(that.getPrimary())) {
        // if the Callable is raw the invocation will be erased
        if (that.getPrimary().getTypeModel() != null && isRaw(that.getPrimary().getTypeModel()))
            CodegenUtil.markTypeErased(that);
        // These are always boxed
        return;
    }
    if (isByteLiteral(that))
        CodegenUtil.markUnBoxed(that);
    else
        propagateFromTerm(that, that.getPrimary());
    // then we mark the expression itself as erased as well
    if (that.getPrimary() instanceof StaticMemberOrTypeExpression) {
        StaticMemberOrTypeExpression expr = (StaticMemberOrTypeExpression) that.getPrimary();
        if (expr.getDeclaration() instanceof Function) {
            Function mth = (Function) expr.getDeclaration();
            if (isTypeParameter(mth.getType()) && (hasErasedTypeParameter(expr.getTarget(), expr.getTypeArguments()) || CodegenUtil.isRaw(that))) {
                CodegenUtil.markTypeErased(that);
                CodegenUtil.markUntrustedType(that);
            }
        }
    }
}
Also used : Function(com.redhat.ceylon.model.typechecker.model.Function) StaticMemberOrTypeExpression(com.redhat.ceylon.compiler.typechecker.tree.Tree.StaticMemberOrTypeExpression)

Aggregations

StaticMemberOrTypeExpression (com.redhat.ceylon.compiler.typechecker.tree.Tree.StaticMemberOrTypeExpression)1 Function (com.redhat.ceylon.model.typechecker.model.Function)1