Project

General

Profile

Bug #2066

brew adds unnecessary comma in method parameter list after comment

Added by Eric Faulhaber about 11 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Start date:
02/28/2013
Due date:
% Done:

100%

billable:
No
vendor_id:
GCD
case_num:

ca_upd20130228a.zip (7.63 KB) Constantin Asofiei, 02/28/2013 03:01 AM

ca_upd20130228b.zip (7.79 KB) Constantin Asofiei, 02/28/2013 08:41 AM

ca_upd20130301a.zip (7.99 KB) Constantin Asofiei, 03/01/2013 06:57 AM

ca_upd20130301b.zip (7.97 KB) Constantin Asofiei, 03/01/2013 07:53 AM

ca_upd20130301d.zip (8.24 KB) Constantin Asofiei, 03/01/2013 11:41 AM

ca_upd20130305c.zip (8.36 KB) Constantin Asofiei, 03/05/2013 03:46 PM

ca_upd20130322i.zip (8.49 KB) Constantin Asofiei, 03/22/2013 04:09 PM

History

#1 Updated by Eric Faulhaber about 11 years ago

On a whim last night, I tried to compile the partially converted customer app project, and quickly hit an "illegal start of expression" error in many places. This was due to something like:

void myMethod( /* comment */, arg1, ...)

It looks like the test in brew's next-child rules for a star comment when emitting the comma is looking ahead instead of behind in this case.

#2 Updated by Constantin Asofiei about 11 years ago

  • Status changed from New to WIP
  • Start date set to 02/28/2013
  • Assignee set to Constantin Asofiei

#3 Updated by Constantin Asofiei about 11 years ago

I suggest to disable comments, run conversion in the good directories and compile again, to uncover non-comment problems.

#4 Updated by Constantin Asofiei about 11 years ago

Fix attempt for star comments mixed with children of IF, method arguments, and others. Will test with MAJIC and some server dirs.

#5 Updated by Ovidiu Maxiniuc about 11 years ago

I believe this was also addressed in the #1450. Unfortunately it was not finalized.

#6 Updated by Constantin Asofiei about 11 years ago

This fixes these cases:

i = (/* 1 */ if /* 2 */ func0(/* 3 */ 1, /* 4 */ 1, /* 5 */ 1 /* 6 */) /* 7 */ = /* 8 */ 1 /* 9 */ then /* 10 */ /* 222 */ /* 333 */ 1 /* 11 */ else /* 12 */ 11 /* 13 */).

assign /* 1a */ i /* 2a */ = /* 3a */ 1 /* 4a */
       /* 5a */ book.book-title /* 6a */ = /* 7a */ "2" /* 8a */
       /* 9a */ book.isbn /* 10a */ = /* 11a */ "asdasdasdasd" /* 12a */.

assign /* 1b */ i /* 2b */ = /* 3b */ 1000 /* 4b */.

#7 Updated by Greg Shah about 11 years ago

The code looks fine. And that is some testcase! It made me laugh to read it. Well done.

#8 Updated by Constantin Asofiei about 11 years ago

I still have some regressions in it, I'm testing and will re-upload.

#9 Updated by Constantin Asofiei about 11 years ago

The conclusion for today, after trying a scoping approach to solve some nested calls issues is this, in brew phase (a few examples):
1. this.getChildAt(nextChildIndex - 1).type should be written as this.getPrevChildNonStar().type
2. nextChildIndex > 1 should be written as getNonStarIndex(this, nextChildIndex) > 1
3. nextChildIndex 1 should be written as getNonStarIndex(this, nextChildIndex) 1
4. and others

What I'm trying to say here is that it will be cleaner (and easier) to modify the next-child-rules part to act as if the star nodes are not there. As we have only a move-forward phase provided by next-child-rules section where we can act on children, and not a "child-finished-rules" section to be able to look backwards, trying to fix next-child-rules feels like chasing my own tail. It will be very ugly and in the end I will still not be sure that I will cover all cases.

#10 Updated by Constantin Asofiei about 11 years ago

Made next-child-rules to be ignorant of star-comment nodes, I'm putting this through conversion regression testing.

#11 Updated by Constantin Asofiei about 11 years ago

Replaced getNextSibling with ignore-star version.

#12 Updated by Greg Shah about 11 years ago

I am fine with the changes. If they pass conversion testing, let's go with it.

#13 Updated by Constantin Asofiei about 11 years ago

I'm running conversion now.

#14 Updated by Constantin Asofiei about 11 years ago

I'm stopping conversion, a server folder has failed with some other comment related issue. I need to get rewrite at least the following too:
  1. numberOfChildren
  2. nextSibling
  3. getChildAt
  4. numImmediateChildren

#15 Updated by Constantin Asofiei about 11 years ago

I'm testing this version with the server files which had comment errors, if everything is good I move to conversion regression testing.
Note that I left the next-child-rules section un-indented, to ease review.

#16 Updated by Greg Shah about 11 years ago

Well done. It looks good. Painful, though. I have to think about this problem a bit to see if there is a way to help this in the future in TRPL.

#17 Updated by Constantin Asofiei about 11 years ago

OK, the server's compilable folders do not seem to report any comment-related errors. I'm putting this through conversion testing (comments disabled).

#18 Updated by Constantin Asofiei about 11 years ago

Conversion has finished, compiled fully, but there are some regressions in terms of:
  1. new-lines no longer emitted in some cases (i.e. between inner classes)
  2. additional ';' character emitted on an empty line or at the end of a "//" comment

I'm running another conversion with comments enabled, to check if it compiles. I will fix the two issues before releasing the update.

#19 Updated by Constantin Asofiei about 11 years ago

MAJIC has compiled with comments enabled (and AFAIK this was not possible before this update).

#20 Updated by Greg Shah about 11 years ago

WOW! That is very cool. Great job!

#21 Updated by Constantin Asofiei about 11 years ago

This update passes conversion regression testing with comments off (no changes in generated sources), and MAJIC does compile with comments on. Next I will leave a conversion of all server folders over night, with comments enabled, and compare the build logs with the comments off versions - there should be no differences.

#22 Updated by Constantin Asofiei about 11 years ago

The server folders had no errors related to comments.

#23 Updated by Constantin Asofiei about 11 years ago

Committed to bzr revision 10251.

#24 Updated by Greg Shah about 11 years ago

  • % Done changed from 0 to 100
  • Status changed from WIP to Closed

#25 Updated by Constantin Asofiei about 11 years ago

There is a problem when the comment is emitted after the peer:

def var i as int.
case i:
when 0 then /* v0 */ 
  assign i = i + 0.
when 1 then /* v1 */
  assign i = i + 0.
end.

converts to:
            switch ((i).intValue())
            {
               case 0:
               {
                  i.assign(plus(i, 0));
                  break;
               }
 /* v0 */               case 1:
               {
                  i.assign(plus(i, 0));
                  break;
               }
 /* v1 */;
            }

Note the extra semicolon emitted after the last comment. This is caused by a change in brew.xml, but if I remove that change, other cases get regressed.

At this time, I'm not sure if we really need to emit the comment after the code where it was in the legacy code... can you explain a little why you chose this approach in comments.rules?

#26 Updated by Constantin Asofiei about 11 years ago

wrong task

#27 Updated by Constantin Asofiei about 11 years ago

wrong task

#28 Updated by Constantin Asofiei about 11 years ago

wrong task

#29 Updated by Constantin Asofiei about 11 years ago

This is a quirk for the SWITCH statement comment case. At this time, I think convert/comments.rules might be incomplete (idea is, why not skip intermediate artifical nodes with no line numbers, when searching for peers?), but if the quirk passes conversion regression testing and the server folders accept it, we should go with it for now.

#30 Updated by Greg Shah about 11 years ago

I agree. The approach you have taken is fine for now.

I also agree that we will need to make additional changes to the comments processing. At a minimum, the way we associate comments with surrounding code needs improvement.

The idea of bypassing artificial nodes sounds good, but I have to look carefully at the impact before I can really say.

Anyway, if this passes testing, you can release it.

#31 Updated by Constantin Asofiei about 11 years ago

ca_upd20130322i.zip was committed to bzr revision 10320. MAJIC conversion regression testing has passed (with comments disabled and enabled), and also the server folders seem to have accepted it (no comment related errors in logs).

#32 Updated by Greg Shah over 7 years ago

  • Target version changed from Milestone 4 to Conversion Support for Server Features

Also available in: Atom PDF