Examples of SyntheticName


Examples of com.redhat.ceylon.compiler.java.codegen.Naming.SyntheticName

            if (instantiateQualfier != null
                    && instantiateQualfier.expression != null) {
                if (instantiateQualfier.type == null) {
                    throw new BugException(MISSING_TYPE);
                }
                SyntheticName qualName = getQualifierName(basename);
                appendStatement(gen.makeVar(Flags.FINAL, qualName,
                        instantiateQualfier.type,
                        instantiateQualfier.expression));
                newEncl = qualName.makeIdent();
            } else {
                newEncl = null;
            }
            arguments = List.<JCExpression>nil();
            int argumentNum = 0;
            for (ExpressionAndType argumentAndType : argumentsAndTypes) {
                SyntheticName name = getArgumentName(basename, argumentNum);
                if (argumentAndType.type == null) {
                    throw new BugException(MISSING_TYPE);
                }
                if ((cbOpts & CB_ALIAS_ARGS) != 0) {
                    appendStatement(gen.makeVar(Flags.FINAL, name,
                            argumentAndType.type,
                            argumentAndType.expression));
                }
                arguments = arguments.append(name.makeIdent());
                argumentNum++;
            }
           
        } else {
            newEncl = this.instantiateQualfier != null ? this.instantiateQualfier.expression : null;
View Full Code Here

Examples of com.redhat.ceylon.compiler.java.codegen.Naming.SyntheticName

       
        return result;
    }

    private SyntheticName getArgumentName(Naming.SyntheticName basename, int argumentNum) {
        SyntheticName name = basename.suffixedBy(Suffix.$arg$, argumentNum);
        return name;
    }
View Full Code Here

Examples of com.redhat.ceylon.compiler.java.codegen.Naming.SyntheticName

        SyntheticName name = basename.suffixedBy(Suffix.$arg$, argumentNum);
        return name;
    }

    private SyntheticName getQualifierName(Naming.SyntheticName basename) {
        SyntheticName qualName = basename.suffixedBy(Suffix.$qual$);
        return qualName;
    }
View Full Code Here

Examples of com.redhat.ceylon.compiler.java.codegen.Naming.SyntheticName

              if (clause == comp.getInitialComprehensionClause()) {
                //No previous context
                assert (ctxtName == null);
                ctxtName = naming.synthetic(Prefix.$next$, idx);
                //define a variable that records if the expression was already evaluated
                SyntheticName exhaustedName = ctxtName.suffixedBy(Suffix.$exhausted$);
                    JCVariableDecl exhaustedDef = make().VarDef(make().Modifiers(Flags.PRIVATE),
                            exhaustedName.asName(), makeJavaType(typeFact().getBooleanDeclaration().getType()), null);
                    fields.add(exhaustedDef);
                    JCStatement returnIfExhausted = make().If(exhaustedName.makeIdent(), make().Return(makeBoolean(false)), null);
                    JCStatement setExhaustedTrue = make().Exec(make().Assign(exhaustedName.makeIdent(), makeBoolean(true)));
                    initBlock =  List.<JCStatement>of(
                        //if we already evaluated the expression, return
                        returnIfExhausted,
                            //record that we will have evaluated the expression
                            setExhaustedTrue);
View Full Code Here

Examples of com.redhat.ceylon.compiler.java.codegen.Naming.SyntheticName

                //Assign the key and item to the corresponding fields with the proper type casts
                //equivalent to k=(KeyType)((Entry<KeyType,ItemType>)tmpItem).getKey()
                JCExpression castEntryExprKey = make().TypeCast(
                    makeJavaType(typeFact().getIteratedType(iterType)),
                    tmpItem.makeIdent());
                SyntheticName keyName = naming.synthetic(key);
                SyntheticName itemName = naming.synthetic(item);
                valueCaptures.append(makeVar(Flags.FINAL, keyName,
                        makeJavaType(key.getType(), JT_NO_PRIMITIVES),
                        keyName.makeIdentWithThis()));
                valueCaptures.append(makeVar(Flags.FINAL, itemName,
                        makeJavaType(item.getType(), JT_NO_PRIMITIVES),
                        itemName.makeIdentWithThis()));
                elseBody.add(make().Exec(make().Assign(keyName.makeIdent(),
                    make().TypeCast(makeJavaType(key.getType(), JT_NO_PRIMITIVES),
                        make().Apply(null, makeSelect(castEntryExprKey, "getKey"),
                            List.<JCExpression>nil())
                ))));
                //equivalent to v=(ItemType)((Entry<KeyType,ItemType>)tmpItem).getItem()
                JCExpression castEntryExprItem = make().TypeCast(
                        makeJavaType(typeFact().getIteratedType(iterType)),
                        tmpItem.makeIdent());
                elseBody.add(make().Exec(make().Assign(itemName.makeIdent(),
                    make().TypeCast(makeJavaType(item.getType(), JT_NO_PRIMITIVES),
                        make().Apply(null, makeSelect(castEntryExprItem, "getItem"),
                            List.<JCExpression>nil())
                ))));
            }
