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

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

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


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

        

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

Posted by "Henrique Mendonca (JIRA)" <ji...@apache.org>.
    [ 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

        

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

Posted by "Roger Meier (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-1214?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Roger Meier resolved THRIFT-1214.
---------------------------------

    Resolution: Fixed

> 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

        

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

Posted by "Hudson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-1214?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13053356#comment-13053356 ] 

Hudson commented on THRIFT-1214:
--------------------------------

Integrated in Thrift #171 (See [https://builds.apache.org/job/Thrift/171/])
    

> 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

        

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

Posted by "Henrique Mendonca (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-1214?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henrique Mendonca reassigned THRIFT-1214:
-----------------------------------------

    Assignee: Henrique Mendonca

> 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
>
> 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

        

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

Posted by "Roger Meier (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-1214?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13052581#comment-13052581 ] 

Roger Meier commented on THRIFT-1214:
-------------------------------------

Thanks, committed the 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

        

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

Posted by "Henrique Mendonca (JIRA)" <ji...@apache.org>.
     [ 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