Search in sources :

Example 1 with DefaultParameterMethodOwner

use of org.eclipse.ceylon.compiler.java.codegen.Strategy.DefaultParameterMethodOwner in project ceylon by eclipse.

the class NamedArgumentInvocation method buildVars.

/**
 * Constructs the vars used in the Let expression
 */
private void buildVars() {
    if (getPrimaryDeclaration() == null) {
        return;
    }
    boolean prev = gen.expressionGen().withinInvocation(false);
    java.util.List<Tree.NamedArgument> namedArguments = namedArgumentList.getNamedArguments();
    SequencedArgument sequencedArgument = namedArgumentList.getSequencedArgument();
    java.util.List<ParameterList> paramLists = ((Functional) getPrimaryDeclaration()).getParameterLists();
    java.util.List<Parameter> declaredParams = paramLists.get(0).getParameters();
    appendVarsForNamedArguments(namedArguments, declaredParams);
    appendVarsForReifiedTypeArguments();
    if (sequencedArgument != null)
        appendVarsForSequencedArguments(sequencedArgument, declaredParams);
    boolean hasDefaulted = appendVarsForDefaulted(declaredParams);
    DefaultParameterMethodOwner owner = Strategy.defaultParameterMethodOwner(getPrimaryDeclaration());
    if (hasDefaulted && owner != DefaultParameterMethodOwner.STATIC && owner != DefaultParameterMethodOwner.OUTER && owner != DefaultParameterMethodOwner.OUTER_COMPANION) {
        vars.prepend(makeThis());
    }
    gen.expressionGen().withinInvocation(prev);
}
Also used : Functional(org.eclipse.ceylon.model.typechecker.model.Functional) DefaultParameterMethodOwner(org.eclipse.ceylon.compiler.java.codegen.Strategy.DefaultParameterMethodOwner) ParameterList(org.eclipse.ceylon.model.typechecker.model.ParameterList) Parameter(org.eclipse.ceylon.model.typechecker.model.Parameter) SequencedArgument(org.eclipse.ceylon.compiler.typechecker.tree.Tree.SequencedArgument)

Aggregations

DefaultParameterMethodOwner (org.eclipse.ceylon.compiler.java.codegen.Strategy.DefaultParameterMethodOwner)1 SequencedArgument (org.eclipse.ceylon.compiler.typechecker.tree.Tree.SequencedArgument)1 Functional (org.eclipse.ceylon.model.typechecker.model.Functional)1 Parameter (org.eclipse.ceylon.model.typechecker.model.Parameter)1 ParameterList (org.eclipse.ceylon.model.typechecker.model.ParameterList)1