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

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


        String attrName = decl.getName();
        return findParamForDecl(attrName, decl);
    }
   
    static Parameter findParamForDecl(String attrName, TypedDeclaration decl) {
        Parameter result = null;
        if (decl.getContainer() instanceof Functional) {
            Functional f = (Functional)decl.getContainer();
            result = f.getParameter(attrName);
        }
        return result;
View Full Code Here


        return getSourceParameter();
    }

    @Override
    public int encode(AbstractTransformer gen, ListBuffer<JCExpression> instantiations) {
        Parameter parameter = getSourceParameter();
        int index = ((Functional)parameter.getDeclaration()).getParameterLists().get(0).getParameters().indexOf(parameter);
        if (isSpread()) {
            index += 256;
        }
        return index;
    }
View Full Code Here

            ExpressionTransformer exprGen,
            AnnotationInvocation ai,
            com.sun.tools.javac.util.List<AnnotationFieldName> parameterPath) {
        ListBuffer<JCExpression> args = ListBuffer.<JCExpression>lb();
        for (AnnotationArgument aa : getAnnotationArguments()) {
            Parameter name = aa.getParameter();
            if (!isInstantiation()) {
                AnnotationInvocation annotationInvocation = (AnnotationInvocation)getConstructorDeclaration().getAnnotationConstructor();
                for (AnnotationArgument a2 : annotationInvocation.getAnnotationArguments()) {
                    if (a2.getTerm() instanceof ParameterAnnotationTerm) {
                        if (((ParameterAnnotationTerm)a2.getTerm()).getSourceParameter().equals(aa.getParameter())) {
View Full Code Here

            // we're invoking another constructor
            AnnotationInvocation ctor = (AnnotationInvocation)((Method)getPrimary()).getAnnotationConstructor();
            // find it's arguments
            for (AnnotationArgument otherArgument : ctor.findAnnotationArgumentForClassParameter(classParameter)) {
                if (otherArgument.getTerm() instanceof ParameterAnnotationTerm) {
                    Parameter sourceParameter = ((ParameterAnnotationTerm)otherArgument.getTerm()).getSourceParameter();
                    for (AnnotationArgument aa : getAnnotationArguments()) {
                        if (aa.getParameter().equals(sourceParameter)) {
                            result.add(aa);
                        }
                    }
View Full Code Here

    public MethodDefinitionBuilder resultType(Method method, int flags) {
        if (method.isParameter()) {
            if (Decl.isUnboxedVoid(method) && !Strategy.useBoxedVoid(method)) {
                return resultType(gen.makeJavaTypeAnnotations(method, false), gen.make().Type(gen.syms().voidType));
            } else {
                Parameter parameter = method.getInitializerParameter();
                ProducedType resultType = parameter.getType();
                for (int ii = 1; ii < method.getParameterLists().size(); ii++) {
                    resultType = gen.typeFact().getCallableType(resultType);
                }
                return resultType(gen.makeJavaType(resultType, CodegenUtil.isUnBoxed(method) ? 0 : AbstractTransformer.JT_NO_PRIMITIVES), method);
            }
View Full Code Here

                initialValue = expressionGen().transform(
                        expression,
                        CodegenUtil.getBoxingStrategy(declarationModel),
                        declarationModel.getType());
            } else {
                Parameter p = CodegenUtil.findParamForDecl(attrName, declarationModel);
                if (p != null) {
                    initialValue = naming.makeName(p.getModel(), Naming.NA_MEMBER | Naming.NA_ALIASED);
                }
            }
        }
        return initialValue;
    }
View Full Code Here

            if (Strategy.hasDefaultParameterValueMethod(defaultedParam)) {
                // add the default value
                List<JCExpression> defaultMethodArgs = List.nil();
                // pass all the previous values
                for(int a=i-1;a>=0;a--){
                    Parameter param = paramLists.getParameters().get(a);
                    JCExpression previousValue = getCallableTempVarName(param).makeIdent();
                    defaultMethodArgs = defaultMethodArgs.prepend(previousValue);
                }
                // now call the default value method
                return defaultValueCall.makeDefaultValueMethod(gen, defaultedParam, defaultMethodArgs);
View Full Code Here

            }
            return invocation;
        }
       
        protected final SyntheticName parameterName(int a) {
            Parameter param = paramLists.getParameters().get(a);
            SyntheticName name = getCallableTempVarName(param);
            return name;
        }
View Full Code Here

        /** Makes an argument that's just the ident of the parameter {@code $param$n}*/
        protected final void makeParameterArgument(final int arity,
                ListBuffer<JCStatement> stmts, ListBuffer<JCExpression> args,
                int a) {
            SyntheticName name = parameterName(a);
            Parameter param = paramLists.getParameters().get(a);
            makeDowncastOrDefaultVar(stmts,
                    name, param, a, arity);
            args.append(name.makeIdent());
        }
View Full Code Here

                ListBuffer<JCStatement> stmts, ListBuffer<JCExpression> args,
                int a) {
            ListBuffer<JCExpression> varargs = ListBuffer.<JCExpression>lb();
            for (; a < arity; a++) {
                if (arity < numParams - 1) {
                    Parameter param1 = paramLists.getParameters().get(Math.min(a, numParams-1));
                    makeDowncastOrDefaultVar(stmts,
                            parameterName(Math.min(a, numParams-1)), param1, a, arity);
                } else {
                    varargs.append(gen.make().Ident(makeParamName(gen, a)));
                }
View Full Code Here

TOP

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

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.