Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comment followed by a brace conversion bug #336

Open
chrisvelevitch opened this issue Nov 28, 2018 · 0 comments
Open

Comment followed by a brace conversion bug #336

chrisvelevitch opened this issue Nov 28, 2018 · 0 comments

Comments

@chrisvelevitch
Copy link

chrisvelevitch commented Nov 28, 2018

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 chrisvelevitch changed the title Brace followed by a comment conversion bug Comment followed by a brace conversion bug Nov 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant