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

[jira] [Closed] (THRIFT-835) Bad AS3 syntax in constructors that set default values

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

Jake Farrell closed THRIFT-835.
-------------------------------


> Bad AS3 syntax in constructors that set default values
> ------------------------------------------------------
>
>                 Key: THRIFT-835
>                 URL: https://issues.apache.org/jira/browse/THRIFT-835
>             Project: Thrift
>          Issue Type: Bug
>          Components: AS3 - Compiler
>    Affects Versions: 0.3
>         Environment: Any.
>            Reporter: Justin Florentine
>            Assignee: Justin Florentine
>             Fix For: 0.7
>
>         Attachments: THRIFT-835.patch
>
>
> If your thrift definition declares static default values, such as:
> struct Chat {
>     1: MessageType type = EVENT_CHAT,
>     2: i32 eventId,
>     3: string message,
>     4: Date at
> }
> The generated AS3 object won't compile since the compiler uses the same function that generates member declarations.  Patch is below.
> {code}
> Index: compiler/cpp/src/generate/t_as3_generator.cc
> ===================================================================
> --- compiler/cpp/src/generate/t_as3_generator.cc        (revision 981076)
> +++ compiler/cpp/src/generate/t_as3_generator.cc        (working copy)
> @@ -696,7 +696,8 @@
> for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
>   t_type* t = get_true_type((*m_iter)->get_type());
>   if ((*m_iter)->get_value() != NULL) {
> -      print_const_value(out, "this." + (*m_iter)->get_name(), t, (*m_iter)->get_value(), true, true);
> +      indent(out) << "this._" << (*m_iter)->get_name() << " = " << (*m_iter)->get_value()->get_integer() << ";" <<
> +      endl;
>   }
> }
> indent_down();
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira