docs: private LocalVariableDefinition constructUnionInstance(MethodDefinition read)
      {
          LocalVariableDefinition instance = read.addLocalVariable(structType, "instance");
  
          // create the new instance (or builder)
          if (metadata.getBuilderClass() == null) {
              read.newObject(structType).dup();
          }
          else {
              read.newObject(metadata.getBuilderClass()).dup();
          }
  
          // switch (fieldId)
          read.loadVariable("fieldId");
  
          List<CaseStatement> cases = new ArrayList<>();
          for (ThriftFieldMetadata field : metadata.getFields(THRIFT_FIELD)) {
              if (field.getConstructorInjection().isPresent()) {
                  cases.add(caseStatement(field.getId(), field.getName() + "-id-field"));
              }
          }
          read.switchStatement("no-field-ctor", cases);
  
          for (ThriftFieldMetadata field : metadata.getFields(THRIFT_FIELD)) {
              if (field.getConstructorInjection().isPresent()) {
                  // case fieldId:
                  read.visitLabel(field.getName() + "-id-field");
  
                  // Load the read value
                  read.loadVariable("f_" + field.getName());
                  read.invokeConstructor(field.getConstructorInjection().get().getConstructor())
                          .storeVariable(instance)
                          .gotoLabel("instance-ok");
              }
          }
  
          read.visitLabel("no-field-ctor");
  
          // No args c'tor present.
          if (metadata.getConstructorInjection().isPresent()) {
              ThriftConstructorInjection constructor = metadata.getConstructorInjection().get();
              // invoke constructor
              read.invokeConstructor(constructor.getConstructor())
                      .storeVariable(instance);
          }
          else {
              read.pop() // get rid of the half-constructed element
                      .loadConstant(metadata.getStructClass())
                      .loadVariable("fieldId")
                      .invokeStatic(SwiftBytecodeHelper.NO_CONSTRUCTOR_FOUND)
                      .throwException();
          }
          read.visitLabel("instance-ok");
  
          return instance;
      }