Package org.openquark.cal.internal.javamodel.JavaExpression

Examples of org.openquark.cal.internal.javamodel.JavaExpression.MethodInvocation


            //push the "this" reference on the stack
            mv.visitVarInsn(Opcodes.ALOAD, 0);
            mv.visitMethodInsn(Opcodes.INVOKESPECIAL, classRep.getSuperclassName().getJVMInternalName(), "<init>", "()V");
        } else {
            GenerationContext context = new GenerationContext(methodVarToTypeMap, methodVarToIndexMap, indexOfNextSlot, mv, classRep.getClassName());           
            MethodInvocation mi =
                new MethodInvocation.Instance(null, "<init>", classRep.getSuperclassName(), javaConstructor.getSuperConstructorParamValues(), javaConstructor.getSuperConstructorParamTypes(), JavaTypeName.VOID, MethodInvocation.InvocationType.SPECIAL);
            encodeMethodInvocationExpr(mi, context);
        }

        // Add initializers for the non-statically-initialized fields.       
View Full Code Here


        //   See encodeTryCatchStatement() for how to do this.
        //   Here, the only statement in the try block is a single expressionStatement, which has no return instructions,
        //     so we don't have to worry about handling this case.
       
        // Get the method invocation and generate the corresponding bytecode.
        MethodInvocation methodInvocation = smi.getMethodInvocation();
        encodeExpr (methodInvocation, context);
    
        // Load the mutex object back onto the stack and do MonitorExit.
        mv.visitVarInsn(Opcodes.ALOAD, mutexIndex);
        mv.visitInsn(Opcodes.MONITOREXIT);
View Full Code Here

                // Build the array creation expression.
                JavaExpression arrayCreation =
                    new JavaExpression.ArrayCreationExpression(SOURCE_MODEL_EXPR_TYPE_NAME, arrayElements);
               
                // Invoke SourceModel.Expr.Application.make()
                MethodInvocation makeApply =
                    new MethodInvocation.Static(
                            SOURCE_MODEL_EXPR_APPLICATION_TYPE_NAME,
                            "make",
                            arrayCreation,
                            JavaTypeName.makeArrayType(SOURCE_MODEL_EXPR_TYPE_NAME),
View Full Code Here

                   
                    JavaExpression arrayCreation =
                        new JavaExpression.ArrayCreationExpression(SOURCE_MODEL_EXPR_TYPE_NAME, arrayElements);
                   
                    // Invoke SourceModle.Expr.Application.make()
                    MethodInvocation makeApply =
                        new MethodInvocation.Static(
                                SOURCE_MODEL_EXPR_APPLICATION_TYPE_NAME,
                                "make",
                                arrayCreation,
                                JavaTypeName.makeArrayType(SOURCE_MODEL_EXPR_TYPE_NAME),
View Full Code Here

            javaMethod.addStatement(sw);

            // If the argument doesn't match the ordinal for any DC we
            // throw an error.
            MethodInvocation badValue =
                new MethodInvocation.Static(
                        JavaTypeNames.RTVALUE,
                        "badValue_Object",
                        new JavaExpression[]{LiteralWrapper.NULL, LiteralWrapper.make("Invalid DC ordinal in getDCNameByOrdinal() for " + className.toString())},
                        new JavaTypeName[]{JavaTypeName.ERRORINFO, JavaTypeName.STRING},
View Full Code Here

                        LocalVariable localVariable = new LocalVariable(localName, fieldType);
                        LocalVariableDeclaration localDeclaration = new LocalVariableDeclaration(localVariable);
                        javaMethod.addStatement(localDeclaration);
                        Assignment localAssignment = new Assignment(localVariable, field);
                        InstanceOf checkType = new InstanceOf(localAssignment, JavaTypeNames.RTRESULT_FUNCTION);
                        MethodInvocation getValue = new MethodInvocation.Instance(localVariable, "getValue", JavaTypeNames.RTVALUE, MethodInvocation.InvocationType.VIRTUAL);
                        Assignment fieldAssignment = new Assignment(field, getValue);
                        ReturnStatement returnNewVal = new ReturnStatement(fieldAssignment);
                        IfThenElseStatement ifThen = new IfThenElseStatement(checkType, returnNewVal);
                        javaMethod.addStatement(ifThen);
                        javaMethod.addStatement(new ReturnStatement (localVariable));
                    } else {
                        javaMethod.addStatement(new ReturnStatement (field));
                    }
                }
            } else {
                // This class should throw an error for any access.  The methods will
                // be overridden by derived classes for each data constructor.
                // We can simply call the method badFieldAccessor() implemented in
                // RTCons.
                MethodInvocation mi =
                    new MethodInvocation.Instance(
                            null,
                            "badFieldAccessor",
                            LiteralWrapper.make(fieldName),
                            JavaTypeName.STRING,
View Full Code Here

                String castTypeString = null;
                if (!(fieldType instanceof JavaTypeName.Primitive)) {
                    castTypeString = fieldTypeString;
                    fieldTypeString = "Object";
                }
                MethodInvocation mi =
                    new MethodInvocation.Instance(
                        null,
                        "badFieldAccessor_" + fieldTypeString,
                        LiteralWrapper.make(fieldName),
                        JavaTypeName.STRING,
View Full Code Here

                                    functions.getFunctionIndex(mf.getName()),
                                    new ReturnStatement(LiteralWrapper.make(mf.getName()))));
                }
                jm.addStatement(switchStatement);

                MethodInvocation mi =
                    new MethodInvocation.Static (JavaTypeNames.RTVALUE,
                                                   "badValue_Object",
                                                   new JavaExpression[]{LiteralWrapper.NULL, LiteralWrapper.make("Bad index in getUnQualifiedName()")},
                                                   new JavaTypeName[]{JavaTypeName.ERRORINFO, JavaTypeName.STRING},
                                                   JavaTypeName.OBJECT);
View Full Code Here

                                    new ReturnStatement(LiteralWrapper.make(mf.getQualifiedName().getQualifiedName()))));
                }

                jm.addStatement(switchStatement);

                MethodInvocation mi =
                    new MethodInvocation.Static (JavaTypeNames.RTVALUE,
                                                   "badValue_Object",
                                                   new JavaExpression[]{LiteralWrapper.NULL, LiteralWrapper.make("Bad index in getQualifiedName()")},
                                                   new JavaTypeName[]{JavaTypeName.ERRORINFO, JavaTypeName.STRING},
                                                   JavaTypeName.OBJECT);
View Full Code Here

                    javaDefn.hasStrictUnboxableArguments()) {
                    continue;
                }

                methodName = functions.getFNamePrefix(javaDefn.getFunctionName()) + "f" + arity + (strict ? "S" : "L");
                MethodInvocation mi =
                    new MethodInvocation.Instance(
                            null,
                            methodName,
                            argValues,
                            argTypes,
                            JavaTypeNames.RTVALUE,
                            MethodInvocation.InvocationType.VIRTUAL);

                switchStatement.addCase(
                    new SwitchStatement.IntCaseGroup(functions.getFunctionIndex(javaDefn.getFunctionName()), new ReturnStatement(mi)));
            }

            javaMethod.addStatement(switchStatement);

            // Handle the fallthrough.
            // If this is the lazy version of the 'f' method we want to defer to the
            // version in the superclass (i.e. RTValue).  This can occur when there
            // is a lazy application of a functional argument, or an oversaturation.
            if (strict) {
                MethodInvocation mi =
                    new MethodInvocation.Static (JavaTypeNames.RTVALUE,
                                                   "badValue",
                                                   LiteralWrapper.make("Bad scTag in 'f'."),
                                                   JavaTypeName.STRING,
                                                   JavaTypeNames.RTVALUE);
                javaMethod.addStatement(new ReturnStatement(mi));
            } else {
                MethodInvocation mi =
                    new MethodInvocation.Instance(
                            null,
                            "f" + arity + "L",
                            this.javaClassRep.getSuperclassName(),
                            argValues,
View Full Code Here

TOP

Related Classes of org.openquark.cal.internal.javamodel.JavaExpression.MethodInvocation

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.