You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Henrique Mendonca (JIRA)" <ji...@apache.org> on 2011/06/21 14:07:48 UTC

[jira] [Updated] (THRIFT-1214) JavaScript constructor does not accept object properties

     [ https://issues.apache.org/jira/browse/THRIFT-1214?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henrique Mendonca updated THRIFT-1214:
--------------------------------------

    Attachment: THRIFT-1214-args-constructor.patch

> 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