Opened 18 years ago
Closed 17 years ago
#1422 closed Bug (fixed)
Rename variables declared in single var statement
| Reported by: | Frederico Caldeira Knabben | Owned by: | Frederico Caldeira Knabben |
|---|---|---|---|
| Priority: | Normal | Milestone: | |
| Component: | Project : CKPackager | 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 (2)
Change History (8)
comment:1 Changed 18 years ago by
| Keywords: | Confirmed added |
|---|
Changed 17 years ago by
| Attachment: | 1422.patch added |
|---|
comment:2 Changed 17 years ago by
| Keywords: | Review? added |
|---|---|
| Owner: | set to Frederico Caldeira Knabben |
| Status: | new → assigned |
comment:3 Changed 17 years ago by
| 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 17 years ago by
| Attachment: | 1422_2.patch added |
|---|
comment:4 Changed 17 years ago by
| 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.
comment:5 Changed 17 years ago by
| Keywords: | Review+ added; Review? removed |
|---|
comment:6 Changed 17 years ago by
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
Fixed with [2268].
I've tested it over the trunk and I still found some issues that have been addressed in the committed code.

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.