[
https://issues.apache.org/jira/browse/THRIFT-1840?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15018790#comment-15018790
]
ASF GitHub Bot commented on THRIFT-1840:
----------------------------------------
GitHub user bracki opened a pull request:
https://github.com/apache/thrift/pull/707
Fix generated Node JS code
As reported in https://issues.apache.org/jira/browse/THRIFT-1840 and
https://issues.apache.org/jira/browse/THRIFT-2527 the generated JS code
pollutes the global namespace because it lacks `var` keywords.
This PR adds the `var` keyword where appropriate.
It also appends missing `;`, thus making tools like
[jshint](http://jshint.com/) et. al. happier.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/Jimdo/thrift fix_generated_node_js_code
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/thrift/pull/707.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 #707
----
commit 09382cd93cc5b0a19ad5f2e92dae6b83987968ad
Author: Jan Brauer <[email protected]>
Date: 2015-11-18T20:40:58Z
Don't pollute global namespace
commit 6c6df500f10b90aa1b9ab733b2b863b1c65ac0c6
Author: Jan Brauer <[email protected]>
Date: 2015-11-18T20:42:26Z
Add missing semicolons
----
> Thrift Generated Code Causes Global Variable Leaks
> --------------------------------------------------
>
> Key: THRIFT-1840
> URL: https://issues.apache.org/jira/browse/THRIFT-1840
> Project: Thrift
> Issue Type: Bug
> Components: Node.js - Compiler
> Affects Versions: 0.9
> Reporter: Russell Bradberry
> Labels: javascript, node
> Attachments: 0001-THRIFT-1840-fix-for-global-variable-leak.patch,
> fix_globals.js
>
>
> When compiling for NodeJS, the compiler creates globally scoped variables
> which is considered a bad practice as it can create unintended consequences.
> It also causes many testing frameworks to fail.
> the output looks something like this:
> {code}
> User = module.exports.User = function(args) {
> {code}
> when it should be
> {code}
> var User = module.exports.User = function(args) {
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)