Package org.openquark.cal.internal.javamodel.JavaStatement

Examples of org.openquark.cal.internal.javamodel.JavaStatement.Block.addStatement()


                        LiteralWrapper.make(Integer.valueOf(ordinal)), JavaTypeName.INT,
                        JavaTypeNames.RTVALUE, InvocationType.VIRTUAL);
                }

                LocalVariableDeclaration extractValueDeclaration = new LocalVariableDeclaration(bindingVar, javaExtractValueExpr);
                recordCaseBlock.addStatement(extractValueDeclaration);
            }
        }


        //encode the result expression in the context of the extended variable scope.
View Full Code Here


        //encode the result expression in the context of the extended variable scope.
        Expression resultExpr = recordCaseExpr.getResultExpr();
        JavaStatement resultJavaStatement = genS_R(resultExpr, variableContext);

        // Generate any let variables in this block and add them to the recordCaseBlock.
        recordCaseBlock.addStatement(variableContext.popJavaScope());

        // Add the body of the record case.
        recordCaseBlock.addStatement(resultJavaStatement);

        return recordCaseBlock;
View Full Code Here

        // Generate any let variables in this block and add them to the recordCaseBlock.
        recordCaseBlock.addStatement(variableContext.popJavaScope());

        // Add the body of the record case.
        recordCaseBlock.addStatement(resultJavaStatement);

        return recordCaseBlock;
    }

    private JavaField getReferencedDC (JavaTypeName type, DataConstructor dc) {
View Full Code Here

        JavaExpression javaExpression = null;
        Block context = new Block();

        if (argClass == void.class) {
            // hopefully definition will be a method invocation, rather than object creation or a field..
            context.addStatement(new ExpressionStatement(definition));

            if (LECCMachineConfiguration.TREAT_ENUMS_AS_INTS) {
                javaExpression = createMakeKernelIntInvocation(LiteralWrapper.make (Integer.valueOf(0)));
            } else {
                JavaTypeName calUnitClassName = JavaTypeName.make(CALToJavaNames.createFullPackageName(CALToJavaNames.createPackageNameFromModule(CAL_Prelude.MODULE_NAME)) + ".TYPE_Unit$CAL_Unit", false);
View Full Code Here

            moreListElements = false;
            ExpressionContextPair leftArg = genS_C(constructorOpExpressions.getArgument(0), variableContext);
            if (contextBlock == null) {
                contextBlock = leftArg.getContextBlock();
            } else {
                contextBlock.addStatement(leftArg.getContextBlock());
            }

            constructorArgs = new JavaExpression [nArgs];
            if (addEC) {
                constructorArgs[dc.getArity()] = EXECUTION_CONTEXT_VAR;
View Full Code Here

                moreListElements = true;
            }
        } while (moreListElements);

        ExpressionContextPair terminator = genS_C(constructorOpExpressions.getArgument(1), variableContext);
        contextBlock.addStatement(terminator.getContextBlock());
        lastConstructorArgs[1] = terminator.getJavaExpression();

        return new ExpressionContextPair (listCreation, contextBlock);
    }
View Full Code Here

                    ecp[i] = genS_C(constructorOpExpressions.getArgument(i), variableContext);
                }

                Block newContext = ecp[0].getContextBlock();
                for (int i = 1; i < dc.getArity(); ++i) {
                    newContext.addStatement(ecp[i].getContextBlock());
                }

                JavaExpression dcExpr = expressionVarToJavaDef(constructorOpExpressions.getDataConstructorExpression(), scheme, variableContext);

                if (dc.getArity() <= LECCMachineConfiguration.OPTIMIZED_APP_CHAIN_LENGTH) {
View Full Code Here

                    }
                }

                Block newContext = ecp[0].getContextBlock();
                for (int i = 1; i < dc.getArity(); ++i) {
                    newContext.addStatement(ecp[i].getContextBlock());
                }

                int nArgs = dc.getArity();
                boolean addEC = LECCMachineConfiguration.passExecContextToDataConstructors();
                if (addEC) {
View Full Code Here

                invocationType = InvocationType.STATIC;
            } else {
                ExpressionContextPair pair = generateUnboxedForeignFunctionArgument(invocationClassName, basicOpExpressions.getArgument(0), variableContext);
                target = pair.getJavaExpression();
                invocationType = invocationClass.isInterface() ? InvocationType.INTERFACE : InvocationType.VIRTUAL;
                returnContext.addStatement(pair.getContextBlock());
                startArg = 1;
            }

            Class<?>[] argTypes = method.getParameterTypes();
            JavaExpression[] args = new JavaExpression[argTypes.length];
View Full Code Here

            for (int i = startArg, j = 0; i < nJavaArgs; ++i, ++j) {
                int index = i - startArg;
                final JavaTypeName argTypeName = JavaTypeName.make(argTypes[index]);
                ExpressionContextPair pair = generateUnboxedForeignFunctionArgument(argTypeName, basicOpExpressions.getArgument(i), variableContext);
                args[index] = pair.getJavaExpression();
                returnContext.addStatement(pair.getContextBlock());

                argTypeNames[index] = argTypeName;
            }

            JavaTypeName returnType = JavaTypeName.make(method.getReturnType());
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.