as3hx icon indicating copy to clipboard operation
as3hx copied to clipboard

Brace followed by comment conversion bug

Open chrisvelevitch opened this issue 6 years ago • 2 comments

If a brace is followed by a comment on the next line, the brace is removed and added the end of the comment and now the code is missing a brace and is no longer compilable.

as3 code for example:

if(this._explicitWidth !== this._explicitWidth && //isNaN
    (this.actualWidth > value || this.actualWidth == oldValue))
{
    //only invalidate if this change might affect the width
    this.invalidate(INVALIDATION_FLAG_SIZE);
}

expected result

if(this._explicitWidth != this._explicitWidth && //isNaN
    (this.actualWidth > value || this.actualWidth == oldValue))
{
    //only invalidate if this change might affect the width
    this.invalidate(INVALIDATION_FLAG_SIZE);
}

actual result

if (this._explicitWidth != this._explicitWidth &&  //isNaN  
    (this.actualWidth > value || this.actualWidth == oldValue))

//only invalidate if this change might affect the width{
    
    this.invalidate(INVALIDATION_FLAG_SIZE);
}

chrisvelevitch avatar Nov 29 '18 04:11 chrisvelevitch

Same issue on my side.

Source:

if (expressionA)
{
	// comment
	expressionB;
}

Result:

if (expressionA)

// comment{
    
    expressionB;
}

Expected result:

if (expressionA)
{
    // comment
    expressionB;
}

Adolio avatar Sep 10 '19 14:09 Adolio

I'm also interested in a proper fix.

In the meantime I did a quick workaround here: https://github.com/firefalcom/as3hx/commit/84b93d5aa53191bab9a6a411699bd468dc913b98

gogoprog avatar Jul 31 '20 12:07 gogoprog