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

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


        Block newContext = ecp[0].getContextBlock();
        JavaExpression[] je = new JavaExpression [chain.length];
        je[0] = ecp[0].getJavaExpression();
        for (int i = 1; i < chain.length; ++i) {
            newContext.addStatement(ecp[i].getContextBlock());
            je[i] = ecp[i].getJavaExpression();
        }

        // If we are in a strict context we want to generate something like:
        // arg.f3L(a, b, c).evaluate($ec);
View Full Code Here


        // For all but the last expression we want to generate a Java statement
        // which will evaluate to WHNF.
        for (int i = 0, n = expressions.length - 1; i < n; ++i) {
            Expression e = expressions[i];
            JavaStatement js = makeStrictStatementFromSeqArg(e, variableContext);
            block.addStatement(js);
        }

        // For the last expression we simply generate a return expression using the
        // usual top level compilation scheme.
        block.addStatement (genS_R (expressions[expressions.length - 1], variableContext));
View Full Code Here

            block.addStatement(js);
        }

        // For the last expression we simply generate a return expression using the
        // usual top level compilation scheme.
        block.addStatement (genS_R (expressions[expressions.length - 1], variableContext));

        return block;
    }

    /**
 
View Full Code Here

            pair = generateUnboxedArgument(null, e, variableContext);
        }

        Block block = pair.getContextBlock();
        JavaExpression firstArg = pair.getJavaExpression();
        block.addStatement(new ExpressionStatement(forceSafeForStatement(firstArg)));

        return block;
    }

    /**
 
View Full Code Here

        JavaExpression rootExpression = fsRootECP.getJavaExpression();

        JavaExpression extraArgs[] = new JavaExpression[diff];
        for (int i = calledArity + 1; i < appChain.length; ++i) {
            ExpressionContextPair argECP = genS_C(appChain[i], variableContext);
            b.addStatement(argECP.getContextBlock());
            extraArgs[i-calledArity-1] = argECP.getJavaExpression();
        }

        // If we are in a strict context we want to generate something like:
        // root.f3L(a, b, c).evaluate($ec);
View Full Code Here

                    ecp[i] = genS_C(chain[i], variableContext);
                }

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

                JavaExpression root = ecp[0].getJavaExpression();

                JavaExpression args[] = new JavaExpression[chain.length];
View Full Code Here

        ExpressionContextPair recordExprContextPair = genS_C(recordExpr, variableContext);

        JavaExpression javaRecordExpr = recordExprContextPair.getJavaExpression();
        Block recordSelectionBlock = new Block();
        recordSelectionBlock.addStatement(recordExprContextPair.getContextBlock());

        JavaExpression createLazyRecordSelection;
        if (fieldName instanceof FieldName.Textual) {

            createLazyRecordSelection = new ClassInstanceCreationExpression(JavaTypeNames.RTRECORD_SELECTION_TEXTUAL_FIELD,
View Full Code Here

        ExpressionContextPair conditionExprContextPair = genS_E(conditionExpr, variableContext);

        Block recordCaseBlock = new Block();

        JavaExpression javaConditionExpr = conditionExprContextPair.getJavaExpression();
        recordCaseBlock.addStatement(conditionExprContextPair.getContextBlock());

        //the compiler ensures that evaluating conditionExpr will result in a RTRecordValue.
        javaConditionExpr = new CastExpression(JavaTypeNames.RTRECORD_VALUE, javaConditionExpr);

        LocalVariable conditionVar = new LocalVariable("$recordCase" + nestedCaseLevel, JavaTypeNames.RTRECORD_VALUE);
View Full Code Here

        javaConditionExpr = new CastExpression(JavaTypeNames.RTRECORD_VALUE, javaConditionExpr);

        LocalVariable conditionVar = new LocalVariable("$recordCase" + nestedCaseLevel, JavaTypeNames.RTRECORD_VALUE);

        LocalVariableDeclaration conditionVarDeclaration = new LocalVariableDeclaration(conditionVar, javaConditionExpr);
        recordCaseBlock.addStatement(conditionVarDeclaration);

        //now encode the extraction of the pattern bound variables from the condition record expr.

        // Also need to push a let variable block.  This is separate from the variable scope because the two
        // do not always coincide.  The let variable block is popped by calling i_VariableScope.genS_Vars().
View Full Code Here

                javaExtractBaseRecordExpr = conditionVar;
            }

            LocalVariableDeclaration extractBaseRecordDeclaration =
                new LocalVariableDeclaration(baseRecordPatternVar, javaExtractBaseRecordExpr);
            recordCaseBlock.addStatement(extractBaseRecordDeclaration);
        }

        for (final Map.Entry<FieldName, String> entry : fieldBindingVarMap.entrySet()) {

            FieldName fieldName = entry.getKey();
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.