Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-5160

Swift: generated processor does work for extended classes

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 0.14.0
    • None
    • Swift - Compiler
    • None

    Description

      Let's say we have following IDL:

      service service1 {
       void func1()
      }
      
      service service2 extends service1 {
       void func2()
      }
      

      compiler generates processor for service2:

      extension service2Processor : TProcessor {
        static let processorHandlers: ProcessorHandlerDictionary = {
          var processorHandlers = ProcessorHandlerDictionary()
          processorHandlers["func2"] = { sequenceID, inProtocol, outProtocol, handler in
             // ...processor for func2
          }
          return processorHandlers
        }()
      
        public func process(on inProtocol: TProtocol, outProtocol: TProtocol) throws {
          let (messageName, _, sequenceID) = try inProtocol.readMessageBegin()
          if let processorHandler = service2Processor.processorHandlers[messageName] {
             // ...process the message
          }
          else {
             // ...unknown message
          }
        }
      }
      

      This processor will not process func1 since it's not in processorHandlers[].

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              janosvitok Jano Svitok
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated: