[ 
https://issues.apache.org/jira/browse/THRIFT-3584?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15125666#comment-15125666
 ] 

ASF GitHub Bot commented on THRIFT-3584:
----------------------------------------

GitHub user mygityf opened a pull request:

    https://github.com/apache/thrift/pull/826

    THRIFT-3584 Lua: To check element of self whether nil or not,avoid the 
value(false) of BOOL is lost.

    …e value(false) of BOOL is lost.
    
    eg.
        Before:
          if self.argBool then
            oprot:writeFieldBegin('argBool', TType.BOOL, 13)
            oprot:writeBool(self.argBool)
            oprot:writeFieldEnd()
          end
        
        After:
          if self.argBool ~= nil then
            oprot:writeFieldBegin('argBool', TType.BOOL, 13)
            oprot:writeBool(self.argBool)
            oprot:writeFieldEnd()
          end
        
        Why:
          the value(false) for paramater self.argBool will be lost when 
condition is 'if self.argBool then' as before.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/gitforks/thrift gityf-patch-lua-compiler

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/thrift/pull/826.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #826
    
----
commit dfeee18e48cb5f18f911e9344bd72f9bc7cbab42
Author: Wang Yaofu <voip...@sina.cn>
Date:   2016-02-01T02:59:33Z

    THRIFT-3584 Lua: To check element of self whether nil or not,avoid the 
value(false) of BOOL is lost.
    
    eg.
        Before:
          if self.argBool then
            oprot:writeFieldBegin('argBool', TType.BOOL, 13)
            oprot:writeBool(self.argBool)
            oprot:writeFieldEnd()
          end
        
        After:
          if self.argBool ~= nil then
            oprot:writeFieldBegin('argBool', TType.BOOL, 13)
            oprot:writeBool(self.argBool)
            oprot:writeFieldEnd()
          end
        
        Why:
          the value(false) for paramater self.argBool will be lost when 
condition is 'if self.argBool then' as before.

----


> the value(false) for parameter self.argBool will be lost when condition is 
> 'if self.argBool then' .
> ---------------------------------------------------------------------------------------------------
>
>                 Key: THRIFT-3584
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3584
>             Project: Thrift
>          Issue Type: Bug
>          Components: Lua - Compiler
>    Affects Versions: 0.9.3
>         Environment: Linux Windows
>            Reporter: WangYaofu
>             Fix For: 0.9.4
>
>
> To check element of self whether nil or not,avoid the value(false) of BOOL is 
> lost.
> eg.
> {code:title=Before}
>   if self.argBool then
>     oprot:writeFieldBegin('argBool', TType.BOOL, 13)
>     oprot:writeBool(self.argBool)
>     oprot:writeFieldEnd()
>   end
> {code}
> {code:title=After}
>   if self.argBool ~= nil then
>     oprot:writeFieldBegin('argBool', TType.BOOL, 13)
>     oprot:writeBool(self.argBool)
>     oprot:writeFieldEnd()
>   end
> {code}
> Why:
>   the value(false) for parameter self.argBool will be lost when condition is 
> 'if self.argBool then' as before.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to