You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Justin Florentine (JIRA)" <ji...@apache.org> on 2010/08/02 16:18:16 UTC

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

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
    Affects Versions: 0.3
         Environment: Any.
            Reporter: Justin Florentine


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.

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();

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


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

Posted by "Justin Florentine (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-835?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Justin Florentine updated THRIFT-835:
-------------------------------------

    Component/s: AS3 - Compiler

> 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
>
> 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.
> 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();

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


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

Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-835?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12905341#action_12905341 ] 

Bryan Duxbury commented on THRIFT-835:
--------------------------------------

This patch doesn't seem to apply cleanly for some reason. Could you attach a new version, preferably in a file?

> 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
>
> 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.
-
You can reply to this email to add a comment to the issue online.


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

Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-835?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bryan Duxbury updated THRIFT-835:
---------------------------------

    Description: 
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}

  was:
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.

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();


> 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
>
> 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.
-
You can reply to this email to add a comment to the issue online.