as3hx icon indicating copy to clipboard operation
as3hx copied to clipboard

Comment followed by a brace conversion bug

Open chrisvelevitch opened this issue 7 years ago • 0 comments

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;
           }
       }

chrisvelevitch avatar Nov 28 '18 14:11 chrisvelevitch