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

Fix Lua compiler omitting default values in Lua service functions

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.13.0
    • 0.15.0
    • Lua - Compiler
    • 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

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            jeffreyhan Jeffrey Han
            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

                Slack

                  Issue deployment