View Full Code Here

Examples of com.redhat.ceylon.compiler.java.codegen.Naming.SyntheticName

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

Examples of com.redhat.ceylon.compiler.java.codegen.Naming.SyntheticName

       
        /** 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

Examples of com.redhat.ceylon.compiler.java.codegen.Naming.SyntheticName

                varargsSequence = gen.makeEmptyAsSequential(true);
            } else {
                varargsSequence = gen.makeSequence(varargs.toList(),
                        getVariadicIteratedType(), 0);
            }
            SyntheticName vname = getCallableTempVarName(getVariadicParameter()).suffixedBy(Suffix.$variadic$);
            args.append(vname.makeIdent());
            makeVarForParameter(stmts, getVariadicParameter(), getVariadicType(),
                    vname, varargsSequence);
            return a;
        }
View Full Code Here

Examples of com.redhat.ceylon.compiler.java.codegen.Naming.SyntheticName

            for (; a < getMinimumArguments()-1; a++) {
                makeParameterArgument(arity, stmts, args, a);
            }
            for (; a < numParams-1; a++) {
                // Extract from the sequential
                SyntheticName name = parameterName(a);
                JCExpression get = gen.make().Apply(null,
                        gen.makeQualIdent(makeParamIdent(gen, arity), "get"),
                        List.<JCExpression>of(gen.expressionGen().applyErasureAndBoxing(gen.make().Literal(a),
                                gen.typeFact().getIntegerDeclaration().getType(), false, BoxingStrategy.BOXED, gen.typeFact().getIntegerDeclaration().getType())));
                get = gen.expressionGen().applyErasureAndBoxing(get,
                        parameterTypes.get(a),
                        true, true, BoxingStrategy.UNBOXED,
                        parameterTypes.get(a), 0);
                Parameter param = paramLists.getParameters().get(a);
                makeVarForParameter(stmts, param, parameterTypes.get(a),
                        name, get);
                args.append(name.makeIdent());
            }
            // Get the rest of the sequential using spanFrom()
            SyntheticName name = parameterName(numParams-1);
            JCExpression spanFrom = gen.make().Apply(null,
                    gen.makeQualIdent(makeParamIdent(gen, arity), "spanFrom"),
                    List.<JCExpression>of(gen.expressionGen().applyErasureAndBoxing(gen.make().Literal(a),
                            gen.typeFact().getIntegerDeclaration().getType(), false, BoxingStrategy.BOXED, gen.typeFact().getIntegerDeclaration().getType())));
            spanFrom = gen.expressionGen().applyErasureAndBoxing(spanFrom,
                    parameterTypes.get(a),
                    true, true, BoxingStrategy.UNBOXED,
                    parameterTypes.get(a), 0);
            Parameter param = paramLists.getParameters().get(numParams-1);
            makeVarForParameter(stmts, param, parameterTypes.get(a),
                    name, spanFrom);
            args.append(name.makeIdent());
        }
View Full Code Here

Examples of com.redhat.ceylon.compiler.java.codegen.Naming.SyntheticName

    /**
     * Turn this long value into an int value by applying (int)(e ^ (e >>> 32))
     */
    public JCExpression convertToIntForHashAttribute(JCExpression value) {
        SyntheticName tempName = naming.temp("hash");
        JCExpression type = make().Type(syms().longType);
        JCBinary combine = make().Binary(JCTree.BITXOR, makeUnquotedIdent(tempName.asName()),
                make().Binary(JCTree.USR, makeUnquotedIdent(tempName.asName()), makeInteger(32)));
        return make().TypeCast(syms().intType, makeLetExpr(tempName, null, type, value, combine));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.