Skip to content

Comment followed by a brace conversion bug #336

@chrisvelevitch

Description

@chrisvelevitch

If a comment is followed by a brace, the brace is moved to the end of the comment and is effectively commented out. Now the code won't compile because the brace is missing as it's now part of the comment. It happens anytime a brace is followed by a comment. This happens quite consistently in a large code base. When this happens extra braces are inserted.

as3 code for example:

if(labelRenderer !== null) //both label and icon
{
	if(this._iconPosition !== RelativePosition.TOP &&
		this._iconPosition !== RelativePosition.BOTTOM &&
		this._iconPosition !== RelativePosition.MANUAL)
	{
		newWidth += adjustedGap + this.currentIcon.width;
	}
	else if(this.currentIcon.width > newWidth) //top, bottom, or manual
	{
		newWidth = this.currentIcon.width;
	}
}
else //no label
{
	newWidth = this.currentIcon.width;
}

This example should pass through unchanged but the actual result is:-

if (labelRenderer != null)
                
       //both label and icon{
                    
           {
               if (this._iconPosition != RelativePosition.TOP &&
                   this._iconPosition != RelativePosition.BOTTOM &&
                   this._iconPosition != RelativePosition.MANUAL)
               {
                   newWidth += adjustedGap + this.currentIcon.width;
               }
               else if (this.currentIcon.width > newWidth)
                        
               //top, bottom, or manual{
                            
                   {
                       newWidth = this.currentIcon.width;
                   }
               }
           }
       }
   //no label
       else
       {
                    
           {
                newWidth = this.currentIcon.width;
           }
       }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions