Ticket #1422 (closed Bug: fixed)

Opened 14 months ago

Last modified 4 months ago

Rename variables declared in single var statement

Reported by: fredck Owned by: fredck
Priority: Normal Milestone:
Component: Project : FCKpackager Version:
Keywords: Confirmed Review+ Cc:

Description

Input Code

function Testing()
{
    var test1 = 1, test2 = 2, test3 = 3 ;

    alert( test1 + test2 + test3 ) ;
}

Current Results

function Testing(){var A=1,test2=2,test3=3;alert(A+test2+test3);}

Expected Results

function Testing(){var A=1,B=2,C=3;alert(A+B+C);}

Attachments

1422.patch (1.0 KB) - added by fredck 5 months ago.
1422_2.patch (1.7 KB) - added by fredck 4 months ago.

Change History

Changed 9 months ago by w.olchawa

  • keywords Confirmed added

Changed 5 months ago by fredck

Changed 5 months ago by fredck

  • keywords Review? added
  • owner set to fredck
  • status changed from new to assigned

The proposed patch now do the variable search in two steps. The first identify the var declaration blocks. The second extract all names defined in that block.

Changed 4 months ago by fredck

  • keywords Review- added; Review? removed

Discussion about it with Martin, we found out that variables with the "$" character are not being matched by the proposed patch.

Changed 4 months ago by fredck

Changed 4 months ago by fredck

  • keywords Review? added; Review- removed

The new patch now matches any kind of character in the variable name. It also fixes a bug with special regex characters (like "$") in the variable name.

Changed 4 months ago by martinkou

  • keywords Review+ added; Review? removed

Changed 4 months ago by fredck

  • status changed from assigned to closed
  • resolution set to fixed

Fixed with [2268].

I've tested it over the trunk and I still found some issues that have been addressed in the committed code.

Note: See TracTickets for help on using tickets.