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

Henrique Mendonça commented on THRIFT-2720:
-------------------------------------------

Hm... that should only happens if you have gen_ts_ active: 
https://github.com/apache/thrift/blob/master/compiler/cpp/src/generate/t_js_generator.cc#L464
Perhaps it's get active by default?
>From what I see in the code this could happen by chance as gen_ts_ doesn't 
>seem to be initialised at all, if gen_node_ is.
Therefore, you get a 50% chance of getting it set to *true* from memory garbage.
perhaps we only need a
{code}
else { gen_ts_ = false; }
{code}
on 
https://github.com/apache/thrift/blob/master/compiler/cpp/src/generate/t_js_generator.cc#L67
but I couldn't test it yet.
Feel free to submit a patch if you find a solution.
Cheers

> nodejs - Error with enum generation
> -----------------------------------
>
>                 Key: THRIFT-2720
>                 URL: https://issues.apache.org/jira/browse/THRIFT-2720
>             Project: Thrift
>          Issue Type: Bug
>          Components: Node.js - Compiler
>    Affects Versions: 1.0
>            Reporter: Rodolfo Ochoa
>
> the issue is on node.js, an enum is generated like this:
> ttypes.TPolicy = {
>  '1' : 'NO_SYNC',
>  'NO_SYNC' : 1,
>  '2' : 'SYNC',
>  'SYNC' : 2,
>  '3' : 'WRITE_NO_SYNC',
>  'WRITE_NO_SYNC' : 3
> };
> correct is:
> ttypes.TPolicy = {
>  'NO_SYNC' : 1,
>  'SYNC' : 2,
>  'WRITE_NO_SYNC' : 3
> };
> from the .thrift file:
> enum TPolicy
> {
>     NO_SYNC       = 1,
>     SYNC          = 2,
>     WRITE_NO_SYNC = 3
> }



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to