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

Henrique Mendonca commented on THRIFT-1214:
-------------------------------------------

yeah, thanks Pascal, I've seen that before but end up not fixing it.
I'm using (args.value !== undefined) on this patch but (args.value != null) is 
also an option, faster?

> JavaScript constructor does not accept object properties
> --------------------------------------------------------
>
>                 Key: THRIFT-1214
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1214
>             Project: Thrift
>          Issue Type: Bug
>          Components: JavaScript - Compiler
>            Reporter: Pascal Bach
>            Assignee: Henrique Mendonca
>              Labels: javascript
>         Attachments: THRIFT-1214-args-constructor.patch
>
>
> When you give a constructor function a set of default parameters they don't 
> get assigned to the object correctly.
> The reason lies in the generated code:
> MyStruct = function(args) {
>       this.value = null;
>       if (args) {
>               if (!args.value) {
>                       this.value = args.value;
>               }
>       }
> };
> The check for  results !args.value causes that the value to be only set if it 
> is undefined.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to