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

Bryan Duxbury updated THRIFT-632:
---------------------------------

    Attachment: thrift-632-v3.patch

Ok. This patch seems to do everything we needed. Here's what I did:

# Created a method on t_scope called "resolve_const_value" that recursively 
finds const values that need to be tagged with their enum types. It also 
resolves constants referenced by name.
# Changed t_const_value's get_integer method to return the integer value of the 
appropriate enum constant when t_const_value is of IDENTIFIER type.
# Create a method on t_enum called "resolve_values" that directly assigns 
values to implicit enum constants. This makes sure the values will be available 
for the resolve_const_value call. It uses a somewhat naive enum value 
assignment algorithm, so that might be an area to improve.
# Small changes to thrifty.yy to make calls to the appropriate methods above 
when needed.

There's a fair amount of code changed in this patch, so I'd love some reviews.

> Constants of enum types don't behave well
> -----------------------------------------
>
>                 Key: THRIFT-632
>                 URL: https://issues.apache.org/jira/browse/THRIFT-632
>             Project: Thrift
>          Issue Type: Bug
>          Components: Compiler (Java)
>    Affects Versions: 0.2
>            Reporter: Bryan Duxbury
>            Assignee: Bryan Duxbury
>             Fix For: 0.2
>
>         Attachments: thrift-632-v2.patch, thrift-632-v3.patch, 
> thrift-632.patch
>
>
> It turns out that THRIFT-551 missed the case of constants defined of enum 
> types. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to