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

Fix Lua compiler omitting default values in Lua service functions

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.13.0
    • Fix Version/s: 0.15.0
    • Component/s: Lua - Compiler
    • Labels:
      None

      Description

      Add missing default argument values for service client functions in generated Lua code.

      Example Thrift definition:

      const string kTestStr = "0"
      service SomeService {
        void someMethod(1: string a, 2: string b = kTestStr)
          throws (1: SomeError error)
      }

      Generated code before:
      function SomeServiceClient:send_someMethod(a, b)
        self.oprot:writeMessageBegin('someMethod', TMessageType.CALL, self._seqid)
        local args = someMethod_args:new
        args.a = a
        args.b = b
        args:write(self.oprot)
        self.oprot:writeMessageEnd()
        self.oprot.trans:flush()
      end

       

      Generated code after:
      function SomeServiceClient:send_someMethod(a, b)
        self.oprot:writeMessageBegin('someMethod', TMessageType.CALL, self._seqid)
        local args = someMethod_args:new
        args.a = a
        if b ~= nil then
          args.b = b
        else
          args.b = '0'
        end
        args:write(self.oprot)
        self.oprot:writeMessageEnd()
        self.oprot.trans:flush()
      end

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jeffreyhan Jeffrey Han
                Reporter:
                jeffreyhan Jeffrey Han
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 20m
                  1h 20m