Package com.facebook.swift.codec.internal.compiler.byteCode

Examples of com.facebook.swift.codec.internal.compiler.byteCode.MethodDefinition.dup()


        classDefinition.addMethod(write);

        // TProtocolReader reader = new TProtocolReader(protocol);
        write.addLocalVariable(type(TProtocolWriter.class), "writer");
        write.newObject(TProtocolWriter.class);
        write.dup();
        write.loadVariable("protocol");
        write.invokeConstructor(type(TProtocolWriter.class), type(TProtocol.class));
        write.storeVariable("writer");

        LocalVariableDefinition protocol = write.getLocalVariable("writer");
View Full Code Here


        classDefinition.addMethod(write);

        // TProtocolWriter writer = new TProtocolWriter(protocol);
        write.addLocalVariable(type(TProtocolWriter.class), "writer");
        write.newObject(TProtocolWriter.class);
        write.dup();
        write.loadVariable("protocol");
        write.invokeConstructor(type(TProtocolWriter.class), type(TProtocol.class));
        write.storeVariable("writer");

        LocalVariableDefinition protocol = write.getLocalVariable("writer");
View Full Code Here

        ).addException(Exception.class);

        // TProtocolReader reader = new TProtocolReader(protocol);
        read.addLocalVariable(type(TProtocolReader.class), "reader");
        read.newObject(TProtocolReader.class);
        read.dup();
        read.loadVariable("protocol");
        read.invokeConstructor(type(TProtocolReader.class), type(TProtocol.class));
        read.storeVariable("reader");

        // read all of the data in to local variables
View Full Code Here

        classDefinition.addMethod(write);

        // TProtocolReader reader = new TProtocolReader(protocol);
        write.addLocalVariable(type(TProtocolWriter.class), "writer");
        write.newObject(TProtocolWriter.class);
        write.dup();
        write.loadVariable("protocol");
        write.invokeConstructor(type(TProtocolWriter.class), type(TProtocol.class));
        write.storeVariable("writer");

View Full Code Here

            loadFieldValue(write, field);

            // if field value is null, don't coerce or write the field
            if (!isFieldTypeJavaPrimitive(field)) {
                // ifNullGoto consumes the top of the stack, so we need to duplicate the value
                write.dup();
                write.ifNullGoto("field_is_null_" + field.getName());
            }

            // coerce value
            if (field.getCoercion() != null) {
View Full Code Here

            if (field.getCoercion() != null) {
                write.invokeStatic(field.getCoercion().getToThrift());

                // if coerced value is null, don't write the field
                if (!isProtocolTypeJavaPrimitive(field)) {
                    write.dup();
                    write.ifNullGoto("field_is_null_" + field.getName());
                }
            }

            // write value
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.