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

Examples of com.facebook.swift.codec.internal.compiler.byteCode.LocalVariableDefinition


    /**
     * Defines the code to read all of the data from the protocol into local variables.
     */
    private Map<Short, LocalVariableDefinition> readFieldValues(MethodDefinition read)
    {
        LocalVariableDefinition protocol = read.getLocalVariable("reader");

        // declare and init local variables here
        Map<Short, LocalVariableDefinition> structData = new TreeMap<>();
        for (ThriftFieldMetadata field : metadata.getFields()) {
            LocalVariableDefinition variable = read.addInitializedLocalVariable(
                    toParameterizedType(field.getType()),
                    "f_" + field.getName()
            );
            structData.put(field.getId(), variable);
        }
View Full Code Here


     */
    private void buildStruct(MethodDefinition read, Map<Short, LocalVariableDefinition> structData)
    {

        // construct the instance and store it in the instance local variable
        LocalVariableDefinition instance = constructInstance(read, structData);

        // inject fields
        injectFields(read, instance, structData);

        // inject methods
View Full Code Here

     * Defines the code to construct the struct (or builder) instance and stores it in a local
     * variable.
     */
    private LocalVariableDefinition constructInstance(MethodDefinition read, Map<Short, LocalVariableDefinition> structData)
    {
        LocalVariableDefinition instance = read.addLocalVariable(structType, "instance");

        // create the new instance (or builder)
        if (metadata.getBuilderClass() == null) {
            read.newObject(structType).dup();
        }
View Full Code Here

        write.loadVariable("protocol");
        write.invokeConstructor(type(TProtocolWriter.class), type(TProtocol.class));
        write.storeVariable("writer");


        LocalVariableDefinition protocol = write.getLocalVariable("writer");

        // protocol.writeStructBegin("bonk");
        write.loadVariable(protocol)
                .loadConstant(metadata.getStructName())
                .invokeVirtual(TProtocolWriter.class, "writeStructBegin", void.class, String.class);
View Full Code Here

TOP

Related Classes of com.facebook.swift.codec.internal.compiler.byteCode.LocalVariableDefinition

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.