You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Bryan Duxbury (JIRA)" <ji...@apache.org> on 2011/06/09 00:51:58 UTC
[jira] [Commented] (THRIFT-1200) JS compiler generates code that
clobbers existing namespaces
[ https://issues.apache.org/jira/browse/THRIFT-1200?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13046268#comment-13046268 ]
Bryan Duxbury commented on THRIFT-1200:
---------------------------------------
So you don't need the "var" statement, even for the first segment?
> JS compiler generates code that clobbers existing namespaces
> ------------------------------------------------------------
>
> Key: THRIFT-1200
> URL: https://issues.apache.org/jira/browse/THRIFT-1200
> Project: Thrift
> Issue Type: Bug
> Components: JavaScript - Compiler
> Affects Versions: 0.6.1
> Environment: all
> Reporter: Ilya Maykov
> Assignee: Ilya Maykov
> Attachments: THRIFT-1200-js-namespace-fix.txt
>
>
> The JavaScript compiler currently generates code that will clobber an already-existing namespace. It should check if the namespace exists before initializing it to {}. Example code pre-patch, assuming the .thrift file has the declaration {{namespace js CompanyName.ModuleName}}:
> {code:JavaScript}
> var CompanyName = {};
> CompanyName.ModuleName = {}
> {code}
> Becomes this after patch:
> {code:JavaScript}
> if (typeof CompanyName === 'undefined') CompanyName = {};
> if (typeof CompanyName.ModuleName === 'undefined') CompanyName.ModuleName = {};
> {code}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira